--- a/components/openstack/neutron/files/agent/solaris/interface.py Fri Jan 09 14:26:04 2015 -0800
+++ b/components/openstack/neutron/files/agent/solaris/interface.py Fri Jan 09 16:31:51 2015 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -88,6 +88,20 @@
evs_vport = ('%s/%s') % (network_id, port_id)
dl = net_lib.Datalink(datalink_name)
+
+ # This is to handle HA when the 1st DHCP/L3 agent is down and
+ # the second DHCP/L3 agent tries to connect its VNIC to EVS, we will
+ # end up in "vport in use" error. So, we need to reset the vport
+ # before we connect the VNIC to EVS.
+ cmd = ['/usr/sbin/evsadm', 'show-vport', '-f',
+ 'vport=%s' % port_id, '-co', 'evs,vport,status']
+ stdout = utils.execute(cmd)
+ evsname, vportname, status = stdout.strip().split(':')
+ if status == 'used':
+ cmd = ['/usr/sbin/evsadm', 'reset-vport', '-T', tenant_id,
+ '%s/%s' % (evsname, vportname)]
+ utils.execute(cmd)
+
dl.connect_vnic(evs_vport, tenant_id)
if not protection: