master - tests: notify dbus only for dbus test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe437a6e7d9367...
Commit: fe437a6e7d9367eecd977d2504db82469016c780
Parent: 8f300691603c57388a4fa092f18f121d7504e3c4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 5 11:48:03 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:37:44 2016 +0200
tests: notify dbus only for dbus test
---
test/lib/aux.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 3d84e86..e523123 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -325,8 +325,8 @@ prepare_lvmdbusd() {
daemon="$(which lvmdbusd || :)"
fi
[[ -n $daemon && -x $daemon ]] || skip "The daemon is missing"
-
which python3 >/dev/null || skip "Missing python3"
+
python3 -c "import pyudev, dbus, gi.repository" || skip "Missing python modules"
# Copy the needed file to run on the system bus if it doesn't
@@ -336,6 +336,8 @@ prepare_lvmdbusd() {
fi
echo "preparing lvmdbusd..."
+ lvmconf "global/notify_dbus = 1"
+
"$daemon" --debug > debug.log_LVMDBUSD_out 2>&1 &
local pid=$!
@@ -1079,6 +1081,7 @@ devices/global_filter = [ "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
devices/md_component_detection = 0
devices/scan = "$DM_DEV_DIR"
devices/sysfs_scan = 1
+devices/write_cache_state = 0
global/abort_on_internal_errors = 1
global/cache_check_executable = "$LVM_TEST_CACHE_CHECK_CMD"
global/cache_dump_executable = "$LVM_TEST_CACHE_DUMP_CMD"
@@ -1088,6 +1091,7 @@ global/fallback_to_local_locking = 0
global/library_dir = "$TESTDIR/lib"
global/locking_dir = "$TESTDIR/var/lock/lvm"
global/locking_type=$LVM_TEST_LOCKING
+global/notify_dbus = 0
global/si_unit_consistency = 1
global/thin_check_executable = "$LVM_TEST_THIN_CHECK_CMD"
global/thin_dump_executable = "$LVM_TEST_THIN_DUMP_CMD"
7 years, 5 months
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8f300691603c57...
Commit: 8f300691603c57388a4fa092f18f121d7504e3c4
Parent: 6f576483a87aac67037e25914990a77e76c81423
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 11:55:19 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:37:43 2016 +0200
cleanup: indent
---
tools/lvconvert.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 78cd7de..48e8cc8 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -330,6 +330,7 @@ static int _read_conversion_type(struct cmd_context *cmd,
return 1;
log_error("Conversion using --type %s is not supported.", type_str);
+
return 0;
}
@@ -561,7 +562,6 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
log_error("--snapshot and --merge are mutually exclusive.");
return 0;
}
-
lp->snapshot = 1;
}
@@ -627,9 +627,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
}
if (arg_is_set(cmd, mirrors_ARG)) {
- /*
- * --splitmirrors is the mechanism for detaching and keeping a mimage
- */
+ /* --splitmirrors is the mechanism for detaching and keeping a mimage */
lp->mirrors_supplied = 1;
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0);
lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, SIGN_NONE);
@@ -4272,6 +4270,7 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
/* Permitted convert options on visible or hidden RaidLVs */
+ /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
const char *permitted_options = lv_is_visible(lv) ?
" --mirrors\n"
" --splitmirrors\n"
@@ -4347,13 +4346,12 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
if (segtype_is_cache_pool(lp->segtype) ||
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%s", permitted_options);
+
return 0;
}
7 years, 5 months
master - cleanup: lvconvert drop unused variable
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6f576483a87aac...
Commit: 6f576483a87aac67037e25914990a77e76c81423
Parent: c8b6c130158e1cc1a639afc21f5fd6306286fdb3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 11:52:07 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:37:43 2016 +0200
cleanup: lvconvert drop unused variable
---
tools/lvconvert.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 161062d..78cd7de 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -50,8 +50,6 @@ struct lvconvert_params {
int splitsnapshot;
int thin;
int uncache;
- int other_conversion; /* Everything else */
-
int corelog; /* Equivalent to --mirrorlog core */
int mirrorlog; /* Only one of corelog and mirrorlog may be set */
@@ -644,8 +642,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->cache + lp->thin + lp->keep_mimages + lp->snapshot + lp->replace + lp->repair > 1) {
log_error(INTERNAL_ERROR "Unexpected combination of incompatible options selected.");
return 0;
- } else
- lp->other_conversion = 1;
+ }
/*
* Final checking of each case:
7 years, 5 months
master - cleanup: use already set values
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c8b6c130158e1c...
Commit: c8b6c130158e1cc1a639afc21f5fd6306286fdb3
Parent: f4ae43934a02c5cb90845758804fc278f5fb0edb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 13:19:44 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:37:43 2016 +0200
cleanup: use already set values
When we have already decoded arg_is_set into a local var
or already set segment type - already use these
values instead of repeating calls and string checks.
---
tools/lvconvert.c | 59 ++++++++++++++++++++++++----------------------------
1 files changed, 27 insertions(+), 32 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 499ff1c..161062d 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4110,11 +4110,11 @@ static int _convert_striped_raid(struct cmd_context *cmd, struct logical_volume
static int _convert_cow_snapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitsnapshot_ARG))
+ if (lp->splitsnapshot)
return _convert_cow_snapshot_splitsnapshot(cmd, lv, lp);
/* FIXME: add --merge-snapshot to make this distinct from --merge-mirror. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_cow_snapshot_merge(cmd, lv, lp);
log_error("Operation not permitted on COW snapshot LV %s.", display_lvname(lv));
@@ -4128,7 +4128,7 @@ static int _convert_thin_volume(struct cmd_context *cmd, struct logical_volume *
struct lvconvert_params *lp)
{
/* FIXME: add --merge-snapshot to make this distinct from --merge-mirror. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_thin_volume_merge(cmd, lv, lp);
log_error("Operation not permitted on thin LV %s.", display_lvname(lv));
@@ -4140,19 +4140,19 @@ static int _convert_thin_volume(struct cmd_context *cmd, struct logical_volume *
static int _convert_thin_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_thin_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_thin_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, uncache_ARG))
+ if (lp->uncache)
return _convert_thin_pool_uncache(cmd, lv, lp);
if (lp->cache)
return _convert_thin_pool_cache(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_thin_pool_repair(cmd, lv, lp);
/* FIXME: swapping the thin pool metadata LV needs a specific option like --swapmetadata */
@@ -4173,21 +4173,20 @@ static int _convert_thin_pool(struct cmd_context *cmd, struct logical_volume *lv
static int _convert_cache_volume(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_cache_volume_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_cache_volume_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, uncache_ARG))
+ if (lp->uncache)
return _convert_cache_volume_uncache(cmd, lv, lp);
if (arg_is_set(cmd, splitmirrors_ARG))
return _convert_cache_volume_splitmirrors(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))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ arg_is_set(cmd, thinpool_ARG))
return _convert_cache_volume_thin_pool(cmd, lv, lp);
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
@@ -4204,10 +4203,10 @@ static int _convert_cache_volume(struct cmd_context *cmd, struct logical_volume
static int _convert_cache_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_cache_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_cache_pool_splitcache(cmd, lv, lp);
/* FIXME: swapping the cache pool metadata LV needs a specific option like --swapmetadata */
@@ -4234,7 +4233,7 @@ static int _convert_mirror(struct cmd_context *cmd, struct logical_volume *lv,
if (arg_is_set(cmd, mirrorlog_ARG) || arg_is_set(cmd, corelog_ARG))
return _convert_mirror_log(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_mirror_repair(cmd, lv, lp);
if (_linear_type_requested(lp->type_str))
@@ -4304,7 +4303,7 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
if (arg_is_set(cmd, mirrors_ARG))
return _convert_raid_number(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_raid_repair(cmd, lv, lp);
if (arg_is_set(cmd, replace_ARG))
@@ -4332,7 +4331,7 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
if (arg_is_set(cmd, splitmirrors_ARG))
return _convert_raid_splitmirrors(cmd, lv, lp);
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_raid_merge(cmd, lv, lp);
if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
@@ -4344,14 +4343,12 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
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))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ 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))
+ if (segtype_is_cache_pool(lp->segtype) ||
+ 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. */
@@ -4369,10 +4366,10 @@ static int _convert_striped(struct cmd_context *cmd, struct logical_volume *lv,
const char *mirrors_type = find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL);
/* FIXME: add --merge-mirror to make this distinct from --merge-snapshot. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_striped_merge(cmd, lv, lp);
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
+ if (lp->snapshot || segtype_is_snapshot(lp->segtype))
return _convert_striped_snapshot(cmd, lv, lp);
if (lp->thin)
@@ -4381,14 +4378,12 @@ static int _convert_striped(struct cmd_context *cmd, struct logical_volume *lv,
if (lp->cache)
return _convert_striped_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))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ arg_is_set(cmd, thinpool_ARG))
return _convert_striped_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))
+ if (segtype_is_cache_pool(lp->segtype) ||
+ arg_is_set(cmd, cachepool_ARG))
return _convert_striped_cache_pool(cmd, lv, lp);
if (!strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR))
7 years, 5 months
master - cleanup: reorder code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f4ae43934a02c5...
Commit: f4ae43934a02c5cb90845758804fc278f5fb0edb
Parent: 706d3ddf901584d182b5bab49f3d7d4b3476e807
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 11:56:15 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:37:43 2016 +0200
cleanup: reorder code
Move some arg test into a single place with sort of alphabetic order
when possible to make reading easier.
---
tools/lvconvert.c | 63 +++++++++++++++++++++++++++-------------------------
1 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 05bf51a..499ff1c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -451,6 +451,30 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (!_read_conversion_type(cmd, lp))
return_0;
+ if (!arg_is_set(cmd, background_ARG))
+ lp->wait_completion = 1;
+
+ if (arg_is_set(cmd, corelog_ARG))
+ lp->corelog = 1;
+
+ if (arg_is_set(cmd, mirrorlog_ARG)) {
+ if (lp->corelog) {
+ log_error("--mirrorlog and --corelog are incompatible.");
+ return 0;
+ }
+ lp->mirrorlog = 1;
+ }
+
+ if (arg_is_set(cmd, merge_ARG)) {
+ if (arg_outside_list_is_set(cmd, "cannot be used with --merge",
+ merge_ARG,
+ background_ARG, interval_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
+ return_0;
+ lp->merge = 1;
+ }
+
/* If --repair, check for incompatible args. */
if (arg_is_set(cmd, repair_ARG)) {
if (arg_outside_list_is_set(cmd, "cannot be used with --repair",
@@ -462,15 +486,8 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->repair = 1;
}
- if (arg_is_set(cmd, mirrorlog_ARG))
- lp->mirrorlog = 1;
- if (arg_is_set(cmd, corelog_ARG))
- lp->corelog = 1;
-
- if (lp->mirrorlog && lp->corelog) {
- log_error("--mirrorlog and --corelog are incompatible.");
- return 0;
- }
+ if (arg_is_set(cmd, replace_ARG))
+ lp->replace = 1;
if (arg_is_set(cmd, split_ARG)) {
if (arg_outside_list_is_set(cmd, "cannot be used with --split",
@@ -500,6 +517,9 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->splitsnapshot = 1;
}
+ if (arg_is_set(cmd, trackchanges_ARG))
+ lp->track_changes = 1;
+
if (arg_is_set(cmd, uncache_ARG)) {
if (arg_outside_list_is_set(cmd, "cannot be used with --uncache",
uncache_ARG,
@@ -538,11 +558,8 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (!_read_pool_params(cmd, &argc, &argv, lp))
return_0;
- if (!arg_is_set(cmd, background_ARG))
- lp->wait_completion = 1;
-
if (_snapshot_type_requested(cmd, lp->type_str)) {
- if (arg_is_set(cmd, merge_ARG)) {
+ if (lp->merge) {
log_error("--snapshot and --merge are mutually exclusive.");
return 0;
}
@@ -550,9 +567,6 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->snapshot = 1;
}
- if (arg_is_set(cmd, trackchanges_ARG))
- lp->track_changes = 1;
-
if (lp->split) {
lp->lv_split_name = arg_str_value(cmd, name_ARG, NULL);
@@ -589,12 +603,6 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
}
}
- if (arg_is_set(cmd, merge_ARG))
- lp->merge = 1;
-
- if (arg_is_set(cmd, replace_ARG))
- lp->replace = 1;
-
/* If no other case was identified, then use of --stripes means --type striped */
if (!arg_is_set(cmd, type_ARG) && !*lp->type_str && !lp->merge && !lp->splitsnapshot &&
!lp->splitcache && !lp->split && !lp->snapshot && !lp->uncache && !lp->cache && !lp->thin &&
@@ -655,14 +663,9 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
* --type mirror|raid lp->mirrorlog lp->corelog
* --type raid0|striped
*/
- if (lp->merge) { /* Snapshot or mirror merge */
- if (arg_outside_list_is_set(cmd, "cannot be used with --merge",
- merge_ARG,
- background_ARG, interval_ARG,
- force_ARG, noudevsync_ARG, test_ARG,
- -1))
- return_0;
- } else if (lp->splitsnapshot) /* Destroy snapshot retaining cow as separate LV */
+ if (lp->merge) /* Snapshot or mirror merge */
+ ;
+ else if (lp->splitsnapshot) /* Destroy snapshot retaining cow as separate LV */
;
else if (lp->splitcache)
;
7 years, 5 months
master - lvconvert: use _read_conversion_type
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=706d3ddf901584...
Commit: 706d3ddf901584d182b5bab49f3d7d4b3476e807
Parent: 1186cf2ad4bbfef07ead644dc689745d10709789
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 13:19:12 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:36:51 2016 +0200
lvconvert: use _read_conversion_type
Code reodering and using same pattern for reading and validating arg
(--type in this case).
---
tools/lvconvert.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a5ef234..05bf51a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -314,9 +314,14 @@ static int _striped_type_requested(const char *type_str)
return (!strcmp(type_str, SEG_TYPE_NAME_STRIPED) || _linear_type_requested(type_str));
}
-static int _check_conversion_type(struct cmd_context *cmd, const char *type_str)
+static int _read_conversion_type(struct cmd_context *cmd,
+ struct lvconvert_params *lp)
{
- if (!type_str || !*type_str)
+
+ const char *type_str = arg_str_value(cmd, type_ARG, "");
+
+ lp->type_str = type_str;
+ if (!lp->type_str[0])
return 1;
/* FIXME: Check thin-pool and thin more thoroughly! */
@@ -443,9 +448,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
int region_size;
int pagesize = lvm_getpagesize();
- lp->type_str = arg_str_value(cmd, type_ARG, "");
-
- if (*lp->type_str && !_check_conversion_type(cmd, lp->type_str))
+ if (!_read_conversion_type(cmd, lp))
return_0;
/* If --repair, check for incompatible args. */
7 years, 5 months
master - lvconvert: fix error value
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1186cf2ad4bbfe...
Commit: 1186cf2ad4bbfef07ead644dc689745d10709789
Parent: 20e74313cd8abaa691fb4f1015a84b34171aa08a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 11 11:59:43 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 11 13:36:29 2016 +0200
lvconvert: fix error value
Seems some error path where not converted to 'new' ECMD return value.
Fix them to always 'goto out'.
Also drop unneeded 'ret = 0' when ret already is 0.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b0140be..4138685 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.167 -
======================================
+ Fix a few unconverted return code values for some lvconvert error path.
Disable lvconvert of thin pool to raid while active.
Disable systemd service start rate limiting for lvm2-pvscan@.service.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index daa2af4..a5ef234 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4446,13 +4446,11 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_locked(lv)) {
log_error("Cannot convert locked LV %s.", display_lvname(lv));
- ret = 0;
goto out;
}
if (lv_is_pvmove(lv)) {
log_error("Cannot convert pvmove LV %s.", display_lvname(lv));
- ret = 0;
goto out;
}
@@ -4471,7 +4469,6 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
!lv_is_mirrored(lv) &&
!lv_is_raid(lv)) {
log_error("Cannot convert internal LV %s.", display_lvname(lv));
- ret = 0;
goto out;
}
}
@@ -4480,12 +4477,12 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
if (!*lp->type_str)
lp->segtype = seg->segtype;
else if (!(lp->segtype = get_segtype_from_string(cmd, lp->type_str)))
- return_0;
+ goto_out;
if (!strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
if (!lp->mirrors_supplied && !seg_is_raid1(seg)) {
log_error("Conversions to --type mirror require -m/--mirrors");
- return 0;
+ goto out;
}
}
@@ -4494,7 +4491,7 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
!lp->segtype->ops->target_present(cmd, NULL, &lp->target_attr)) {
log_error("%s: Required device-mapper target(s) not "
"detected in your kernel.", lp->segtype->name);
- return 0;
+ goto out;
}
/* Process striping parameters */
@@ -4503,7 +4500,7 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
_striped_type_requested(lp->type_str) || lp->repair || lp->mirrorlog || lp->corelog) {
/* FIXME Handle +/- adjustments too? */
if (!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied))
- return_0;
+ goto_out;
if (_raid0_type_requested(lp->type_str) || _striped_type_requested(lp->type_str))
/* FIXME Shouldn't need to override get_stripe_params which defaults to 1 stripe (i.e. linear)! */
@@ -4569,7 +4566,6 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
* reach here, but this covers anything that was missed.
*/
log_error("Cannot convert LV %s.", display_lvname(lv));
- ret = 0;
out:
return ret ? ECMD_PROCESSED : ECMD_FAILED;
7 years, 5 months
master - lvmdbustest.py: Add profile and path for lvm binary
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20e74313cd8aba...
Commit: 20e74313cd8abaa691fb4f1015a84b34171aa08a
Parent: be06fa695ea9833bcc25c09a17c6396cca07be31
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Oct 10 16:26:38 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:33:42 2016 -0500
lvmdbustest.py: Add profile and path for lvm binary
---
test/api/dbustest.sh | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/test/api/dbustest.sh b/test/api/dbustest.sh
index 8741eb9..16dc186 100644
--- a/test/api/dbustest.sh
+++ b/test/api/dbustest.sh
@@ -18,5 +18,19 @@ SKIP_WITH_CLVMD=1
aux prepare_pvs 6
+# We need the lvmdbusd.profile for the daemon to utilize JSON
+# output
+mkdir -p $TESTDIR/etc/profile/
+cp -v $TESTOLDPWD/../conf/lvmdbusd.profile $TESTDIR/etc/profile/.
+
+# Need to set this up so that the lvmdbusd service knows which
+# binary to be running, which should be the one we just built
+export LVM_BINARY=$TESTOLDPWD/../tools/lvm
+
aux prepare_lvmdbusd
+
+# Lets limit testing until the lvm SIGABRT is fixed as
+# we are running into that when using the lvm shell
+export LVM_DBUS_TEST_SHELL=0
+
$test_data_dir/dbus/lvmdbustest.py -v
7 years, 5 months
master - lvmdbustest.py: Skip test_job_handling_timer on loopback
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=be06fa695ea983...
Commit: be06fa695ea9833bcc25c09a17c6396cca07be31
Parent: 3e45285b403bdcbf744f21eba6d6aa3a70628e71
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 18:18:36 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbustest.py: Skip test_job_handling_timer on loopback
This test never passes on loop back, so we will skip unless the
pv devices are real devices which contain `/dev/sd`.
We always fail because we need lvm to run slow to get a timer to
pop, and loopback are too fast.
---
test/dbus/lvmdbustest.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 37ce1d4..d222264 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -807,6 +807,11 @@ class TestDbusService(unittest.TestCase):
yes = False
+ for pp in self.objs[PV_INT]:
+ if '/dev/sd' not in pp.Pv.Name:
+ std_err_print("Skipping test_job_handling_timer on loopback")
+ return
+
# This may not pass
for i in [48, 64, 128]:
yes = self._test_expired_timer(i)
7 years, 5 months
master - lvmdbustest.py: Denote failure if set_execution fails
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3e45285b403bdc...
Commit: 3e45285b403bdcbf744f21eba6d6aa3a70628e71
Parent: 0c51f369a49f489d082c5439967eb6ca49e9a7fd
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 7 15:30:18 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Oct 10 16:31:00 2016 -0500
lvmdbustest.py: Denote failure if set_execution fails
---
test/dbus/lvmdbustest.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index ef2c07a..37ce1d4 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1298,6 +1298,7 @@ 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):
@@ -1307,6 +1308,9 @@ class AggregateResults(object):
if not result.result.wasSuccessful():
self.no_errors = False
+ def register_fail(self):
+ self.no_errors = False
+
def exit_run(self):
if self.no_errors:
sys.exit(0)
@@ -1339,6 +1343,7 @@ if __name__ == '__main__':
g_tmo = 15
r.register_result(unittest.main(exit=False))
else:
+ r.register_fail()
std_err_print("ERROR: Unable to dynamically configure "
"service to use lvm shell!")
7 years, 5 months