components/openstack/neutron/files/agent/solaris/interface.py
changeset 3524 ad6a9e0880b9
parent 2083 87196737f09f
child 3998 5bd484384122
equal deleted inserted replaced
3521:958ebf9deed1 3524:ad6a9e0880b9
    86              namespace=None, prefix=None, protection=False):
    86              namespace=None, prefix=None, protection=False):
    87         """Plug in the interface."""
    87         """Plug in the interface."""
    88 
    88 
    89         evs_vport = ('%s/%s') % (network_id, port_id)
    89         evs_vport = ('%s/%s') % (network_id, port_id)
    90         dl = net_lib.Datalink(datalink_name)
    90         dl = net_lib.Datalink(datalink_name)
       
    91 
       
    92         # This is to handle HA when the 1st DHCP/L3 agent is down and
       
    93         # the second DHCP/L3 agent tries to connect its VNIC to EVS, we will
       
    94         # end up in "vport in use" error. So, we need to reset the vport
       
    95         # before we connect the VNIC to EVS.
       
    96         cmd = ['/usr/sbin/evsadm', 'show-vport', '-f',
       
    97                'vport=%s' % port_id, '-co', 'evs,vport,status']
       
    98         stdout = utils.execute(cmd)
       
    99         evsname, vportname, status = stdout.strip().split(':')
       
   100         if status == 'used':
       
   101             cmd = ['/usr/sbin/evsadm', 'reset-vport', '-T', tenant_id,
       
   102                    '%s/%s' % (evsname, vportname)]
       
   103             utils.execute(cmd)
       
   104 
    91         dl.connect_vnic(evs_vport, tenant_id)
   105         dl.connect_vnic(evs_vport, tenant_id)
    92 
   106 
    93         if not protection:
   107         if not protection:
    94             cmd = ['/usr/sbin/evsadm', 'set-vportprop', '-T', tenant_id,
   108             cmd = ['/usr/sbin/evsadm', 'set-vportprop', '-T', tenant_id,
    95                    '-p', 'protection=none', evs_vport]
   109                    '-p', 'protection=none', evs_vport]