# ./vmprovision.pl --service_url
http://donjulio/sdk/vimService --userid root --password
root01 --vmname PerlVM --vmhost donjulio --datacenter
DefaultDatacenter --operation create
ERROR: Missing --datacenter or --disksize name
USAGE:
vmprovision.pl --service_url <SDK service URL>
--userid <user login> --password <password> --vmname
<vm name> --vmhost <vm host name> --operation [create |
clone] [--datacenter <datacenter name>
--vmname_destination <name of new vm clone>
--vmhost_destination <host of new vm clone> --datastore
<datastore name> --disksize <vm disk size in KB>
--guestid <guest operating system identifier> --memory
<vm memory in MB> --num_cpus <number of virtual
processors in vm> --nic_network <name of nic>
--nic_poweron <[0|1] to disable or enable network adapter>]
Examples:
vmprovision.pl --service_url
https://localhost/sdk/vimService --userid administrator
--password mypassword --vmname new-vm --vmhost myhost
--datacenter DefaultDatacenter --operation create
vmprovision.pl --service_url
https://localhost/sdk/vimService --userid administrator
--password mypassword --vmname new-vm --vmhost myhost
--datacenter DefaultDatacenter --operation create
--datastore ds1 --disksize 2097152 --guestid winNTGuest
--memory 256 --num_cpus 2 --nic_network "VM Network"
--nic_poweron 0
vmprovision.pl --service_url
https://localhost/sdk/vimService --userid administrator
--password mypassword --vmname vm1 --vmhost host1
--vmname_destination vm2 --vmhost_destination host1
--operation clone
----------------------------------------------------------------------
# ./vmprovision.pl --service_url
http://donjulio/sdk/vimService --userid root --password
root01 --vmname PerlVM --vmhost donjulio --datacenter
DefaultDatacenter --operation create --datastore local
--disksize 2097152 --guestid winNTGuest --memory 256
--num_cpus 1 --nic_network "VM Network" --nic_poweron 0
SOAP request error: at
/usr/lib/perl5/site_perl/5.8.8/VMware/VIStub.pm line 168.
----------------------------------------------------------------------
I've noticed the call to CreateVM passes a host view
not a managed object reference like the SDK publishes.
Will the toolkit accept and somehow transform a host
view into a MOR?
Logged In: YES
user_id=1167362
Very obscure defects once arg parsing stuff is gotten past.
I determined that SOAP error was from ESX 3.0.0. With
3.0.1 no SOAP error, but other error complaining about
Datastore format invalid. Turns out the sample code
specifies 'undef' for logDirectory, snapshotDirectory, and
suspendDirectory. There isn't so much a format problem as
those directories, if specified, cause the format fault to
go away and the code starts working. That error isn't so
much a problem with perl toolkit, as it is a defect in the
esx implementation and documentation.
Good news is I figured out how to modify the code to create
a VM.