I'm trying to use the VcenterVStorageObjectManager ExtendDisk_Task operation to extend a virtual machine's virtual disk to 30GB, but for the VirtualDisk device it seems that the VDiskId property is always returned as null no matter which VM or disk try it on. I'm not sure why that is, we are running 6.5 on all hosts and VCSA and all VMs are VM version 13. The code seems pretty straightforward if I could figure out why VDiskId doesn't seem to be populating. Does anyone have any ideas? Useful information on using the virtual disk manager seems pretty scarce from what I can find searching
VcenterVStorageObjectManager vDiskMan = (VcenterVStorageObjectManager)vimClient.GetView(vimClient.ServiceContent.VStorageObjectManager, null); VirtualDevice[] devices = vm.Config.Hardware.Device; VirtualDisk vd = null; foreach (VirtualDevice device in devices) { device.DeviceInfo.Label.Equals("Hard disk 1")) { vd = (VirtualDisk)device; VirtualDiskFlatVer2BackingInfo backInfo = (VirtualDiskFlatVer2BackingInfo)vd.Backing; //vd.VDiskId always reports null vDiskMan.ExtendDisk_Task(vd.VDiskId, backInfo.Datastore, 30720); } }