← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1294597] [NEW] libvirt vif plug_ovs_hybrid should roll back ip link set when fail

 

Public bug reported:

This problem is about [ plug_ovs_hybrid ] in libvirt/vif.py.
In this function, there is not try..catch to roll back "ip link set".

if not linux_net.device_exists(v2_name):
    linux_net._create_veth_pair(v1_name, v2_name)
    utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)
           <--- this action should roll back when create fail
    utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True)
    linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
                                  v2_name, iface_id, vif['address'],
                                  instance['uuid'])

In below case, it will result that instance will lost it's virtual interface(resume_guests_state_on_host_boot = True) :
1. Create a instance (name vm1) with network, wait until active.
2. Reset the Host OS, and wait until it is ready.
3. Before creating openvswitch bridge, start nova-compute service at the first time.
   The init_host function in nova compute manager will call plug_ovs_hybrid, and finally raise a exception at create_ovs_vif_port.
   As a result, the nova-compute service will stop, and do not roll back the "ip link set" of the instance(vm1).
4. Start openvswitch service, and create bridge for openstack.
5. Restart nova-compute service, and then recreat instances, include vm1.
   When creating vm1, because of do not roll back "ip link set", if will return false, and vm1 will lost it's virtual interface.

I think we should roll back ip link set, or set instance status to
ERROR.

** Affects: nova
     Importance: Undecided
         Status: New

** Description changed:

  This problem is about [ plug_ovs_hybrid ] in libvirt/vif.py.
  In this function, there is not try..catch to roll back "ip link set".
  
-         if not linux_net.device_exists(v2_name):
-             linux_net._create_veth_pair(v1_name, v2_name)
-             utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)  <--- should roll back here
-             utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True)
-             linux_net.create_ovs_vif_port(self.get_bridge_name(vif),            <--- exception here
-                                           v2_name, iface_id, vif['address'],
-                                           instance['uuid'])
+ if not linux_net.device_exists(v2_name):
+     linux_net._create_veth_pair(v1_name, v2_name)
+     utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)  
+            <--- this action should roll back when create fail
+     utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True)
+     linux_net.create_ovs_vif_port(self.get_bridge_name(vif),           
+                                   v2_name, iface_id, vif['address'],
+                                   instance['uuid'])
+ 
  
  In below case, it will result that instance will lost it's virtual interface(resume_guests_state_on_host_boot = True) :
  1. Create a instance (name vm1) with network, wait until active.
  2. Reset the Host OS, and wait until it is ready.
  3. Before creating openvswitch bridge, start nova-compute service at the first time.
     The init_host function in nova compute manager will call plug_ovs_hybrid, and raise a exception at create_ovs_vif_port.
-      init_host -> _init_instance (vm1)  -> plug_ovs_hybrid -> create_ovs_vif_port
+      init_host -> _init_instance (vm1) -> plug_ovs_hybrid -> create_ovs_vif_port
     The nova-compute service will stop, and do not roll back the "ip link set" of vm1.
  4. Start openvswitch service, and create bridge for openstack.
  5. Restart nova-compute service, and then recreat instances, include vm1.
     When creating vm1, because of do not roll back "ip link set", if will return false, and vm1 will lost it's virtual interface.
  
  I think we should roll back ip link set, or set instance status to
  ERROR.

** Description changed:

  This problem is about [ plug_ovs_hybrid ] in libvirt/vif.py.
  In this function, there is not try..catch to roll back "ip link set".
  
  if not linux_net.device_exists(v2_name):
      linux_net._create_veth_pair(v1_name, v2_name)
-     utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)  
+     utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)
             <--- this action should roll back when create fail
      utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True)
-     linux_net.create_ovs_vif_port(self.get_bridge_name(vif),           
+     linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
                                    v2_name, iface_id, vif['address'],
                                    instance['uuid'])
- 
  
  In below case, it will result that instance will lost it's virtual interface(resume_guests_state_on_host_boot = True) :
  1. Create a instance (name vm1) with network, wait until active.
  2. Reset the Host OS, and wait until it is ready.
  3. Before creating openvswitch bridge, start nova-compute service at the first time.
-    The init_host function in nova compute manager will call plug_ovs_hybrid, and raise a exception at create_ovs_vif_port.
-      init_host -> _init_instance (vm1) -> plug_ovs_hybrid -> create_ovs_vif_port
-    The nova-compute service will stop, and do not roll back the "ip link set" of vm1.
+    The init_host function in nova compute manager will call plug_ovs_hybrid, and finally raise a exception at create_ovs_vif_port.
+    As a result, the nova-compute service will stop, and do not roll back the "ip link set" of the instance(vm1).
  4. Start openvswitch service, and create bridge for openstack.
  5. Restart nova-compute service, and then recreat instances, include vm1.
     When creating vm1, because of do not roll back "ip link set", if will return false, and vm1 will lost it's virtual interface.
  
  I think we should roll back ip link set, or set instance status to
  ERROR.

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1294597

Title:
  libvirt vif plug_ovs_hybrid should roll back ip link set when fail

Status in OpenStack Compute (Nova):
  New

Bug description:
  This problem is about [ plug_ovs_hybrid ] in libvirt/vif.py.
  In this function, there is not try..catch to roll back "ip link set".

  if not linux_net.device_exists(v2_name):
      linux_net._create_veth_pair(v1_name, v2_name)
      utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True)
             <--- this action should roll back when create fail
      utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True)
      linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
                                    v2_name, iface_id, vif['address'],
                                    instance['uuid'])

  In below case, it will result that instance will lost it's virtual interface(resume_guests_state_on_host_boot = True) :
  1. Create a instance (name vm1) with network, wait until active.
  2. Reset the Host OS, and wait until it is ready.
  3. Before creating openvswitch bridge, start nova-compute service at the first time.
     The init_host function in nova compute manager will call plug_ovs_hybrid, and finally raise a exception at create_ovs_vif_port.
     As a result, the nova-compute service will stop, and do not roll back the "ip link set" of the instance(vm1).
  4. Start openvswitch service, and create bridge for openstack.
  5. Restart nova-compute service, and then recreat instances, include vm1.
     When creating vm1, because of do not roll back "ip link set", if will return false, and vm1 will lost it's virtual interface.

  I think we should roll back ip link set, or set instance status to
  ERROR.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1294597/+subscriptions


Follow ups

References