Reply to Message

View discussion in a popup

Replying to:
GBrown1983
Enthusiast
Enthusiast

Correlate GuestDiskInfo with VirtualHardware

Hi,

I'm trying to create a workflow to automate disk extend based on free space (less than 10%).

I get the free space with GuestDiskInfo -  "vm.guest.disk.freeSpace" and "vm.guest.disk.capacity".

The problem is that I can't correlate this to the VirtualHardware disk (vm.config.hardware.device) so I can't tell which disk needed to be extend.

I can get what seems like the disk object with " vm.guest.disk[i]" but I don’t know how to use it for something useful.

Any tips on how to do this?

The script I use to get the free space – (it's in a very initial stage…)

var disks = vm.guest.disk;

for (i in disks)

{

System.log("DiskPath - " + (disks[i].diskPath));

    System.log("FreeSpace (GB) - " + (disks[i].freeSpace / 1024 / 1024 / 1024));

    System.log("Capacity (GB) - " + (disks[i].capacity / 1024 / 1024 / 1024));

          

    if ((disks[i].freeSpace / disks[i].capacity) <= 0.1)

    {

//      var diskToGrow = disks[i];

        var diskNewSize = Math.round(((disks[i].capacity * 1.05) / 1024 / 1024 / 1024));      

    }

}

Tags (2)
Reply
0 Kudos