Skip to content

Instantly share code, notes, and snippets.

@hartsock
Last active September 11, 2015 06:49
Show Gist options
  • Save hartsock/9898906 to your computer and use it in GitHub Desktop.
Save hartsock/9898906 to your computer and use it in GitHub Desktop.
Ideas for how to get at RDM data from pyVmomi
# 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'
@argaliev
Copy link

in my case this was working:

lun = [l for l in ss.storageDeviceInfo.scsiLun
if d.backing.lunUuid == l.uuid][0]

because vm.device.VirtualDisk deviceName format not match storageDeviceInfo.scsiLun deviceName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment