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

lvmdbusd: Rename get_object_path_by_lvm_id

Renaming to get_object_path_by_uuid_lvm_id, to clarify that both the uuid
and the lvm id are required.
This commit is contained in:
Tony Asleson 2016-06-10 12:03:04 -05:00
parent 41ebed7077
commit b717e8fe1d
5 changed files with 18 additions and 18 deletions

View File

@ -100,7 +100,7 @@ class LvState(State):
rc = [] rc = []
for pv in sorted(cfg.db.lv_contained_pv(uuid)): for pv in sorted(cfg.db.lv_contained_pv(uuid)):
(pv_uuid, pv_name, pv_segs) = pv (pv_uuid, pv_name, pv_segs) = pv
pv_obj = cfg.om.get_object_path_by_lvm_id( pv_obj = cfg.om.get_object_path_by_uuid_lvm_id(
pv_uuid, pv_name, gen_new=False) pv_uuid, pv_name, gen_new=False)
rc.append((pv_obj, pv_segs)) rc.append((pv_obj, pv_segs))
@ -123,7 +123,7 @@ class LvState(State):
for l in cfg.db.hidden_lvs(self.Uuid): for l in cfg.db.hidden_lvs(self.Uuid):
full_name = "%s/%s" % (vg_name, l[1]) full_name = "%s/%s" % (vg_name, l[1])
op = cfg.om.get_object_path_by_lvm_id( op = cfg.om.get_object_path_by_uuid_lvm_id(
l[0], full_name, gen_new=False) l[0], full_name, gen_new=False)
assert op assert op
rc.append(op) rc.append(op)
@ -143,7 +143,7 @@ class LvState(State):
else: else:
self._segs.extend(set(segtypes)) self._segs.extend(set(segtypes))
self.Vg = cfg.om.get_object_path_by_lvm_id( self.Vg = cfg.om.get_object_path_by_uuid_lvm_id(
vg_uuid, vg_name, vg_obj_path_generate) vg_uuid, vg_name, vg_obj_path_generate)
self.Devices = LvState._pv_devices(self.Uuid) self.Devices = LvState._pv_devices(self.Uuid)
@ -151,7 +151,7 @@ class LvState(State):
if PoolLv: if PoolLv:
gen = utils.lv_object_path_method(Name, (Attr, layout, role)) gen = utils.lv_object_path_method(Name, (Attr, layout, role))
self.PoolLv = cfg.om.get_object_path_by_lvm_id( self.PoolLv = cfg.om.get_object_path_by_uuid_lvm_id(
pool_lv_uuid, '%s/%s' % (vg_name, PoolLv), pool_lv_uuid, '%s/%s' % (vg_name, PoolLv),
gen) gen)
else: else:
@ -159,7 +159,7 @@ class LvState(State):
if OriginLv: if OriginLv:
self.OriginLv = \ self.OriginLv = \
cfg.om.get_object_path_by_lvm_id( cfg.om.get_object_path_by_uuid_lvm_id(
origin_uuid, '%s/%s' % (vg_name, OriginLv), origin_uuid, '%s/%s' % (vg_name, OriginLv),
vg_obj_path_generate) vg_obj_path_generate)
else: else:
@ -192,7 +192,7 @@ class LvState(State):
def create_dbus_object(self, path): def create_dbus_object(self, path):
if not path: if not path:
path = cfg.om.get_object_path_by_lvm_id( path = cfg.om.get_object_path_by_uuid_lvm_id(
self.Uuid, self.lvm_id, self._object_path_create()) self.Uuid, self.lvm_id, self._object_path_create())
obj_ctor = self._object_type_create() obj_ctor = self._object_type_create()

View File

@ -36,7 +36,7 @@ class Manager(AutomatedProperties):
# Check to see if we are already trying to create a PV for an existing # Check to see if we are already trying to create a PV for an existing
# PV # PV
pv = cfg.om.get_object_path_by_lvm_id( pv = cfg.om.get_object_path_by_uuid_lvm_id(
device, device, None, False) device, device, None, False)
if pv: if pv:
raise dbus.exceptions.DBusException( raise dbus.exceptions.DBusException(
@ -159,7 +159,7 @@ class Manager(AutomatedProperties):
:param key: The lookup value :param key: The lookup value
:return: Return the object path. If object not found you will get '/' :return: Return the object path. If object not found you will get '/'
""" """
p = cfg.om.get_object_path_by_lvm_id( p = cfg.om.get_object_path_by_uuid_lvm_id(
key, key, gen_new=False) key, key, gen_new=False)
if p: if p:
return p return p

View File

@ -173,7 +173,7 @@ class ObjectManager(AutomatedProperties):
def get_object_by_uuid_lvm_id(self, uuid, lvm_id): def get_object_by_uuid_lvm_id(self, uuid, lvm_id):
with self.rlock: with self.rlock:
return self.get_object_by_path( return self.get_object_by_path(
self.get_object_path_by_lvm_id(uuid, lvm_id, None, False)) self.get_object_path_by_uuid_lvm_id(uuid, lvm_id, None, False))
def get_object_by_lvm_id(self, lvm_id): def get_object_by_lvm_id(self, lvm_id):
""" """
@ -212,8 +212,8 @@ class ObjectManager(AutomatedProperties):
self._uuid_verify(path, uuid, lvm_identifier) self._uuid_verify(path, uuid, lvm_identifier)
return path return path
def get_object_path_by_lvm_id(self, uuid, lvm_id, path_create=None, def get_object_path_by_uuid_lvm_id(self, uuid, lvm_id, path_create=None,
gen_new=True): gen_new=True):
""" """
For a given lvm asset return the dbus object registered to it. If the For a given lvm asset return the dbus object registered to it. If the
object is not found and gen_new == True and path_create is a valid object is not found and gen_new == True and path_create is a valid

View File

@ -65,7 +65,7 @@ class PvState(State):
full_name = "%s/%s" % (vg_name, lv_name) full_name = "%s/%s" % (vg_name, lv_name)
path_create = lv_object_path_method(lv_name, meta) path_create = lv_object_path_method(lv_name, meta)
lv_path = cfg.om.get_object_path_by_lvm_id( lv_path = cfg.om.get_object_path_by_uuid_lvm_id(
lv_uuid, full_name, path_create) lv_uuid, full_name, path_create)
rc.append((lv_path, segs)) rc.append((lv_path, segs))
@ -83,7 +83,7 @@ class PvState(State):
self.lv = self._lv_object_list(vg_name) self.lv = self._lv_object_list(vg_name)
if vg_name: if vg_name:
self.vg_path = cfg.om.get_object_path_by_lvm_id( self.vg_path = cfg.om.get_object_path_by_uuid_lvm_id(
vg_uuid, vg_name, vg_obj_path_generate) vg_uuid, vg_name, vg_obj_path_generate)
else: else:
self.vg_path = '/' self.vg_path = '/'
@ -93,8 +93,8 @@ class PvState(State):
def create_dbus_object(self, path): def create_dbus_object(self, path):
if not path: if not path:
path = cfg.om.get_object_path_by_lvm_id(self.Uuid, self.Name, path = cfg.om.get_object_path_by_uuid_lvm_id(self.Uuid, self.Name,
pv_obj_path_generate) pv_obj_path_generate)
return Pv(path, self) return Pv(path, self)
# noinspection PyMethodMayBeStatic # noinspection PyMethodMayBeStatic

View File

@ -66,7 +66,7 @@ class VgState(State):
gen = utils.lv_object_path_method(lv_name, meta) gen = utils.lv_object_path_method(lv_name, meta)
lv_path = cfg.om.get_object_path_by_lvm_id( lv_path = cfg.om.get_object_path_by_uuid_lvm_id(
lv_uuid, full_name, gen) lv_uuid, full_name, gen)
rc.append(lv_path) rc.append(lv_path)
return dbus.Array(rc, signature='o') return dbus.Array(rc, signature='o')
@ -75,7 +75,7 @@ class VgState(State):
rc = [] rc = []
for p in cfg.db.pvs_in_vg(self.Uuid): for p in cfg.db.pvs_in_vg(self.Uuid):
(pv_name, pv_uuid) = p (pv_name, pv_uuid) = p
rc.append(cfg.om.get_object_path_by_lvm_id( rc.append(cfg.om.get_object_path_by_uuid_lvm_id(
pv_uuid, pv_name, pv_obj_path_generate)) pv_uuid, pv_name, pv_obj_path_generate))
return dbus.Array(rc, signature='o') return dbus.Array(rc, signature='o')
@ -90,7 +90,7 @@ class VgState(State):
def create_dbus_object(self, path): def create_dbus_object(self, path):
if not path: if not path:
path = cfg.om.get_object_path_by_lvm_id( path = cfg.om.get_object_path_by_uuid_lvm_id(
self.Uuid, self.Name, vg_obj_path_generate) self.Uuid, self.Name, vg_obj_path_generate)
return Vg(path, self) return Vg(path, self)