JDMurray wrote: » Is anyone able to clone VMs using ESX or ESXi only and without any assistance from VC? I'm calling the VI API to clone a VM on ESXi 3.5.0 U4, but the operation is throwing a NotSupportedFault error. There seems to be some disagreement in the VMWare community if it is or is not possible to clone a VM using only ESX(i) and the VI API. I'm wondering if anybody here knows of a manual or programmatic way to clone VMs without using VC to control ESX(i).
astorrs wrote: » Or am I way off base and you're still running in 60 day eval mode?
JDMurray wrote: » I am still running in 60-day eval mode with U3 and U4 on different machines. There are a lot of blog articles on how to clone VMs by manually copying and modifying the VM's files using VI Client, SSH, or the "unsupported" console. I need to find an automated way to do it through software only and build it myself.
JDMurray wrote: » ESXi runs the very minimal BusyBox Linux, which uses ash for a shell.
JDMurray wrote: » And BusyBox doesn't come with Perl, Python, Java or other shells preinstalled, so you're stuck with ash.
JDMurray wrote: » Yes, BusyBox is everything except the Linux kernel itself.
JDMurray wrote: » I wanted to loop through files in a directory and create the command cp oldfilename.oldextension newfilename.oldextension for each file to copy, but the args were always reversed no matter what I did. Something odd about variable assignment in a loop that's screwy.
JDMurray wrote: » Sysprep is only used for a VM with a Windows guest OS. .
JDMurray wrote: » The cloning operation itself is independent of any guest OS installed (or not) in the VM to be cloned. VC is wonderful for automatically handling things like sysprepping during cloning, but a stand-alone ESXi server won't do any of that for you.
Jordus wrote: » My point was, that you seem to have to go to pretty lengthy measures (creating scripts, etc) to simply clone a VM for ESX when for Virtual PC, Virtual Server 2005, and Hyper-V you just copy the VHD and prep the guest OS accordingly.
JDMurray wrote: » I'm basically trying to write my own automation app that's a functional subset of VMWare's Virtual Center and Lab Manger. Somebody gots to write all the kewl warez for you IT chumps to use.
tiersten wrote: » VirtualMurrayCenter?
JockVSJock wrote: » Yes, I knew there was going to be a thread on this as I have spent the last few days getting all of the updates/patches for the three xp clients and Win 2003 servers in my VMWare environment.
tiersten wrote: » Are you using ESX? Your other thread seemed to imply that you were using VMware Server...
JDMurray wrote: » I finally came up with a solution for this cloning problem on ESXi. Cloning requires making a copy of a parent VM's files into a separate folder in a datastore, changing the name of the VM in the .vmx file, removing a few lines from the .vmx file causing a new UUID and MAC address to be auto-generated when the clone is first started, and registering the cloned VM in the ESXi inventory. You also need to make sure that the parent VM is not running or paused during the cloning operation. For the copy and .vmx file modifications, I wrote a shell script that runs on the ESXi server itself and is run (by a remote client program I also wrote) via an SSH connection. Stopping the parent VM and registering the clone is performed using the VI API called from the same client program. ESXi runs the very minimal BusyBox Linux, which uses ash for a shell. The scripting language implemented in ash is rather lacking in features one would expect to find in other shells, like bash and ksh. Even performing simple string substitutions is not supported, leaving external programs (like sed) to be used as a workaround. And BusyBox doesn't come with Perl, Python, Java or other shells preinstalled, so you're stuck with ash. My ESXi VM cloinging solution isn't very elegant, but it works.