I boot an instance with three NICs for testing some software. However, when I hard-reboot the instance, the sequence of network interfaces are changed.
Booting:
eth0 MAC address: 11:22:33...
eth1 MAC address: 22:11:33...
eth2 MAC address: 33:11:22...
After Hard Rebooting:
eth0 MAC address: 33:11:22...
eth1 MAC address: 22:11:33...
eth2 MAC address: 11:22:33...
This phenomenon will affect the interconnection of instances and leads to malfunctioning of NICs.
I debugged this problem and found out the network_info structure were changed after hard rebooting. The debug info is attached below.
Booting: network_info structure in nova/virt/libvirt/driver.py spawn function:
[({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'172.20.1.0/24', 'vlan': None, 'id': u'73527cdc-a704-417c-8087-f58a40fbecaa'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tapb43293e7-45', 'broadcast': '172.20.1.255', 'ips': [{'ip': u'172.20.1.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'172.20.1.1'}], 'mac': u'fa:16:3e:cf:99:1f', 'should_create_vlan': False, 'gateway': u'172.20.1.1', 'ovs_interfaceid': u'b43293e7-45bf-452e-8767-b5e1b75cf90c', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'b43293e7-45bf-452e-8767-b5e1b75cf90c', 'dns': [u'10.1.101.51'], 'dhcp_server': u'172.20.1.3', 'qbg_params': None}), ({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'192.168.10.0/24', 'vlan': None, 'id': u'05394e54-acb3-428d-a359-f038ff95f53c'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tap5164ba6c-5e', 'broadcast': '192.168.10.255', 'ips': [{'ip': u'192.168.10.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'192.168.10.1'}], 'mac': u'fa:16:3e:01:9a:9a', 'should_create_vlan': False, 'gateway': u'192.168.10.1', 'ovs_interfaceid': u'5164ba6c-5efc-4e5a-9f8c-85bf9bf576d2', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'5164ba6c-5efc-4e5a-9f8c-85bf9bf576d2', 'dns': [u'10.1.101.51'], 'dhcp_server': u'192.168.10.3', 'qbg_params': None}), ({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'192.168.100.0/24', 'vlan': None, 'id': u'502f703c-2838-4e6c-bb8a-73780bf6e171'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tapc85bd00c-8e', 'broadcast': '192.168.100.255', 'ips': [{'ip': u'192.168.100.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'192.168.100.1'}], 'mac': u'fa:16:3e:76:6e:ff', 'should_create_vlan': False, 'gateway': u'192.168.100.1', 'ovs_interfaceid': u'c85bd00c-8eac-44cf-83bc-3ddc00d9389a', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'c85bd00c-8eac-44cf-83bc-3ddc00d9389a', 'dns': [u'10.1.101.51'], 'dhcp_server': u'192.168.100.3', 'qbg_params': None})]
After Hard Rebooting: network_info structure in nova/virt/libvirt/driver.py _hard_reboot function:
[({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'192.168.10.0/24', 'vlan': None, 'id': u'05394e54-acb3-428d-a359-f038ff95f53c'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tap5164ba6c-5e', 'broadcast': '192.168.10.255', 'ips': [{'ip': u'192.168.10.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'192.168.10.1'}], 'mac': u'fa:16:3e:01:9a:9a', 'should_create_vlan': False, 'gateway': u'192.168.10.1', 'ovs_interfaceid': u'5164ba6c-5efc-4e5a-9f8c-85bf9bf576d2', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'5164ba6c-5efc-4e5a-9f8c-85bf9bf576d2', 'dns': [u'10.1.101.51'], 'dhcp_server': u'192.168.10.3', 'qbg_params': None}), ({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'192.168.100.0/24', 'vlan': None, 'id': u'502f703c-2838-4e6c-bb8a-73780bf6e171'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tapc85bd00c-8e', 'broadcast': '192.168.100.255', 'ips': [{'ip': u'192.168.100.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'192.168.100.1'}], 'mac': u'fa:16:3e:76:6e:ff', 'should_create_vlan': False, 'gateway': u'192.168.100.1', 'ovs_interfaceid': u'c85bd00c-8eac-44cf-83bc-3ddc00d9389a', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'c85bd00c-8eac-44cf-83bc-3ddc00d9389a', 'dns': [u'10.1.101.51'], 'dhcp_server': u'192.168.100.3', 'qbg_params': None}), ({'injected': False, 'bridge': 'br-int', 'multi_host': False, 'bridge_interface': None, 'cidr_v6': None, 'cidr': u'172.20.1.0/24', 'vlan': None, 'id': u'73527cdc-a704-417c-8087-f58a40fbecaa'}, {'vif_type': u'ovs', 'should_create_bridge': False, 'vif_devname': u'tapb43293e7-45', 'broadcast': '172.20.1.255', 'ips': [{'ip': u'172.20.1.13', 'netmask': '255.255.255.0', 'enabled': '1', 'gateway': u'172.20.1.1'}], 'mac': u'fa:16:3e:cf:99:1f', 'should_create_vlan': False, 'gateway': u'172.20.1.1', 'ovs_interfaceid': u'b43293e7-45bf-452e-8767-b5e1b75cf90c', 'rxtx_cap': 0, 'label': <email address hidden>', 'qbh_params': None, 'vif_uuid': u'b43293e7-45bf-452e-8767-b5e1b75cf90c', 'dns': [u'10.1.101.51'], 'dhcp_server': u'172.20.1.3', 'qbg_params': None})]
Are u using neutron, right?