Skip to content
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

Add an option for migrating images between datastores #3243

Open
7 tasks
OpenNebulaSupport opened this issue Apr 17, 2019 · 4 comments
Open
7 tasks

Add an option for migrating images between datastores #3243

OpenNebulaSupport opened this issue Apr 17, 2019 · 4 comments

Comments

@OpenNebulaSupport
Copy link
Collaborator

OpenNebulaSupport commented Apr 17, 2019

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:

  1. A new image datastore is being added and the old one has to be deleted
  2. The images are cloned in the new datastore, the old one is deleted
    In this moment
  3. 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)
  4. 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:

  1. Check if IMAGE_ID and DATASTORE_ID exist and if DATASTORE_ID is an image datastore
  2. Move IMAGE_ID to DATASTORE_ID keeping its IMAGE_ID and name (IMAGE field)
  3. Update the fields /IMAGE/{SOURCE,PATH,DATASTORE,DATASTORE_ID} of the image
  4. For all the templates that use IMAGE_ID: update the fields /VMTEMPLATE/TEMPLATE/DISK/{DATASTORE,DATASTORE_ID,SOURCE}
  5. 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
@Snowmanko
Copy link

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.

@rsmontero
Copy link
Member

Also consider migration across different Ceph Datastores (different pools)

@rsmontero rsmontero modified the milestones: Release 6.2, Release 6.4 Sep 6, 2021
@tinova tinova modified the milestones: Release 6.4, Release 6.4.1 May 10, 2022
@tinova tinova modified the milestones: Release 6.4.1, Release 6.4.2 Jul 13, 2022
@tinova tinova modified the milestones: Release 7.0, Release 6.8 Jul 11, 2023
@tinova tinova modified the milestones: Release 6.8, Release 6.8.1 Oct 18, 2023
@tinova tinova modified the milestones: Release 6.8.1, Release 6.8.2 Dec 19, 2023
@tinova tinova modified the milestones: Release 6.8.2, Release 6.8.3 Feb 21, 2024
@tinova tinova modified the milestones: Release 6.8.3, Release 6.8.4 Apr 22, 2024
rsmontero pushed a commit that referenced this issue Oct 4, 2024
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms
feldsam pushed a commit to FELDSAM-INC/one that referenced this issue Dec 20, 2024
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
feldsam added a commit to FELDSAM-INC/one that referenced this issue Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants