0

I've created a VM with a VNET attached on Opennebula, after a while I changed the params of the VNET but those changes do not persist on the VM after my (physical)host is restarted.

I’ve changed the /var/lib/one/vms/{$VM_ID}/context.sh file but still no luck persisting the changes.

Do you know what it could be?

I'm using OpenNebula with KVM on a Debian8 host.

David Revelo
  • 86
  • 1
  • 6

3 Answers3

1

After a while I figure out how to do this myself.

It seems that when the VM is started, the file /var/lib/one/datastores/0/$VM_ID/disk.1 is attached as /dev/sr0.

During boot process /usr/sbin/one-contextd mounts this unit an uses the variables inside it, they usually look like this:

DISK_ID='1'
ETH0_IP='192.168.168.217'
ETH0_MAC='02:00:c0:a8:a8:d9'
ETH0_DNS='192.168.168.217'
ETH0_GATEWAY='192.168.168.254'

This info are used to export ENV variables (the exported variables can be found on /tmp/one_env) which are used by the script /etc/one-context.d/00-network to set network configuration.

OpenNebula doesn't provide a simple way of replacing this configs after the VM is created, but you can do the following:

  • Edit /var/lib/one/datastores/0/$VM_ID/disk.1 and make the required changes
  • Restart opennebula service
  • Restart the VM

Hope this is useful to someone :)

David Revelo
  • 86
  • 1
  • 6
0

Yes, the issue is that this functionality is not supported in current versions of OpenNebula. This will be supported in the upcoming 5.0 version.

tinova
  • 1
0

You can power off the VM and change most of the parameters(not network parameters as they are linked to a vnet) in the conf tab of the VM.

VM Conf tab

For a network-specific change only, you can simply log-in to the VM and mv the file /etc/one-context.d/00-network to some other place and your changes to the network configuration of VM won't be overwritten by the network context script.

PKSingh
  • 511
  • 5
  • 4