VMware Cloud Community
CSIEnvironments
Enthusiast
Enthusiast

vCLI fails to register a VM on ESXi 4.1

Hi Guys I hope you can help

I am trying to register a VM from teh vCLI but I keep getting :

Fault:

SOAP Fault:

-


Fault string: A specified parameter was not correct.

Fault detail: InvalidArgument

A specified parameter was not correct.

I have tried the following

vmware-cmd.pl --server derblesx32 -s register "/vmfs/volumes/4b58401e-e7155628-d8f3-001f29c49dc6/bmlabmanager3/117916/117916-117916-BusAppsDB1.vmx"

vmware-cmd.pl -s register

"/vmfs/volumes/4b58401e-e7155628-d8f3-001f29c49dc6/bmlabmanager3/117916/117916-117916-BusAppsDB1.vmx" -H deblesx32

vmware-cmd.pl --server derblesx32 -s register

"/vmfs/volumes/3PAR01_PROD_001/bmlabmanager3/117916/117916-117916-BusAppsDB1.vmx"

vmware-cmd.pl

-s register

"/vmfs/volumes/3PAR01_PROD_001/bmlabmanager3/117916/117916-117916-BusAppsDB1.vmx"

-H derblesx32

Any help please

0 Kudos
3 Replies
CSIEnvironments
Enthusiast
Enthusiast

OK

I have discovered something, if the VM resids in the root of the datastore it will register as soon as the VM resides

in any sub folder then the register fails .

Can anyone else please confirm this finding.

thanks

0 Kudos
lamw
Community Manager
Community Manager

This is actually an issue with how vmware-cmd was written to parse the path when it's specified in the following format: "/vmfs/volumes/....". The script assumes that the VM folder is at the root of the datastore and no sub-directories are used to further separate it, there is a reason when you create a VM it's stored in the root of the datastore unless manipulated manually.

What is happening is the actual path to the .vmx file is being left out. Since the script is just a Perl script, I added a print statement to show you what it was getting for the $vmxpath variable.

Here is an example of a good register:

$ vmware-cmd --server olga --config .primp-olga -s register "/vmfs/volumes/4c575995-6d0ee178-89c1-001f29c948f8/test/test.vmx"

register() =1

DEBUG: \[vmStorage.dev-50\] test/test.vmx

As you can see, it takes that VMFS path and actually translates it to it's internal format which is in the form of:

\[datastore name\] vmfolder/vm.vmx

Here is an example of a bad register where a sub-directory is used:

$ vmware-cmd --server olga --config .primp-olga -s register "/vmfs/volumes/4c575995-6d0ee178-89c1-001f29c948f8/development/test/test.vmx"

DEBUG: \[vmStorage.dev-50\] development/test

Fault:

SOAP Fault:

-


Fault string: A specified parameter was not correct.

Fault detail: InvalidArgument

A specified parameter was not correct.

As you can see, the development folder is parsed but now the test.vmx is left out and hence it's consider a invalid input and the SOAP fault is thrown.

Without having to edit the script to fix this problem, assuming you figure out the correct regex, you can actually use the expected format to register your VM. I don't recall if this is documented in vCLI references but I know it's not common knowledge unless you work with the APIs Smiley Wink

You can also register the VM by using the follow form:

$ vmware-cmd --server olga --config .primp-olga -s register "\[vmStorage.dev-50\] development/test/test.vmx" \[vmStorage.dev-50\] development/test/test.vmx

register() =1

As you can see here, if you specify the alternative and the true syntax format, you can get your VM registered even if there are folders between the root datastore and your VM configuration file.

Give this a try and it should work without any modifications

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

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

awesome we tried it and it works a treat, you have just saved we hours of work thanks

0 Kudos