VMware Cloud Community
nettech1
Expert
Expert

Guest.Disk.Capacity returns null for one of the VMs

Hi,

Wondering if anyone would have an idea why the Guest.Disk.Capacity value for one of the VM appliances |OS: Other 2.6 Linux (64bit)| would return null?

VM is running 3rd-party VM tools and is HW ver 10

The VM has 2 Virtual Disks attached that are connected to a single paravirtual SCSI controller.

$vm = Get-View -ViewType "VirtualMachine" -Filter @{'Runtime.PowerState'='poweredOn';  'name'='problemChild ' }

$size = $vm.Guest.Disk.Capacity

Write-Warning : Cannot bind argument to parameter 'Message' because it is null.

At line:1 char:15

+ Write-Warning $size

+               ~~~~~

    + CategoryInfo          : InvalidData: (:) [Write-Warning], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteWarningCommand

Thanks

23 Replies
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
LucD
Leadership
Leadership

That error message doesn't seem to come from referencing that property, but it seems to come from a call to the Write-Warning cmdlet.

The error states that it can not find a value for the Message parameter on the cmdlet.

Is there a part of the script, with Write-Warning in there, that you are not showing?

Or is there something in your profile?

Or did you create an alias where the code contains a Write-Warning?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

sorry, forgot to paste the last line of the code

Write-Warning $size

Reply
0 Kudos
nettech1
Expert
Expert

$vm = Get-View -ViewType "VirtualMachine" -Filter @{'Runtime.PowerState'='poweredOn';  'name'='goodVM' }

$size = $vm.Guest.Disk.Capacity

Write-Warning $size

WARNING: 31181598720

Reply
0 Kudos
LucD
Leadership
Leadership

Sorry, but I'm confused.
The Write-Warning seems to return a value.
And the earlier error mentions line 1, while the Write-Warning seems to be on line 3.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

Yes, Write-Warning returns a value for goodVM, but when I replace it with a problemChild VM I get a null value for $vm.Guest.Disk.Capacity.

Reply
0 Kudos
LucD
Leadership
Leadership

Ok, got it.
The GuestDiskInfo description contains the warning that it contains information for "Ext2, Ext3, Ext4, ReiserFS, XFS, Btrfs, NTFS, VFAT, UFS, PCFS, HFS, and MS-DOS" filesystems.

Could it be that you're looking at a filesystem type that is not in that list?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

the problematic VM is a FortiManager. Is there a way to find out what file system it's using?

Fortinet Documentation Library

Do i have to run an autopsy on the VMDK?

QEMU disk image utility for Windows - Davoud Teimouri - Virtualization and Data Center

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership

That might explain it.


As I remember, a Fortinet Appliance uses an LVM.

That might be the reason why the VMware Tools do not capture disk capacity.


Looking at the VMDK will not help afaik.

A VMDK will be presented to the LVM inside the guest OS as a 'disk'.

The LVM then places its own structure on top of these disks.

Fortinet FD40848 shows this when discussing how to extend disk space in the appliance.
In short, you add a disk (= VMDk), and the LVM will use that extra space.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

so the appliance has 2 VMDKs attached.

hdd1 is a 2GB file

hdd2 is a 100GB file

hdd1 contains 3 volumes with volume 2 being formated as ext3

fm.jpg

ext3.png

so according to your earlier post we should get something returned for ext3 since it's one of the supported partitions...

Reply
0 Kudos
nettech1
Expert
Expert

VMware Knowledge Base

Note: If the disks or partitions are managed by a Logical Volume Manager (LVM), the guest disk info is collected even if the filesystem is not on the above list.

Doesn't this mean that I should get some value even if the disks are managed by LVM?

Reply
0 Kudos
LucD
Leadership
Leadership

Provided the VMware Tools know how to 'talk' with the LVM.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership

Which KB are you referring to?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

KB2004829, i linked it in my post above

Reply
0 Kudos
LucD
Leadership
Leadership

That's a rather old KB article(2011 for ESX 4.*), and it doesn't seem to have an update for recent ESXi versions.

Do you have this missing disk capacity information only on this appliance?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
nettech1
Expert
Expert

yep, this is the only VM i am not getting any disk info or actually getting null in return. 

Reply
0 Kudos
LucD
Leadership
Leadership

Then I'm afraid I can't analyse any further.
I don't have such an appliance running, nor do I have the environment or license for it.

You could ultimately have a look in the VM's vmware.log if there are issues with the VMware Tools.

But I suspect there aren't.


Another thing you might check is if Guest.Disk.Capacity is the only info that is missing.

Have a look with

$vm.ExtensionData.Guest | Format-Custom -Depth 3

On a side note, the last Fortinet appliance I worked with (some time ago) didn't even have VMware Tools installed.

Which was a PITA for automated, scheduled restarting of VMs.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

nettech1
Expert
Expert

could not get ExtensionData to work with Get-View, but it works flawlessly with Get-VM, will try this with Fortimanger

(Get-VM -Name VCSA).ExtensionData.guest | Format-Custom -Depth 3

  Disk =

    [

      class GuestDiskInfo

      {

        DiskPath = /

        Capacity = 11355283456

        FreeSpace = 3986194432

      }

      class GuestDiskInfo

      {

        DiskPath = /boot

        Capacity = 125783040

        FreeSpace = 80780288

      }

      class GuestDiskInfo

      {

        DiskPath = /storage/netdump

        Capacity = 1031823360

        FreeSpace = 960466944

      }

      class GuestDiskInfo

      {

        DiskPath = /storage/imagebuilder

        Capacity = 10426310656

        FreeSpace = 9849491456

Reply
0 Kudos
LucD
Leadership
Leadership

Thanks.
Get-View and the ExtensionData property in the object returned from Get-VM are the same.
Two methods of accessing the same.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos