1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmdbusd: Vg.LvCreate* methods, correct return type

The methods were returning an instance of the object instead of the
object path which was causing an exception when the result was returned
with the job object as we are explicity trying to return an object path.

Unit test added which re-creates the issue and verifies the fix.
This commit is contained in:
Tony Asleson 2016-09-16 14:00:14 -05:00
parent 72abf692e5
commit ac2fc7a366
2 changed files with 12 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class Vg(AutomatedProperties):
@staticmethod @staticmethod
def fetch_new_lv(vg_name, lv_name): def fetch_new_lv(vg_name, lv_name):
cfg.load() cfg.load()
return cfg.om.get_object_by_lvm_id("%s/%s" % (vg_name, lv_name)) return cfg.om.get_object_path_by_lvm_id("%s/%s" % (vg_name, lv_name))
@staticmethod @staticmethod
def _rename(uuid, vg_name, new_name, rename_options): def _rename(uuid, vg_name, new_name, rename_options):

View File

@ -387,6 +387,17 @@ class TestDbusService(unittest.TestCase):
(rs(8, '_lv'), mib(4), (rs(8, '_lv'), mib(4),
dbus.Array([], '(ott)'), -1, {}), vg) dbus.Array([], '(ott)'), -1, {}), vg)
def test_lv_create_job(self):
vg = self._vg_create().Vg
(object_path, job_path) = vg.LvCreate(rs(8, '_lv'), mib(4),
dbus.Array([], '(ott)'), 0, {})
self.assertTrue(object_path == '/')
self.assertTrue(job_path != '/')
object_path = self._wait_for_job(job_path)
self.assertTrue(object_path != '/')
def test_lv_create_linear(self): def test_lv_create_linear(self):
vg = self._vg_create().Vg vg = self._vg_create().Vg