Hi all,
I am looking of a way to find the disktype of a virtual disk through vCO. I want to mass storage vMotion a bunch of VM but before doing the Storage vMotion I want to validate if the VM has RDM attach to it. If yes, I will skip the storage vMotion.
I find that vm.config.hardware.device has VC:VirtualDisk object in it but this object has no disktype.
I find a VC:VirtualDiskType, but how to retrieve this information for an existing disk?
Thanks.
Pretty straightforward...
var devices = vCenterVm.config.hardware.device;
for each (var d in devices) {
if (d.backing instanceof VcVirtualDiskRawDiskMappingVer1BackingInfo) { System.debug("RDMv1 found"); }
if (d.backing instanceof VcVirtualDiskRawDiskVer2BackingInfo) { System.debug("RDMv2 found"; }
}
Alternately, you can look at the device.backing value, as well. That'll show you if it's an RDM, thin or thick provisioned disk.
Pretty straightforward...
var devices = vCenterVm.config.hardware.device;
for each (var d in devices) {
if (d.backing instanceof VcVirtualDiskRawDiskMappingVer1BackingInfo) { System.debug("RDMv1 found"); }
if (d.backing instanceof VcVirtualDiskRawDiskVer2BackingInfo) { System.debug("RDMv2 found"; }
}
Alternately, you can look at the device.backing value, as well. That'll show you if it's an RDM, thin or thick provisioned disk.
Thanks Steve!