VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 2 Previous Next 27 Replies Last post: Feb 27, 2009 10:24 AM by Dave.Mishchen…  

vmware-cmd.pl not case sensitive posted: Dec 2, 2008 4:59 PM

Click to view JasonBurrell's profile Enthusiast 89 posts since
Apr 21, 2008

I am trying to get the state of all virtual machines running on a host but it looks like vmware-cmd.pl on the Remote CLI does not understand case sensitive directories. For example I can do a vmware-cmd.pl -l and get this:

/vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/HQLAB01/HQLAB01.vmx
/vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/hqlab01/104/000104-R370-1.vmx
/vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/hqlab01/105/000105-R370-2.vmx
/vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/hqlab01/106/000106-R370I-1.vmx

When I try to get state of any machine with a lowercase hqlab01 i get this:

vmware-cmd.pl /vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/hqlab01/104/000104-R370-1.vmx getstate

No virtual machine found

Upper case like this works fine:

vmware-cmd.pl /vmfs/volumes/48dcf09b-1b6d5eab-70dd-001e0b5d9eec/HQLAB01/HQLAB01.vmx getstate

getstate() = off

Re: vmware-cmd.pl not case sensitive

1. Dec 2, 2008 5:19 PM in response to: JasonBurrell
Click to view mittell's profile Champion 3,096 posts since
Apr 25, 2006
Hmm, tried single quoting the /path/to/vmx bit?

Re: vmware-cmd.pl not case sensitive

3. Dec 2, 2008 6:23 PM in response to: JasonBurrell
Click to view lamw's profile Champion 2,820 posts since
Nov 27, 2007
Is there any reason why you can not take what "vmware-cmd -l" returns to you and run a getstate on that given VM? I would just run a for loop across all VMs and as it provides you with the path to the .vmx file, just do a getstate and then you can pretty print it or just output VM Name and State. This way you don't have to worry about the case sensitively of the command, I was always under the impression it was case sensitive.

Re: vmware-cmd.pl not case sensitive

5. Dec 3, 2008 9:38 AM in response to: JasonBurrell
Click to view lamw's profile Champion 2,820 posts since
Nov 27, 2007
Are you doing something similar:

#!/bin/bash

IFS=$'\n'
echo -e "VM_NAME\t\tSTATE"
for i in `vmware-cmd -l`;
do
        VM_NAME=`vmware-cmd "$i" getconfig displayname | awk '{print $3}'`
        STATE=`vmware-cmd "$i" getstate | awk '{print $3}'`
        echo -e "${VM_NAME}\t\t${STATE}"
done
unset IFS


Give this a try and see if it works and if not, try doing "sh -x script.sh" to see what attributes are being passed in.

Re: vmware-cmd.pl not case sensitive

13. Feb 24, 2009 6:19 PM in response to: JasonBurrell
Click to view sdelmas's profile Novice 7 posts since
Jan 23, 2006

Did you ever figure this out? I am running into the exact same problem... I am taking the exact output from the vmware-cmd.pl script and put it into the subsequent call to vmware-cmd.pl, and still I get "No virtual machine found"... for eaxample:

/vmfs/volumes/483411be-874070d6-23e8-001d09709fa3/VM/39854/039854-aeolus-w2k3.vmx (this is the output from the -l invocation)

vmware-cmd.pl -H vmconsole1.electric-cloud.com -U root -P password /vmfs/volume/483411be-874070d6-23e8-001d09709fa3/VM/39854/039854-aeolus-w2k3.vmx getstate
No virtual machine found

I tried with quotes around the .vmx file name (which shold not make any difference as there are no spaces in the path), and that indeed did't change anything. If I log in to the server I can do an ls on the file and it's there, with proper permissions... the server is a Linux box.

Thanks,
Sven


VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities