Browse Source

Introduce noop interface driver

In a Manila deployment using the Generic driver, it is possible
that the administrator has deployed manila-share on a machine that
already has access to the admin network used by Manila by being on
the same VLAN for example.

This means that it's not necessary for it to attempt to plug the ports
and do all the wiring due to the fact that it's already reachable,
therefore this patch introduces a new `interface_driver` which is
does nothing in order to avoid plugging/unplugging ports and avoiding
the requirement of running neutron-(openvswitch|linuxbridge)-agent
on the same node as manila-share.

The tests are pretty trivial because there's not much logic, but we
at least make sure that we don't call any ip_lib functions which means
we're not touching anything in host networking.

Change-Id: I2c3d6e4234bf7185b8da3c8e1701069c3a165ffc
(cherry picked from commit 6aec28f11f)
changes/52/706752/1
Mohammed Naser 3 weeks ago
parent
commit
3b9ba1d3a7
2 changed files with 29 additions and 0 deletions
  1. +14
    -0
      manila/network/linux/interface.py
  2. +15
    -0
      manila/tests/network/linux/test_interface.py

+ 14
- 0
manila/network/linux/interface.py View File

@@ -144,6 +144,20 @@ class LinuxInterfaceDriver(object):
"""Unplug the interface."""


class NoopInterfaceDriver(LinuxInterfaceDriver):
"""Noop driver when manila-share is already connected to admin network"""

def init_l3(self, device_name, ip_cidrs, namespace=None, clear_cidrs=[]):
pass

def plug(self, device_name, port_id, mac_address,
bridge=None, namespace=None, prefix=None):
pass

def unplug(self, device_name, bridge=None, namespace=None, prefix=None):
pass


class OVSInterfaceDriver(LinuxInterfaceDriver):
"""Driver for creating an internal interface on an OVS bridge."""



+ 15
- 0
manila/tests/network/linux/test_interface.py View File

@@ -141,6 +141,21 @@ class TestABCDriver(TestBase):
self.assertEqual(set(), result)


class TestNoopInterfaceDriver(TestBase):

def test_init_l3(self):
self.ip.assert_not_called()
self.ip_dev.assert_not_called()

def test_plug(self):
self.ip.assert_not_called()
self.ip_dev.assert_not_called()

def test_unplug(self):
self.ip.assert_not_called()
self.ip_dev.assert_not_called()


class TestOVSInterfaceDriver(TestBase):

def test_get_device_name(self):


Loading…
Cancel
Save