mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
lvmdbusd: Add LvCommon.MovePv
Needed for feature parity for lvm2app.
This commit is contained in:
parent
a3f24aaf5c
commit
d54ffcfcd1
@ -487,7 +487,7 @@ def lvm_full_report_json():
|
||||
'lv_attr', 'lv_tags', 'vg_uuid', 'lv_active', 'data_lv',
|
||||
'metadata_lv', 'lv_parent', 'lv_role', 'lv_layout',
|
||||
'snap_percent', 'metadata_percent', 'copy_percent',
|
||||
'sync_percent', 'lv_metadata_size']
|
||||
'sync_percent', 'lv_metadata_size', 'move_pv', 'move_pv_uuid']
|
||||
|
||||
lv_seg_columns = ['seg_pe_ranges', 'segtype', 'lv_uuid']
|
||||
|
||||
@ -739,7 +739,7 @@ def lv_retrieve_with_segments():
|
||||
'metadata_lv', 'seg_pe_ranges', 'segtype', 'lv_parent',
|
||||
'lv_role', 'lv_layout',
|
||||
'snap_percent', 'metadata_percent', 'copy_percent',
|
||||
'sync_percent', 'lv_metadata_size']
|
||||
'sync_percent', 'lv_metadata_size', 'move_pv', 'move_pv_uuid']
|
||||
|
||||
cmd = _dc('lvs', ['-a', '-o', ','.join(columns)])
|
||||
rc, out, err = call(cmd)
|
||||
|
@ -86,7 +86,9 @@ def lvs_state_retrieve(selection, cache_refresh=True):
|
||||
n32(l['metadata_percent']),
|
||||
n32(l['copy_percent']),
|
||||
n32(l['sync_percent']),
|
||||
n(l['lv_metadata_size'])))
|
||||
n(l['lv_metadata_size']),
|
||||
l['move_pv'],
|
||||
l['move_pv_uuid']))
|
||||
return rc
|
||||
|
||||
|
||||
@ -144,7 +146,8 @@ class LvState(State):
|
||||
vg_name, vg_uuid, pool_lv_uuid, PoolLv,
|
||||
origin_uuid, OriginLv, DataPercent, Attr, Tags, active,
|
||||
data_lv, metadata_lv, segtypes, role, layout, SnapPercent,
|
||||
MetaDataPercent, CopyPercent, SyncPercent, MetaDataSizeBytes):
|
||||
MetaDataPercent, CopyPercent, SyncPercent, MetaDataSizeBytes,
|
||||
move_pv, move_pv_uuid):
|
||||
utils.init_class_from_arguments(self)
|
||||
|
||||
# The segtypes is possibly an array with potentially dupes or a single
|
||||
@ -248,12 +251,25 @@ class LvCommon(AutomatedProperties):
|
||||
_FixedMinor_meta = ('b', LV_COMMON_INTERFACE)
|
||||
_ZeroBlocks_meta = ('b', LV_COMMON_INTERFACE)
|
||||
_SkipActivation_meta = ('b', LV_COMMON_INTERFACE)
|
||||
_MovePv_meta = ('o', LV_COMMON_INTERFACE)
|
||||
|
||||
def _get_move_pv(self):
|
||||
path = None
|
||||
|
||||
# It's likely that the move_pv is empty
|
||||
if self.state.move_pv_uuid and self.state.move_pv:
|
||||
path = cfg.om.get_object_path_by_uuid_lvm_id(
|
||||
self.state.move_pv_uuid, self.state.move_pv)
|
||||
if not path:
|
||||
path = '/'
|
||||
return path
|
||||
|
||||
# noinspection PyUnusedLocal,PyPep8Naming
|
||||
def __init__(self, object_path, object_state):
|
||||
super(LvCommon, self).__init__(object_path, lvs_state_retrieve)
|
||||
self.set_interface(LV_COMMON_INTERFACE)
|
||||
self.state = object_state
|
||||
self._move_pv = self._get_move_pv()
|
||||
|
||||
@property
|
||||
def VolumeType(self):
|
||||
@ -363,6 +379,10 @@ class LvCommon(AutomatedProperties):
|
||||
def Active(self):
|
||||
return dbus.Boolean(self.state.active == "active")
|
||||
|
||||
@property
|
||||
def MovePv(self):
|
||||
return dbus.ObjectPath(self._move_pv)
|
||||
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
class Lv(LvCommon):
|
||||
|
Loading…
Reference in New Issue
Block a user