Modify existing VM's

(Martin) #1

is there a way how to modify template or existing VM’s ? I created and configured around 30 VM’s based on template, but forgot to add SWAP as second disk, so now every VM that is fully configured is without SWAP partition. Is there a way how to mass add this SWAP partitions?

I tried to redeploy VM with changed template (from which it was created), but only new machines getting SWAPs, redeployed VMs (even when there is new deployment file generated) stays without it.

Any suggestions ?


(Nicpon) #2

Hi there, Have you figured out how to do this ? I have a similar issue.


(Martin) #3

Hi @nicpon,

i did not figured out how to do it, but I would greatly appreciate if someone will tell us how to do it.


(Anton Todorov) #4


You could try attaching an image to the VMs.
First create non-persistent image :

oneimage create -d $IMAGE_DS_ID --name swap --type DATABLOCK --size $SIZE_IN_MB
ID: 37

The newly created image is with IMAGE_ID=37, then attach it to VM with ID $VM_ID

onevm disk-attach $VM_ID --image $IMAGE_ID

This is basic guidelines. You can tweak it further, for example after creating the image attach and format it as swap, etc.

Hope this helps.

Kind Regards,
Anton Todorov

(Martin) #5

Thanks for reply Anton,

so there is “no way” how to automate this kind of modification i.e. with templates or so ?


(Lomi Blomi) #6

If you write in python you have the oca package.
I’m sure there is a support for java too.

(Anton Todorov) #7

Hi Martin,

My understanding on the topic is that there was a mistake in the template which is fixed and the question is how to “sync” the already deployed vms to look like they are deployed with the fixed template. And, for me, in this case you need to add the missing disk, so i hinted how to do it with the cmdline tools.

There are several ways to automate the process using the API interface

Kind Regards,
Anton Todorov

(Anton Kurennoy) #8

Hi guys,

I still don’t understand how can we modify the template of already created VMs? For example:
I have the template with option in Disk section:


after initialization new VM from this template, a can’t modify it’s value ( my actions: press ‘update configuration’ --> change value in advanced mode --> press ‘Update’ --> chnages weren’t changed )

My user inside of “oneadmin” group and have full permissions for cloud.
I removed “TOTAL_IOPS_SEC” from restricted attribute in oned.conf
Using Opennebula 5.2.

Best regards,
Anton Kurennoy