master - lvmdbustest.py: Print to stderr
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0c51f369a49f48...
Commit: 0c51f369a49f489d082c5439967eb6ca49e9a7fd
Parent: cb4e26dcb3aa49128d76eb61495c2ee165974ad9
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 15:09:30 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbustest.py: Print to stderr
It's easier to follow if we print to stderr, so that our print messages
are in the lvm error log in the correct position to other printed
messages.
---
test/dbus/lvmdbustest.py | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index e9b27a0..ef2c07a 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -29,6 +29,10 @@ else:
bus = dbus.SystemBus(mainloop=DBusGMainLoop())
+def std_err_print(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
def get_objects():
rc = {MANAGER_INT: [], PV_INT: [], VG_INT: [], LV_INT: [],
THINPOOL_INT: [], JOB_INT: [], SNAPSHOT_INT: [], LV_COMMON_INT: [],
@@ -63,14 +67,14 @@ class TestDbusService(unittest.TestCase):
# we are not mucking with someones data on their system
self.objs, self.bus = get_objects()
if len(self.objs[PV_INT]) == 0:
- print('No PVs present exiting!')
+ std_err_print('No PVs present exiting!')
sys.exit(1)
if len(self.objs[MANAGER_INT]) != 1:
- print('Expecting a manager object!')
+ std_err_print('Expecting a manager object!')
sys.exit(1)
if len(self.objs[VG_INT]) != 0:
- print('Expecting no VGs to exist!')
+ std_err_print('Expecting no VGs to exist!')
sys.exit(1)
self.pvs = []
@@ -808,7 +812,7 @@ class TestDbusService(unittest.TestCase):
yes = self._test_expired_timer(i)
if yes:
break
- print('Attempt (%d) failed, trying again...' % (i))
+ std_err_print('Attempt (%d) failed, trying again...' % (i))
self.assertTrue(yes)
@@ -918,7 +922,7 @@ class TestDbusService(unittest.TestCase):
# TODO renable test case when
# https://bugzilla.redhat.com/show_bug.cgi?id=1264169 gets fixed
# This was tested with lvmetad disabled and we passed
- print("\nSkipping Vg.UuidGenerate until BZ: 1264169 resolved\n")
+ std_err_print("\nSkipping Vg.UuidGenerate until BZ: 1264169 resolved\n")
if False:
vg = self._vg_create().Vg
@@ -1320,22 +1324,22 @@ if __name__ == '__main__':
set_execution(False)
if int(test_shell) == 0:
- print('\n Shortened fork & exec test ***\n')
+ std_err_print('\n Running only lvm fork & exec test ***\n')
r.register_result(unittest.main(exit=False))
else:
- print('\n *** Testing fork & exec *** \n')
+ std_err_print('\n *** Testing with lvm fork & exec *** \n')
r.register_result(unittest.main(exit=False))
g_tmo = 15
r.register_result(unittest.main(exit=False))
# Test lvm shell
- print('\n *** Testing lvm shell *** \n')
+ std_err_print('\n *** Testing with lvm shell *** \n')
if set_execution(True):
g_tmo = 0
r.register_result(unittest.main(exit=False))
g_tmo = 15
r.register_result(unittest.main(exit=False))
else:
- print("WARNING: Unable to dynamically configure "
+ std_err_print("ERROR: Unable to dynamically configure "
"service to use lvm shell!")
r.exit_run()
7 years, 6 months
master - lvmdbustest.py: Ensure we exit non-zero on fail
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cb4e26dcb3aa49...
Commit: cb4e26dcb3aa49128d76eb61495c2ee165974ad9
Parent: 9f0195ec1ec1113695abdb1ada82dc138bc7488b
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 14:55:36 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbustest.py: Ensure we exit non-zero on fail
If you run multiple runs of unittest.main, unless you don't pass exit=true
the test case always ends with a 0 exit code. Add ability to store the
result of each invocation of the test and exit with a non-zero exit code
if anyone of them fail.
---
test/dbus/lvmdbustest.py | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 819d096..e9b27a0 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1294,8 +1294,25 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(tag in vg_proxy.Vg.Tags, "%s not in %s" %
(tag, str(vg_proxy.Vg.Tags)))
+class AggregateResults(object):
+
+ def __init__(self):
+ self.no_errors = True
+
+ def register_result(self, result):
+ if not result.result.wasSuccessful():
+ self.no_errors = False
+
+ def exit_run(self):
+ if self.no_errors:
+ sys.exit(0)
+ sys.exit(1)
+
if __name__ == '__main__':
+
+ r = AggregateResults()
+
# Test forking & exec new each time
test_shell = os.getenv('LVM_DBUS_TEST_SHELL', 1)
@@ -1304,19 +1321,21 @@ if __name__ == '__main__':
if int(test_shell) == 0:
print('\n Shortened fork & exec test ***\n')
- unittest.main(exit=True)
+ r.register_result(unittest.main(exit=False))
else:
print('\n *** Testing fork & exec *** \n')
- unittest.main(exit=False)
+ r.register_result(unittest.main(exit=False))
g_tmo = 15
- unittest.main(exit=False)
+ r.register_result(unittest.main(exit=False))
# Test lvm shell
print('\n *** Testing lvm shell *** \n')
if set_execution(True):
g_tmo = 0
- unittest.main(exit=False)
+ r.register_result(unittest.main(exit=False))
g_tmo = 15
- unittest.main()
+ r.register_result(unittest.main(exit=False))
else:
print("WARNING: Unable to dynamically configure "
"service to use lvm shell!")
+
+ r.exit_run()
7 years, 6 months
master - lvmdbusd: Ensure tmp dir gets cleaned up
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9f0195ec1ec111...
Commit: 9f0195ec1ec1113695abdb1ada82dc138bc7488b
Parent: 2e941beb446e71a9278e38eb4d69e19dc4b284f8
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 13:46:59 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbusd: Ensure tmp dir gets cleaned up
Regardless of the outcome of starting up the lvm shell process, lets
ensure we clean up the temp directory and pipe.
---
daemons/lvmdbusd/lvm_shell_proxy.py | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py b/daemons/lvmdbusd/lvm_shell_proxy.py
index e615488..6e6d52a 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py
@@ -129,20 +129,24 @@ class LVMShellProxy(object):
[LVM_CMD + " 32>%s" % tmp_file],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=local_env,
stderr=subprocess.PIPE, close_fds=True, shell=True)
- flags = fcntl(self.lvm_shell.stdout, F_GETFL)
- fcntl(self.lvm_shell.stdout, F_SETFL, flags | os.O_NONBLOCK)
- flags = fcntl(self.lvm_shell.stderr, F_GETFL)
- fcntl(self.lvm_shell.stderr, F_SETFL, flags | os.O_NONBLOCK)
-
- # wait for the first prompt
- errors = self._read_until_prompt()[2]
- if errors and len(errors):
- raise RuntimeError(errors)
-
- # These will get deleted when the FD count goes to zero so we can be
- # sure to clean up correctly no matter how we finish
- os.unlink(tmp_file)
- os.rmdir(tmp_dir)
+
+ try:
+ flags = fcntl(self.lvm_shell.stdout, F_GETFL)
+ fcntl(self.lvm_shell.stdout, F_SETFL, flags | os.O_NONBLOCK)
+ flags = fcntl(self.lvm_shell.stderr, F_GETFL)
+ fcntl(self.lvm_shell.stderr, F_SETFL, flags | os.O_NONBLOCK)
+
+ # wait for the first prompt
+ errors = self._read_until_prompt()[2]
+ if errors and len(errors):
+ raise RuntimeError(errors)
+ except:
+ raise
+ finally:
+ # These will get deleted when the FD count goes to zero so we can be
+ # sure to clean up correctly no matter how we finish
+ os.unlink(tmp_file)
+ os.rmdir(tmp_dir)
def get_error_msg(self):
# We got an error, lets go fetch the error message
7 years, 6 months
master - lvmdbusd: Ensure lvm shell still exists
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e941beb446e71...
Commit: 2e941beb446e71a9278e38eb4d69e19dc4b284f8
Parent: 088b3d036a73a7d947f6e9b12e8fad8a9f40d97f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 13:45:30 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbusd: Ensure lvm shell still exists
---
daemons/lvmdbusd/lvm_shell_proxy.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py b/daemons/lvmdbusd/lvm_shell_proxy.py
index 12e7e36..e615488 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py
@@ -75,6 +75,8 @@ class LVMShellProxy(object):
report += tmp.decode("utf-8")
if len(tmp) != 16384:
break
+ else:
+ break
elif r == self.lvm_shell.stderr.fileno():
while True:
@@ -84,6 +86,10 @@ class LVMShellProxy(object):
else:
break
+ # Check to see if the lvm process died on us
+ if self.lvm_shell.poll():
+ raise Exception(self.lvm_shell.returncode, "%s" % stderr)
+
except IOError as ioe:
log_debug(str(ioe))
pass
@@ -171,6 +177,11 @@ class LVMShellProxy(object):
error_msg = ""
json_result = ""
+ if self.lvm_shell.poll():
+ raise Exception(
+ self.lvm_shell.returncode,
+ "Underlying lvm shell process is not present!")
+
# create the command string
cmd = " ".join(_quote_arg(arg) for arg in argv)
cmd += "\n"
@@ -222,7 +233,7 @@ if __name__ == "__main__":
end = time.time()
print(("RC: %d" % ret))
- # print(("OUT:\n%s" % out))
+ print(("OUT:\n%s" % out))
print(("ERR:\n%s" % err))
print("Command = %f seconds" % (end - start))
7 years, 6 months
master - lvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=088b3d036a73a7...
Commit: 088b3d036a73a7d947f6e9b12e8fad8a9f40d97f
Parent: a8bb8dfb08d38cfda5493ca9d35d1cb3bf2d32bf
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Oct 10 17:29:40 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Oct 10 17:31:29 2016 +0200
lvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"
In case a RAID orig LV is being cached and fails, repair is impossible because
"lvconvert --repair" gets rejected.
Fix by allowing repair on cache orig RAID LVs and
"lvconvert --replace/--mirrors/--type {raid*|mirror|striped|linear}" as well.
Allow the same lvconvert actions on any cache pool and metadata RAID SubLVs.
Resolves: rhbz1380532
---
tools/lvconvert.c | 113 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 71 insertions(+), 42 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2f38c9d..daa2af4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -236,6 +236,12 @@ static int _lvconvert_name_params(struct lvconvert_params *lp,
return 0;
}
+ /*
+ * FIXME: avoid this distinct validation out of scope of _convert_*()
+ *
+ * We should not rely on namespace here any more!
+ * It is the duty of lvcreate/lvrename to avoid reserved names.
+ */
if (!lp->merge_mirror &&
!lp->repair &&
!lp->keep_mimages &&
@@ -243,6 +249,7 @@ static int _lvconvert_name_params(struct lvconvert_params *lp,
!strstr(lp->lv_name, "_tmeta") &&
!strstr(lp->lv_name, "_cdata") &&
!strstr(lp->lv_name, "_cmeta") &&
+ !strstr(lp->lv_name, "_corig") &&
!apply_lvname_restrictions(lp->lv_name))
return_0;
@@ -4262,42 +4269,48 @@ static int _convert_mirror(struct cmd_context *cmd, struct logical_volume *lv,
static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
+ /* Permitted convert options on visible or hidden RaidLVs */
+ const char *permitted_options = lv_is_visible(lv) ?
+ " --mirrors\n"
+ " --splitmirrors\n"
+ " --merge\n"
+ " --repair\n"
+ " --replace\n"
+ " --type snapshot\n"
+ " --type thin\n"
+ " --type cache\n"
+ " --type thin-pool\n"
+ " --type cache-pool\n"
+ " --type raid*\n"
+ " --type mirror\n"
+ " --type striped\n"
+ " --type linear\n"
+ :
+ " --mirrors\n"
+ " --repair\n"
+ " --replace\n"
+ " --type raid*\n"
+ " --type mirror\n"
+ " --type striped\n"
+ " --type linear\n";
+
+ /* Applicable to any hidden _or_ visible LVs. */
if (arg_is_set(cmd, mirrors_ARG))
return _convert_raid_number(cmd, lv, lp);
- if (arg_is_set(cmd, splitmirrors_ARG))
- return _convert_raid_splitmirrors(cmd, lv, lp);
-
- if (arg_is_set(cmd, merge_ARG))
- return _convert_raid_merge(cmd, lv, lp);
-
if (arg_is_set(cmd, repair_ARG))
return _convert_raid_repair(cmd, lv, lp);
if (arg_is_set(cmd, replace_ARG))
return _convert_raid_replace(cmd, lv, lp);
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
- return _convert_raid_snapshot(cmd, lv, lp);
-
- if (lp->thin)
- return _convert_raid_thin(cmd, lv, lp);
-
- if (lp->cache)
- return _convert_raid_cache(cmd, lv, lp);
-
- /* Using --thinpool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_THIN_POOL) || arg_is_set(cmd, thinpool_ARG))
- return _convert_raid_thin_pool(cmd, lv, lp);
-
- /* Using --cachepool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_CACHE_POOL) || arg_is_set(cmd, cachepool_ARG))
- return _convert_raid_cache_pool(cmd, lv, lp);
+ if (segtype_is_raid(lp->segtype)) {
+ /* Only --type allowed on hidden RaidLV. */
+ if (!lv_is_visible(lv) && !arg_is_set(cmd, type_ARG))
+ goto out;
- if (segtype_is_raid(lp->segtype))
return _convert_raid_raid(cmd, lv, lp);
+ }
if (segtype_is_mirror(lp->segtype))
return _convert_raid_mirror(cmd, lv, lp);
@@ -4308,24 +4321,39 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
if (_linear_type_requested(lp->type_str))
return _convert_raid_linear(cmd, lv, lp);
- /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
+ /* Applicable to visible LVs only. */
+ if (lv_is_visible(lv)) {
+ if (arg_is_set(cmd, splitmirrors_ARG))
+ return _convert_raid_splitmirrors(cmd, lv, lp);
+
+ if (arg_is_set(cmd, merge_ARG))
+ return _convert_raid_merge(cmd, lv, lp);
+
+ if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
+ return _convert_raid_snapshot(cmd, lv, lp);
+
+ if (lp->thin)
+ return _convert_raid_thin(cmd, lv, lp);
+
+ if (lp->cache)
+ return _convert_raid_cache(cmd, lv, lp);
+
+ /* Using --thinpool is ambiguous and not preferred. */
+
+ if (!strcmp(lp->type_str, SEG_TYPE_NAME_THIN_POOL) || arg_is_set(cmd, thinpool_ARG))
+ return _convert_raid_thin_pool(cmd, lv, lp);
+
+ /* Using --cachepool is ambiguous and not preferred. */
+
+ if (!strcmp(lp->type_str, SEG_TYPE_NAME_CACHE_POOL) || arg_is_set(cmd, cachepool_ARG))
+ return _convert_raid_cache_pool(cmd, lv, lp);
+
+ /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
+ }
+out:
log_error("Operation not permitted on raid LV %s.", display_lvname(lv));
- log_error("Operations permitted on a raid LV are:\n"
- " --mirrors\n"
- " --splitmirrors\n"
- " --merge\n"
- " --repair\n"
- " --replace\n"
- " --type snapshot\n"
- " --type thin\n"
- " --type cache\n"
- " --type thin-pool\n"
- " --type cache-pool\n"
- " --type raid*\n"
- " --type mirror\n"
- " --type striped\n"
- " --type linear\n");
+ log_error("Operations permitted on a raid LV are:\n%s", permitted_options);
return 0;
}
@@ -4440,7 +4468,8 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
!lv_is_thin_pool_metadata(lv) &&
!lv_is_thin_pool_data(lv) &&
!lv_is_used_cache_pool(lv) &&
- !lv_is_raid_image(lv)) {
+ !lv_is_mirrored(lv) &&
+ !lv_is_raid(lv)) {
log_error("Cannot convert internal LV %s.", display_lvname(lv));
ret = 0;
goto out;
7 years, 6 months
master - lvmdbusd: Add LvCommon.DataPercent
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a8bb8dfb08d38c...
Commit: a8bb8dfb08d38cfda5493ca9d35d1cb3bf2d32bf
Parent: d54ffcfcd12981a8e046aca0a82d529221015b30
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 5 15:51:48 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 5 15:55:41 2016 -0500
lvmdbusd: Add LvCommon.DataPercent
---
daemons/lvmdbusd/lv.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index c2312b7..c356799 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -232,6 +232,7 @@ class LvState(State):
@utils.dbus_property(LV_COMMON_INTERFACE, 'Attr', 's')
@utils.dbus_property(LV_COMMON_INTERFACE, 'DataPercent', 'u')
@utils.dbus_property(LV_COMMON_INTERFACE, 'SnapPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'DataPercent', 'u')
@utils.dbus_property(LV_COMMON_INTERFACE, 'MetaDataPercent', 'u')
@utils.dbus_property(LV_COMMON_INTERFACE, 'CopyPercent', 'u')
@utils.dbus_property(LV_COMMON_INTERFACE, 'SyncPercent', 'u')
7 years, 6 months
master - lvmdbusd: Add LvCommon.MovePv
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d54ffcfcd12981...
Commit: d54ffcfcd12981a8e046aca0a82d529221015b30
Parent: a3f24aaf5cfe9983a59ce200d0a0d8050658c8b8
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 5 15:28:42 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 5 15:28:42 2016 -0500
lvmdbusd: Add LvCommon.MovePv
Needed for feature parity for lvm2app.
---
daemons/lvmdbusd/cmdhandler.py | 4 ++--
daemons/lvmdbusd/lv.py | 24 ++++++++++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index a5fbad2..4bdbee5 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -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)
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index 24c901c..c2312b7 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -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):
7 years, 6 months
master - lvmdbusd: Add properties to LvCommon
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a3f24aaf5cfe99...
Commit: a3f24aaf5cfe9983a59ce200d0a0d8050658c8b8
Parent: bf5d0a2651e199bf7f2b737ebcfd5bbe17878d0f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 5 13:59:38 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 5 13:59:38 2016 -0500
lvmdbusd: Add properties to LvCommon
The following LvCommon properties were added so that the API
would have the same functionality as lvm2app has.
LvCommon.MetaDataSizeBytes
LvCommon.Attr
LvCommon.MetaDataPercent
LvCommon.CopyPercent
LvCommon.SnapPercent
LvCommon.SyncPercent
---
daemons/lvmdbusd/cmdhandler.py | 8 ++++++--
daemons/lvmdbusd/lv.py | 18 +++++++++++++++---
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 3cb2cbd..a5fbad2 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -485,7 +485,9 @@ def lvm_full_report_json():
'vg_name', 'pool_lv_uuid', 'pool_lv', 'origin_uuid',
'origin', 'data_percent',
'lv_attr', 'lv_tags', 'vg_uuid', 'lv_active', 'data_lv',
- 'metadata_lv', 'lv_parent', 'lv_role', 'lv_layout']
+ 'metadata_lv', 'lv_parent', 'lv_role', 'lv_layout',
+ 'snap_percent', 'metadata_percent', 'copy_percent',
+ 'sync_percent', 'lv_metadata_size']
lv_seg_columns = ['seg_pe_ranges', 'segtype', 'lv_uuid']
@@ -735,7 +737,9 @@ def lv_retrieve_with_segments():
'origin', 'data_percent',
'lv_attr', 'lv_tags', 'vg_uuid', 'lv_active', 'data_lv',
'metadata_lv', 'seg_pe_ranges', 'segtype', 'lv_parent',
- 'lv_role', 'lv_layout']
+ 'lv_role', 'lv_layout',
+ 'snap_percent', 'metadata_percent', 'copy_percent',
+ 'sync_percent', 'lv_metadata_size']
cmd = _dc('lvs', ['-a', '-o', ','.join(columns)])
rc, out, err = call(cmd)
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index 2a8a3fb..24c901c 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -81,7 +81,12 @@ def lvs_state_retrieve(selection, cache_refresh=True):
n32(l['data_percent']), l['lv_attr'],
l['lv_tags'], l['lv_active'], l['data_lv'],
l['metadata_lv'], l['segtype'], l['lv_role'],
- l['lv_layout']))
+ l['lv_layout'],
+ n32(l['snap_percent']),
+ n32(l['metadata_percent']),
+ n32(l['copy_percent']),
+ n32(l['sync_percent']),
+ n(l['lv_metadata_size'])))
return rc
@@ -138,7 +143,8 @@ class LvState(State):
def __init__(self, Uuid, Name, Path, SizeBytes,
vg_name, vg_uuid, pool_lv_uuid, PoolLv,
origin_uuid, OriginLv, DataPercent, Attr, Tags, active,
- data_lv, metadata_lv, segtypes, role, layout):
+ data_lv, metadata_lv, segtypes, role, layout, SnapPercent,
+ MetaDataPercent, CopyPercent, SyncPercent, MetaDataSizeBytes):
utils.init_class_from_arguments(self)
# The segtypes is possibly an array with potentially dupes or a single
@@ -214,13 +220,19 @@ class LvState(State):
@utils.dbus_property(LV_COMMON_INTERFACE, 'Name', 's')
@utils.dbus_property(LV_COMMON_INTERFACE, 'Path', 's')
@utils.dbus_property(LV_COMMON_INTERFACE, 'SizeBytes', 't')
-(a)utils.dbus_property(LV_COMMON_INTERFACE, 'DataPercent', 'u')
@utils.dbus_property(LV_COMMON_INTERFACE, 'SegType', 'as')
@utils.dbus_property(LV_COMMON_INTERFACE, 'Vg', 'o')
@utils.dbus_property(LV_COMMON_INTERFACE, 'OriginLv', 'o')
@utils.dbus_property(LV_COMMON_INTERFACE, 'PoolLv', 'o')
@utils.dbus_property(LV_COMMON_INTERFACE, 'Devices', "a(oa(tts))")
@utils.dbus_property(LV_COMMON_INTERFACE, 'HiddenLvs', "ao")
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'Attr', 's')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'DataPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'SnapPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'MetaDataPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'CopyPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'SyncPercent', 'u')
+(a)utils.dbus_property(LV_COMMON_INTERFACE, 'MetaDataSizeBytes', 't')
class LvCommon(AutomatedProperties):
_Tags_meta = ("as", LV_COMMON_INTERFACE)
_Roles_meta = ("as", LV_COMMON_INTERFACE)
7 years, 6 months
master - toollib: clean up coverity issue
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf5d0a2651e199...
Commit: bf5d0a2651e199bf7f2b737ebcfd5bbe17878d0f
Parent: c900cf7ed40e541fa8b2eeeb084c1061382e0b1e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Oct 4 16:25:32 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Oct 4 16:25:32 2016 -0500
toollib: clean up coverity issue
in processing duplicate pvs.
---
tools/toollib.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 9127d85..9763362 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3264,9 +3264,12 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
* Don't pass dev to lvmcache_info_from_pvid because we looking
* for the chosen/preferred dev for this pvid.
*/
- info = lvmcache_info_from_pvid(devl->dev->pvid, NULL, 0);
- if (info)
- vgname = lvmcache_vgname_from_info(info);
+ if (!(info = lvmcache_info_from_pvid(devl->dev->pvid, NULL, 0))) {
+ log_error(INTERNAL_ERROR "No info for pvid");
+ return_ECMD_FAILED;
+ }
+
+ vgname = lvmcache_vgname_from_info(info);
if (vgname)
vgid = lvmcache_vgid_from_vgname(cmd, vgname);
if (vgid)
7 years, 6 months
master - Revert "cleanup: simplier assign of cmd vars"
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c900cf7ed40e54...
Commit: c900cf7ed40e541fa8b2eeeb084c1061382e0b1e
Parent: 9e33781d95f2fe7d412b97eb48cb8dddd1c07c61
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Oct 3 18:14:17 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Oct 3 18:14:17 2016 +0100
Revert "cleanup: simplier assign of cmd vars"
This reverts commit cea441f4d1e19f170d9161203ef843c59f3fbf70.
cmd->default_values is configurable and this code should not make
any assumptions about values it holds.
---
tools/lvmcmdline.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index bd29e25..9a4deb7 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1049,19 +1049,23 @@ static int _get_settings(struct cmd_context *cmd)
const char *activation_mode;
cmd->current_settings = cmd->default_settings;
- cmd->current_settings.verbose = arg_count(cmd, verbose_ARG);
- cmd->current_settings.test = arg_is_set(cmd, test_ARG);
if (arg_is_set(cmd, debug_ARG))
cmd->current_settings.debug = _LOG_FATAL +
(arg_count(cmd, debug_ARG) - 1);
+ if (arg_is_set(cmd, verbose_ARG))
+ cmd->current_settings.verbose = arg_count(cmd, verbose_ARG);
+
if (arg_is_set(cmd, quiet_ARG)) {
cmd->current_settings.debug = 0;
cmd->current_settings.verbose = 0;
cmd->current_settings.silent = (arg_count(cmd, quiet_ARG) > 1) ? 1 : 0;
}
+ if (arg_is_set(cmd, test_ARG))
+ cmd->current_settings.test = arg_is_set(cmd, test_ARG);
+
if (arg_is_set(cmd, driverloaded_ARG)) {
cmd->current_settings.activation =
arg_int_value(cmd, driverloaded_ARG,
7 years, 6 months