Add manage_existing and unmanage to BaseVD

manage_existing() and unmanage() only exist in the deprecated
VolumeDriver() class and not BaseVD.  This means that drivers
inheriting from *VD hit attribute errors when trying to call
either of these methods.

Related-Bug: #1478987
Related-Bug: #1493286
Related-Bug: #1471807
Closes-Bug: #1487329

Change-Id: Ie8aba971b51e1f5eaac5a4e681ea06b358ebb7b8
This commit is contained in:
Eric Harney 2015-09-08 14:10:55 -04:00
parent 223fbd36b7
commit 7edc87ff0e
2 changed files with 37 additions and 0 deletions

View File

@ -1805,3 +1805,24 @@ class GlusterFsDriverTestCase(test.TestCase):
mock.sentinel.host)
self.assertEqual((False, None), ret)
def test_manage_existing_is_there(self):
"""Ensure that driver.manage_existing() is there."""
drv = self._driver
volume = self._simple_volume(id=mock.sentinel.manage_id)
self.assertRaises(NotImplementedError,
drv.manage_existing,
volume, mock.sentinel.existing_ref)
def test_unmanage_is_there(self):
"""Ensure that driver.unmanage() is there."""
drv = self._driver
volume = self._simple_volume(id=mock.sentinel.unmanage_id)
self.assertRaises(NotImplementedError,
drv.unmanage,
volume)

View File

@ -1404,6 +1404,22 @@ class BaseVD(object):
"""
return (False, None)
def manage_existing(self, volume, existing_ref):
"""Manage exiting stub.
This is for drivers that don't implement manage_existing().
"""
msg = _("Manage existing volume not implemented.")
raise NotImplementedError(msg)
def unmanage(self, volume):
"""Unmanage stub.
This is for drivers that don't implement unmanage().
"""
msg = _("Unmanage volume not implemented.")
raise NotImplementedError(msg)
@six.add_metaclass(abc.ABCMeta)
class LocalVD(object):