Merge "Fix tap device disappear after node restart" into stable/ocata
This commit is contained in:
commit
91ea4b6332
@ -155,6 +155,9 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
|
||||
else:
|
||||
LOG.warning(_LW("Device %s already exists."), device_name)
|
||||
if ns_dev.link.address != mac_address:
|
||||
LOG.warning(_LW("Reset mac address to %s"), mac_address)
|
||||
ns_dev.link.set_address(mac_address)
|
||||
ns_dev.link.set_up()
|
||||
|
||||
@device_name_synchronized
|
||||
|
@ -290,6 +290,10 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
else:
|
||||
self.driver.initialized = True
|
||||
|
||||
if (self.driver.driver_handles_share_servers and
|
||||
hasattr(self.driver, 'service_instance_manager')):
|
||||
(self.driver.service_instance_manager.network_helper.
|
||||
setup_connectivity_with_service_instances())
|
||||
share_instances = self.db.share_instances_get_all_by_host(ctxt,
|
||||
self.host)
|
||||
LOG.debug("Re-exporting %s shares", len(share_instances))
|
||||
|
@ -17,6 +17,7 @@ from oslo_log import log
|
||||
import six
|
||||
|
||||
from manila.share import driver
|
||||
from manila.tests import fake_service_instance
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@ -39,8 +40,13 @@ class FakeShareDriver(driver.ShareDriver):
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._setup_service_instance_manager()
|
||||
super(FakeShareDriver, self).__init__([True, False], *args, **kwargs)
|
||||
|
||||
def _setup_service_instance_manager(self):
|
||||
self.service_instance_manager = (
|
||||
fake_service_instance.FakeServiceInstanceManager())
|
||||
|
||||
def manage_existing(self, share, driver_options):
|
||||
LOG.debug("Fake share driver: manage")
|
||||
LOG.debug("Fake share driver: driver options: %s",
|
||||
|
@ -29,10 +29,19 @@ class FakeServiceInstanceManager(object):
|
||||
self.share_networks_servers = {}
|
||||
self.fake_server = fake_compute.FakeServer()
|
||||
self.service_instance_name_template = 'manila_fake_service_instance-%s'
|
||||
self._network_helper = None
|
||||
|
||||
def get_service_instance(self, context, share_network_id, create=True):
|
||||
return self.fake_server
|
||||
|
||||
@property
|
||||
def network_helper(self):
|
||||
return self._get_network_helper()
|
||||
|
||||
def _get_network_helper(self):
|
||||
self._network_helper = FakeNeutronNetworkHelper()
|
||||
return self._network_helper
|
||||
|
||||
def _create_service_instance(self, context, instance_name,
|
||||
share_network_id, old_server_ip):
|
||||
return self.fake_server
|
||||
@ -42,3 +51,9 @@ class FakeServiceInstanceManager(object):
|
||||
|
||||
def _get_service_instance_name(self, share_network_id):
|
||||
return self.service_instance_name_template % share_network_id
|
||||
|
||||
|
||||
class FakeNeutronNetworkHelper(object):
|
||||
|
||||
def setup_connectivity_with_service_instances(self):
|
||||
pass
|
||||
|
@ -160,6 +160,22 @@ class TestOVSInterfaceDriver(TestBase):
|
||||
|
||||
self.ip.assert_has_calls(expected)
|
||||
|
||||
def test_plug_reset_mac(self):
|
||||
fake_mac_addr = 'aa:bb:cc:dd:ee:ff'
|
||||
self.device_exists.return_value = True
|
||||
|
||||
self.ip().device().link.address = mock.Mock(return_value=fake_mac_addr)
|
||||
ovs = interface.OVSInterfaceDriver()
|
||||
ovs.plug('tap0',
|
||||
'port-1234',
|
||||
'ff:ee:dd:cc:bb:aa',
|
||||
bridge='br-int')
|
||||
expected = [mock.call(),
|
||||
mock.call().device('tap0'),
|
||||
mock.call().device().link.set_address('ff:ee:dd:cc:bb:aa'),
|
||||
mock.call().device().link.set_up()]
|
||||
self.ip.assert_has_calls(expected)
|
||||
|
||||
def test_unplug(self, bridge=None):
|
||||
if not bridge:
|
||||
bridge = 'br-int'
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- When use driver_handles_share_servers driver,
|
||||
reset the tap device after manila-share service
|
||||
start.
|
Loading…
Reference in New Issue
Block a user