Timothy1
Contributor
Contributor

RCLI: vmware-cmd problems with virtual machines in subdirectories

Hi all,

I'm experiencing the following problem. When we use the vmware-cmd rcli tool we can not get the state from virtual machine in directories other then the root directy. So for example

vmware-cmd.pl -H esx03 -U root -P "" "/vmfs/volumes/VMWare_LUN/XP64-BASE/VM-ESX-05.vmx" getstate

vmware-cmd.pl -H esx03 -U root -P "" "/vmfs/volumes/49906d10-09aff93b-76b2-00215e30668a/XP64-BASE/VM-ESX-05.vmx" getstate

is working perfectly because the vm folder is straight under the VMWare_LUN datastore folder. However the following

vmware-cmd.pl -H esx03 -U root -P "" "/vmfs/volumes/VMWare_LUN/Production/VMS-ORACLE_PROD/VMS-WIN2003-X64.vmx" getstate

vmware-cmd.pl -H esx03 -U root -P "" "/vmfs/volumes/49906d10-09aff93b-76b2-00215e30668a/Production/VMS-ORACLE_PROD/VMS-WIN2003-X64.vmx" getstate

is not working because as you can see there is a folder "Production" between the datastore and the vmware folder.

Has anyone else encountered this problem?

Thanks In Advance,

Timothy

0 Kudos
9 Replies
nick_couchman
Immortal
Immortal

What type of datastore is this?

0 Kudos
admin
Immortal
Immortal

Can you show us the error vmware-cmd gives when it fails?

0 Kudos
Timothy1
Contributor
Contributor

The virtual machines are hosted on shared storage (fibre channel)

The error is stating "No virtual machine found"

TIA

Timothy

0 Kudos
Timothy1
Contributor
Contributor

Hi all,

The bug is definitly in the rcli code. I opened up the vmware-cmd.pl script and added a single line to see what the effect was.

sub get_vm {

my $vm_cfg_path = shift;

my $hostView;

my $vm_view;

print($vm_cfg_path);

When I tried it out I got the following effect

TIMOTHY>vmware-cmd.pl -H 10.2.14.1 -U root -P mypass /vmfs/volumes/datastore1/inside/testmap/testmap.vmx getstate

inside/testmap

No virtual machine found

TIMOTHY>vmware-cmd.pl -H 10.2.14.1 -U root -P mypass /vmfs/volumes/datastore1/testmap/testmap.vmx getstate

testmap/testmap.vmx

No virtual machine found

Notice how the first run (with multiple subfolders) does not add the vmx file. I modified the code manually by doing

sub get_vm {

my $vm_cfg_path = shift;

my $hostView;

my $vm_view;

$vm_cfg_path = "[datastore1] inside/testmap/testmap.vmx";

TIMOTHY>vmware-cmd.pl -H 10.2.14.1 -U root -P mypass /vmfs/volumes/datastore1/inside/testmap/testmap.vmx getstate

datastore1 inside/testmapgetstate() = on

Which makes the code work.

My perl skills are not all that but I'm going to try to pinpoint the problem.

0 Kudos
Timothy1
Contributor
Contributor

in the meanwhile i found the following in the code which causes the bug to occure when using multiple subfolders

sub generate_cfg_path {

........

if($ds_flag == 1) {

return (" " . $patharr[4] . "\/" . $patharr[5]);

}

........

0 Kudos
lamw
Community Manager
Community Manager

You should file a bug with VMware Support about this issue and they can track it and hopefully fix it in a future release

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

0 Kudos
DoctorNet
Contributor
Contributor

Hi Timothy,

thanks for your analysis - I was bitten by the same thing (after spending hours getting rcli to work on Ubuntu 9.04, but that's another story).

Please find attached a patch, that enhances config-path generation to arbitrary directory nesting levels.

After reading through the EULA I decided, I cannot attach the patched version, but a patch should be OK.

patch was crated with "diff -u /usr/bin/vmware-cmd-ori /usr/bin/vmware-cmd-patched"

Best regards,

Eugen

0 Kudos
cw2
Contributor
Contributor

The patch works. The fix still isn't in 4.1.0 build 254719 for Linux. Where would this bug get listed?

Anyone got any more info on how to get some guestinfo other than the IP address? The given name and OS would be useful.

0 Kudos
TiloVM
Contributor
Contributor

Still face the same in "No virtual machine found." due to subfolder in datastores

Version:

VMware-viclient-all-4.1.0-345043.exe

VMware-VMvisor-Installer-4.1.0.update1-348481.x86_64.iso

no subfolder no problems.

Even the VMA system has the same issue (vMA-4.1.0.0-268837.zip)

0 Kudos