one
one copied to clipboard
Add an option for migrating images between datastores
Description It will be useful for some scenarios to be able to migrate an image between different datastores with or without the same DS_MAD.
Currently oneimage
command can clone an image to a different image datastore but that image will have a different ID. The migrate command would keep the image ID moved to a different image datastore. In that case there is the following situation that can lead to problems:
- A new image datastore is being added and the old one has to be deleted
- The images are cloned in the new datastore, the old one is deleted In this moment
- VMs that rely on any image on the old datastore images can't be recreated easily (the image that was used to created them does not exist, they don't know about the clone on the new datastore)
- The database reflects that the images on the old datastore are still being in use by those VMs
The command may also have to update:
-
/VM/TEMPLATE/DISK/{DATASTORE,DATASTORE_ID,IMAGE,IMAGE_ID,SOURCE}
on the VMs running that depend on the migrated image -
/VMTEMPLATE/TEMPLATE/DISK/{DATASTORE,DATASTORE_ID,SOURCE}
on the templates that depend on the migrated image
Use case The use case for the command would be
oneimage migrate IMAGE_ID --datastore DATASTORE_ID
It should:
- Check if
IMAGE_ID
andDATASTORE_ID
exist and ifDATASTORE_ID
is an image datastore - Move
IMAGE_ID
toDATASTORE_ID
keeping itsIMAGE_ID
and name (IMAGE
field) - Update the fields
/IMAGE/{SOURCE,PATH,DATASTORE,DATASTORE_ID}
of the image - For all the templates that use
IMAGE_ID
: update the fields/VMTEMPLATE/TEMPLATE/DISK/{DATASTORE,DATASTORE_ID,SOURCE}
- For all the VMs that depend on
IMAGE_ID
: update the fields/VM/TEMPLATE/DISK/{DATASTORE,DATASTORE_ID,SOURCE}
After that, the /IMAGE/VMS
field of the image should be consistent, and the templates and the vms too
Interface Changes This option should be available in all the interfaces.
Additional Context It may be possible that the image source and datastore must be updated somewhere else
Progress Status
- [ ] Branch created
- [ ] Code committed to development branch
- [ ] Testing - QA
- [ ] Documentation
- [ ] Release notes - resolved issues, compatibility, known issues
- [ ] Code committed to upstream release/hotfix branches
- [ ] Documentation committed to upstream release/hotfix branches
It would be really usefull. i.e. when upgrading SDS like CEPH / Gluster / DRBD. So plan would be to migrate VMs to another SDS/DS and than upgrade software, after successful upgrade I would be able to bring VMs back for test or production again. So no more worrying about this procedure.
Also consider migration across different Ceph Datastores (different pools)
Hello, any information when this feature will be implemented?
Consider this together with #5463