VMware Cloud Community
DrewEinhorn
Contributor
Contributor
Jump to solution

Command line for creating VMs

Is there one somewhere?

0 Kudos
1 Solution
2 Replies
DrewEinhorn
Contributor
Contributor
Jump to solution

Hmm, the book suggests the VMperl API.

But when I go to down load it, I see it's a deprecated, legacy API.

The currently supported stuff looks way more complicated than what I really need.

So let's try the legacy stuff. Hmm, the download pages are broken. Wonder they are

just broken, or if VMware is just deprecating them a bit more forcefully.

All I need to do execute a couple shell commands from a client on another box.

Here are perl scripts for running on the ESX box that do what I need.

\# setup global values, etc.

...

\# subroutine to create VMDK virtual disk file

sub createdisk {

$cr = "vmkfstools -c " . $vmdisk . "g " . " $vmpath". $vmname . ".vmdk -a lsilogic";

system("$cr");

};

\# Subroutine to register VM with ESX Server

sub registervm {

$rg = "vmware-cmd -s register $vmpath" . $vmname . ".vmx";

system("$rg");

};

That perl code is ugly. There's probably a cleaner way to handle the substitution

and quoting in perl. My copy of Learning Perl is hiding.

I'd probably have to read a couple hundred pages of documentation to figure out

to do this with the new tools. But maybe there's just a couple pages I really need

to read.

Whatever I end up with I'd like to a python wrapper around it so I never have

to look at it again.

0 Kudos