Recently a customer managed to surprise our addon with an issue with several disks of type CDROM attached to single VM (obviously the second sentence of the CDROM description in the docs is obsolete at least for 4.14+ )
Ofter digging in the sources I’ve figured out that the the CDROM image type behave and should be threaten as always PERSISTENT image but with no VM/TEMPLATE/DISK/PERSISTENT=YES attribute set in the OpenNebula’s internal XML.
This leaded to situation that the VM is instantiated with the TM_MAD for the persistent images (tm/ln) but not handled properly in live-migrate and snapshot(?!?) scripts
Is it possible to sync it or rework the code to have both attributes set. In addition there is always PERSISTENT=n/a<->CLONE=YES and PERSISTENT=YES<->CLONE=NO mapping?
Or I am missing someting?
Edit: sorry, saved too early…
I’m not really sure I get the problem. CDROM disks will have CLONE=NO,
SAVE=NO, so it will invoke link operation rather than cp. Is not working
Probably I’ve miss understood the PERSISTENT flag for the images. Should I use CLONE and SAVE attributes instead of PERSISTENT to detect is a image persistent one or not?
if you set the PERSISTENT flag on a CDROM image you will have CLONE=NO, SAVE=YES and PERSISTENT=YES. in both cases
tm/ln is called for deployment.
What should be the proper check is the given VM disk PERSISTENT or NON-PERSISTENT for the migration scripts?
on deploy - > clone the image (tm/cp is called)
on migrate -> thread as cloned
on terminate -> destroy the image
on deploy -> attach the image(tm/ln is called)
on migrate -> thread as persistent (but allow TYPE=CDROM to be attached if still in use)
on destroy -> detach from the nodes (but allow TYPE=CDROM to be attached if still in use)
This way my understanding is that the PERSISTENT flag is used only for the GUI needs?
Please excuse me if I am missing something…
Yes you are right CLONE and SAVE attributes are the main flags used for the
TM logic. PERSISTENT is set into the DISK if the original Image is
persistent, this helps UI aspects…
CLONE controls what is done upon deployment, as you said CLONE=NO —>
tm/ln and CLONE=YES —> tm/cp
SAVE controls what happens upon VM termination (epilog) SAVE=YES -->
tm/mvds and SAVE=NO —> tm/delete . Note that delete is remove from system
DS, not the original image.
As a side note, there is a PERSISTENT_TYPE, if set to IMMUTABLE this means
READONLY=YES, CLONE=NO, SAVE=NO. This is basically to share RO data disks.
Feel free to ask more if is not clear
I’ll update the addon accordingly.
I’ve reworked the addon logic.
What I am observing:
- CDROM image with checked PERSISTENT - tm/mvds is called on terminate
- CDROM image without checked PERSISTENT - tm/delete is called on terminate.
What do you think about setting the CDROM type images to IMMUTABLE with no option to change?
So for now I’ve solved this with extra check for CLONE in tm/delete: if CLONE=YES then delete the image otherwise only detach with soft fail if it is still in use (attached to other VM as shared RO cdrom image)
I’ve found the PERSISTENT_TYPE in the sources but it is not well documented when/where to use it so our customer do not use it…
This is strange, look what is done with a disk is decided by this piece of
As you can see it only considers SAVE=YES.
On the other hand CDROMs are treated as inmutable: CLONE = NO, SAVE = NO.
Anyway, removing only images that has been copied make sense (i.e. checking
for CLONE=YES) upon VM termination, for example:
I can’t find any reference to PERSISTENT_TYPE besides src/image/Image.c. So it is possible to define an CDROM image without PERSISTENT_TYPE=IMMUTABLE set.
I think that with this patch it will follow the logic properly
Anyway, I’ve fixed it in the driver