2

I'm using pyVmomi to pull a list of all VM's in our VMware vSphere environment.

I'm iterating through the VirtualMachine config.hardware.device and checking if I have an instance of vim.vm.device.VirtualDisk

for device in virtual_machine.config.hardware.device:
    if isinstance(device, vim.vm.device.VirtualDisk):
        # Collect information here

Is it possible with pyVmomi to retrieve the storage policies from a VirtualMachine or do I need to work backwards from each Datastore?

Jonathan
  • 178
  • 2
  • 9

1 Answers1

1

Perhaps you could use this example from the pyvmomi examples which shows details on all of the storage policies of the VM. There is also the Storage Policy API docs if you need more reference.

Best of luck.

tread
  • 10,133
  • 17
  • 95
  • 170
Scoder12
  • 50
  • 1
  • 8