Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Deleting clone makes original VM inoperable. #1
After running clone.sh on ESXi 5.1 I used vSphere to set up and started a new VM using the storage created by clone.sh. It ran fine. However when I deleted the cloned VM it also deleted the storage for the original! Is it possible to avoid this?
Also, presumably the script could be enhanced to run registervm at the end to make the new machine appear in vSphere, but I haven't tried that yet.
The deletion problem is unfortunately a side effect of how ESXi handles VM deletion, not something related to the script. Instead of deleting cloned VMs from vSphere, you should instead just use "Remove from Inventory" and then delete the clone folder in the datastore browser. Ungainly I know, but it comes with the territory of using ESXi in a way that wasn't directly intended.
You could solve this problem one way by adding a --delete option to the script that unregistered the VM and deleted the folder in one shot. I think if you were to add the registervm call it wouldn't be too much extra work to also add an unregister option. It looks like someone else has worked on doing that from the CLI here: http://blog.walker.uk.com/2013/11/esxi-5x-registering-vms-from-cli.html That might even be overkill because it looks like they're messing with pools and stuff.