NIC id changes in VM

Please, describe the problem here and provide additional information below (if applicable) …
After the power cycle of VM instance, it changes nic order if I had nic 0 as private, nic 1 as public, nic 2 as storage and eth0 assigned to private IP, eth1 assigned to public IP, eth2 assigned to storage IP (statically inside the VM). Opennebula changes the assignment making eth2 assigned with public IP and eth1 assigned with storage IP. The only recourse for this is to shut down the instance and remove/recreate the nic cards, applying proper security policies

Versions of the related components and OS (frontend, hypervisors, VMs):
One, 5.8.1, Ubuntu

Steps to reproduce:
Power cycle VM. It doesn’t happen all the time but it happened to me twice during the same evening

Current results:
NICs internally out of order

Expected results:

NIC ids order match ethernet IDS order inside the VM
0 -> eth0
1 -> eth1
2 -> eth2

Hello @Alexander_Litvak

Could you please send me the VM template and the ip a when the problem occurs?

Do you want template vm based on in general or how one sees template when the problem occurs?

Send me the template onetemplate show <TEMPLATE_ID> -x and the the problematic vm onevm show <VM_ID> -x

  <NAME>CentOS 7 - WebApps</NAME>
      <KVM><![CDATA[<devices><serial type="pty"><source path="/dev/pts/5"/><target port="0"/></serial><console type="pty" tty="/dev/pts/5"><source path="/dev/pts/5"/><target port="0"/></console></devices>]]></KVM>
    <DESCRIPTION><![CDATA[Web Servers template]]></DESCRIPTION>

I couldn’t reproduce problem again but template is here.

Looking at the template I actually wonder if there is a way to insert a tag that would anchor each NIC to a specific order id? I tried inserting eth1 in the device name and VM couldn’t boot.

No, you can’t do that. The way that it is doing is the following:

  • You have a list of nics in the template.
  • The core will take that list and will generate the context variables.
  • Inside the VM there are some contextualisation scripts under /etc/one-context.d.
  • Those scripts are going to take the context variables stored in the context cd-rom and will contextualise the VM.

So you can check in that cd-rom which is the order, but you can’t change it, because is the core who generates it. Usually the order is the same as the template, I don’t why it changed in your case, maybe you did a detach/attach or some operations with nics.


Where this cd-rom is being stored? I don’t see it mounted on VM.

Hello @Alexander_Litvak

You can find the cd-rom with label CONTEXT so you can mount it and check it.