Can't remove VM template image completely with Ceph + KRBD

hybrid512

Active Member
Jun 6, 2013
76
4
28
Hi,

Found a bug with PVE 4.4-13.
When I convert a VM to a template that is stored on Ceph, a snapshot is created for my VM disks.

When I want to destroy this template, I have a message in the console saying the image still has watchers so it can't be removed.
Anyway, the VM IS removed in PVE GUI but looking at Ceph, the base image is still there (though, the snapshot has been properly removed).

I must unmap the image first then remove it to get definitely rid of it.

So, in order to remove a VM template in such situation (Ceph + KRBD), don't forget to unmap the volume first then remove the image.

By the way, templates are nice but sometimes, especially when you set it up the first time, this is not unusual to have to modifiy the template but once a VM is converted to a "template VM", it can't be started and modified again.
You must full clone it first, modify it, then migrate it (or backup/restore) then convert it to template again which is a pain in the ass and very time consuming.

Adding an option to "untemplate" a template (aka. convert it to normal VM) would be great.

Cheers.
 
Hi,
Adding an option to "untemplate" a template (aka. convert it to normal VM) would be great.

This would destroy all child's of this template.

When I want to destroy this template, I have a message in the console saying the image still has watchers so it can't be removed.
You have a child and this is the reason why you can't destroy the image.
But it is a bug that the config will destroyed.
 
Hi,

Found a bug with PVE 4.4-13.
When I convert a VM to a template that is stored on Ceph, a snapshot is created for my VM disks.

When I want to destroy this template, I have a message in the console saying the image still has watchers so it can't be removed.
Anyway, the VM IS removed in PVE GUI but looking at Ceph, the base image is still there (though, the snapshot has been properly removed).

I must unmap the image first then remove it to get definitely rid of it.

https://bugzilla.proxmox.com/show_bug.cgi?id=1063

By the way, templates are nice but sometimes, especially when you set it up the first time, this is not unusual to have to modifiy the template but once a VM is converted to a "template VM", it can't be started and modified again.
You must full clone it first, modify it, then migrate it (or backup/restore) then convert it to template again which is a pain in the ass and very time consuming.

Adding an option to "untemplate" a template (aka. convert it to normal VM) would be great.

This is not as easy as you think - in PVE, a "template" means no further modification.
 
Hi,
This would destroy all child's of this template.

Well, I don't see this as a problem if there is sufficient warning before that.
An even smarter idea would be to propose to promote those childs to independant VMs by moving the child storage to a full clone of the disk image.

You have a child and this is the reason why you can't destroy the image.
But it is a bug that the config will destroyed.

Well, I would agree if it were the case but I had no child of this template and got no warning also, the process acted as normal and if I didn't pay attention to the log, I wouldn't even saw it.

It also reminds me another bug, it's the fact that, when a template as child VMs, you CAN destroy the template with no warning.
You only get some informations in the logs (if you pay attention to it) but at the end, the template is removed (but not completely just as I explained before) AND your child VMs are trashed.

To me this is quite a critical bug to fix.
 
https://bugzilla.proxmox.com/show_bug.cgi?id=1063

This is not as easy as you think - in PVE, a "template" means no further modification.

I can perfectly understand it is not easy but as I proposed just before, if the template has no child, I don't see lmuch difficulties in doing it (and in fact, you can do that just by removing the "template" option in the conf file but you end up with a VM with snapshots on the disks you have to merge or clone by hand ... not great but not that difficult) this can be automated I guess.

In the case of child VMs, just warn about them and give the option to either promote them to independant VMs or destroy them.

Another great option would be to have some indicator that a VM is a child of a template ... we have icons for VMs, CTs, Templates ... a new icon for child VM would be great because when you have dozens or hundreds of VMs, it is not easy to know that one VM depends on another.
 
An even smarter idea would be to propose to promote those childs to independant VMs by moving the child storage to a full clone of the disk image.
What you suggest is exactly the same as you make a linked clone and make your changes and convert to template.
Except the point it is not magically done.
 
I never said it was not possible today, just that it could be largely automated and so, less prompt to errors and a far better user experience at the end.

Anyway, this is not my main point ... the real problem is the fact that :

  • deleting a VM template on Ceph+KRBD works but leaves you with mapped and undeleted images on your Ceph cluster
  • you can delete a VM template with no warning on the fact that it has children VMs and that it purely make those VMs unusable once the template is deleted.

All my other proposals are merely ideas I throw there for discussion.
 
I never said it was not possible today, just that it could be largely automated and so, less prompt to errors and a far better user experience at the end.

Anyway, this is not my main point ... the real problem is the fact that :

  • deleting a VM template on Ceph+KRBD works but leaves you with mapped and undeleted images on your Ceph cluster
  • you can delete a VM template with no warning on the fact that it has children VMs and that it purely make those VMs unusable once the template is deleted.

All my other proposals are merely ideas I throw there for discussion.

both of the above are a consequence of the same bug - there seems to be a check missing for the Qemu+KRBD variant. deleting templates should not be possible if there are children.

edit: further look into the code shows I am wrong - the config is always deleted, but it warns about leftover disks if the storage volume deletion fails. storages which don't cope with deleting base images of linked clones will fail and keep base volumes, so the linked clones should not be damaged.

AFAIK only LVM-thin allows simply deleting base images without doing any extra manual steps. Ceph does not allow it in any case, because you can only clone from a protected snapshot.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!