Solution Verified in:
- OpenNebula: 6.8-6.10
Issue
It's recommended to keep VM images which users' VM instantiated from up to date. There are two possible ways to do that in case of non-persistent images: either keep the same VM template (Solution 1) or create a new one (Solution 2). There is a third approach which is in some sense a mix of first two scenarios.
Solution 1: Updating VM template image keeping the same VM template
That solution is valid only if there are no VMs using the image, i.e. the image status is "READY".
Step 1: Check image ID which VM template based on and what needs to be updated.
For that purpose one needs to open FireEdge Sunstone menu and go to "Templates" -> "VM templates" as shown on the picture below (Alpine Linux 3.17 template downloaded from the OpenNebula Marketplace is used in that article as an example):
Click on required template within the list:
Press "Template" tab:
and scroll down to the DISK attribute and noticed IMAGE_ID value (it's "0" in our example).
Step 2. Make image persistent
Go to "Storage" -> "Images"
and click on the image with corresponding ID (it's "0" in our example):
Scroll down the page and check the image persistence in the "Info" tab:
To make image persistent one needs to click on the blue button with 3 vertical dots and select "Persistent" item in the drop-down menu:
Press "Accept" button on popped up message asking for your confirmation if you want proceed.
Step 3. Instantiate new VM
Now one needs to instantiate new VM from the corresponding VM template as shown on the picture below:
Set values for instantiating VM according to your needs and press "Next" button:
As soon as you are done with VM settings press "Finish" button:
After that you will be redirected to VMs menu automatically.
Step 4. Make required changes on VM disk and save them
As soon as VM booted one needs to log into it and perform required step on VM OS image (e.g. update installed packages).
To save changes made on persistent VM disk it's enough to shutdown the VM gracefully:
Press "Accept" button on popped up message asking for your confirmation if you want proceed.
Wait till the VM reaches the status "DONE" and the image the status "READY".
Step 5. Make the image non-persistent
Go to "Storage" -> "Images" menu as during Step 2, select corresponding image just updated and click on "Non persistent" item in the drop-down menu:
Press "Accept" button on popped up message asking for your confirmation if you want proceed.
Now the VM template is based on updated image and can be used by users.
Solution 2: Updating VM template image by creating the new VM template and image
That solution applies for scenario when one needs to update the VM template image which is already in use, i.e. the image has status "USED".
Step 1: Create new VM template and corresponding image from the VM template whose image needs to be updated
For that purpose one needs to open FireEdge Sunstone menu and go to "Templates" -> "VM templates" as shown on the picture below (Alpine Linux 3.17 template downloaded from the OpenNebula Marketplace is used in that article as an example):
Click on required template within the list:
Instantiate new VM from the corresponding VM template as shown on the picture below:
Set values for instantiating VM according to your needs, switch on "Instantiate as persistent" option and press "Next" button:
As soon as you are done with VM settings press "Finish" button:
After that you will be redirected to VMs menu automatically.
Step 2. Make required changes on VM disk and save them
As soon as VM booted one needs to log into it and perform required step on VM OS image (e.g. update installed packages).
To save changes made on persistent VM disk it's enough to shutdown the VM gracefully:
Press "Accept" button on popped up message asking for your confirmation if you want proceed.
Wait till the VM reaches the status "DONE" and the image the status "READY".
Step 3. Make the image non-persistent
Go to "Storage" -> "Images" menu as during Step 2, select corresponding image just updated and click on "Non persistent" item in the drop-down menu:
Press "Accept" button on popped up message asking for your confirmation if you want proceed.
One can go to "Templates" -> "VM Templates" menu and check if the new VM template was created.
Now users should use new VM template with updated OS image.
Solution 3: Mix of Solution 1 and 2
While the Solution 1 covers the case when the image is not used by any of VMs (i.e. the image status is READY) and the VM template stays the same whereas the Solution 2 is for the case when the image status is USED and the VM template is a new one the Solution 3 can be applied when there is a need to keep the same VM template but the underlying image is already in use by the VMs.
Then the initial part of the whole procedure for the Solution 3 is the same as for the Solution 2, i.e. instantiate the VM from the VM template as persistent, make required changes in the image, gracefully shutdown the VM, make the image as non-persistent. But in addition to that one needs to update the initial VM template with the new image and remove the new VM template created during the VM instantiation as a persistent.
Comments
Please sign in to leave a comment.