New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting clone makes original VM inoperable. #1

Closed
oliverbock opened this Issue Oct 23, 2014 · 7 comments

Comments

Projects
None yet
4 participants
@oliverbock
Contributor

oliverbock commented Oct 23, 2014

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.

@oliverbock

This comment has been minimized.

Show comment
Hide comment
@oliverbock

oliverbock Oct 23, 2014

Contributor

I also note this script (https://communities.vmware.com/docs/DOC-9020) from 2008 which is a bit more complicated, and suffers from the same problem.

Contributor

oliverbock commented Oct 23, 2014

I also note this script (https://communities.vmware.com/docs/DOC-9020) from 2008 which is a bit more complicated, and suffers from the same problem.

@pddenhar

This comment has been minimized.

Show comment
Hide comment
@pddenhar

pddenhar Oct 24, 2014

Owner

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.

Owner

pddenhar commented Oct 24, 2014

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.

@oliverbock

This comment has been minimized.

Show comment
Hide comment
@oliverbock

oliverbock Oct 24, 2014

Contributor

Worked for me. Thanks.

Contributor

oliverbock commented Oct 24, 2014

Worked for me. Thanks.

@oliverbock

This comment has been minimized.

Show comment
Hide comment
@oliverbock

oliverbock Oct 28, 2014

Contributor

For anyone who discovers this report, I have enhanced clone.sh to register and start VMs, and added deleteclone.sh to get rid of them later.

Contributor

oliverbock commented Oct 28, 2014

For anyone who discovers this report, I have enhanced clone.sh to register and start VMs, and added deleteclone.sh to get rid of them later.

@hollal

This comment has been minimized.

Show comment
Hide comment
@hollal

hollal Nov 19, 2014

I'm yet to test, but thank you, this is exactly what I'm looking for.

hollal commented Nov 19, 2014

I'm yet to test, but thank you, this is exactly what I'm looking for.

@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Mar 26, 2017

Contributor

@pddenhar I reckon this can be closed now deleteclone.sh exists as of #2.

Contributor

MikeMcQuaid commented Mar 26, 2017

@pddenhar I reckon this can be closed now deleteclone.sh exists as of #2.

@pddenhar

This comment has been minimized.

Show comment
Hide comment
@pddenhar

pddenhar Mar 26, 2017

Owner

Yup, thanks for the reminder!

Owner

pddenhar commented Mar 26, 2017

Yup, thanks for the reminder!

@pddenhar pddenhar closed this Mar 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment