bayancb
Contributor
Contributor

Virtual machine Disk Consolidate need

i am facing this issue on my virtual machine disk

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Hi,

Check the following vRO scripting code. Its input is the variable vm of type VC:VirtualMachine.

if (vm != null

        && vm.runtime.connectionState.value == "connected"

        && !vm.config.template

        && vm.runtime.consolidationNeeded) {

    System.log("Consolidating disks of VM: " + vm.name);

    var task = vm.consolidateVMDisks_Task();

    var waitResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task);

}

0 Kudos