ibmcb / cbtool

Cloud Rapid Experimentation and Analysis Toolkit
Apache License 2.0
77 stars 49 forks source link

PLM should delete cloud-init config disk image when detaching a vm #441

Open rayx opened 1 month ago

rayx commented 1 month ago

When user detaches a vm, PLM calls lib/clouds/plm_cloud_ops.py:vmdestroy(), which does the following:

vmdestroy()
   -> _instance.destroy()
   -> _instance.undefine()
   -> self.vvdestroy(obj_attr_list)

vvdestroy() gets the volumes from obj_attr_list["volume_list"]. In the current implementation, it doesn't include cloud-init config disk image and hence leave the image file undeleted.


Another bug related to config disk image is that it's placed under /var/lib/libvirt, instead of /var/lib/libvirt/images. See log below:

cd /tmp/cb-centos-MYPLM-vm2-check; genisoimage -output cb-centos-MYPLM-vm2-check.iso -input-charset utf-8 -volid cidata -joliet -rock user-data meta-data; scp /tmp/cb-centos-MYPLM-vm2-check/cb-centos-MYPLM-vm2-check.iso root@100.88.37.170:/var/lib/libvirt/imagescb-centos-MYPLM-vm2-check.iso

A slash is missing between /var/lib/libvirt/images and cb-centos-MYPLM-vm2-check.iso in above command.