Last active
September 11, 2015 06:49
-
-
Save hartsock/9898906 to your computer and use it in GitHub Desktop.
Ideas for how to get at RDM data from pyVmomi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first get the disks... | |
disks = [d for d in vm.config.hardware.device | |
if isinstance(d, pyVmomi.vim.vm.device.VirtualDisk) and | |
isinstance(d.backing, pyVmomi.vim.vm.device.VirtualDisk.RawDiskMappingVer1BackingInfo)] | |
print d.deviceInfo.deviceName | |
# then later | |
ss = vm.runtime.host.configManager.storageSystem | |
for d in disks: | |
try: | |
lun = [l for l in ss.storageDeviceInfo.scsiLun | |
if d.deviceName == l.deviceName][0] | |
print d.deviceInfo.label, lun.canonicalName | |
except IndexError: | |
print 'Disk not found' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in my case this was working:
because
vm.device.VirtualDisk
deviceName format not matchstorageDeviceInfo.scsiLun
deviceName