master - tests: use bigger metadata
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=27574d0e410c9b...
Commit: 27574d0e410c9b78a1bdc14dc6fd3c9ed2b6ca9f
Parent: 53b787e519261008c4b1d96ea58243c9e2e06f25
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 16:27:39 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:27:39 2014 +0200
tests: use bigger metadata
Until resolved - use bigger then 4MB cache pool metadata.
---
test/shell/pvmove-cache-segtypes.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvmove-cache-segtypes.sh b/test/shell/pvmove-cache-segtypes.sh
index 1f5c6d9..9eaf186 100644
--- a/test/shell/pvmove-cache-segtypes.sh
+++ b/test/shell/pvmove-cache-segtypes.sh
@@ -142,7 +142,7 @@ lvremove -ff $vg
#################################################
lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
# RAID for cachepool
-lvcreate --type raid1 -m 1 -L 4M -n meta $vg "$dev1" "$dev2"
+lvcreate --type raid1 -m 1 -L 6M -n meta $vg "$dev1" "$dev2"
lvcreate --type raid1 -m 1 -L 4M -n cachepool $vg "$dev1" "$dev2"
lvconvert --yes --type cache-pool $vg/cachepool --poolmetadata $vg/meta
# RAID for thin pool data LV
9 years, 8 months
master - cleanup: drop testing impossible path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=53b787e5192610...
Commit: 53b787e519261008c4b1d96ea58243c9e2e06f25
Parent: ffa1a7b046b0ec62d478a848181f16c4ee0126bb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 14:47:58 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:20:21 2014 +0200
cleanup: drop testing impossible path
We cannot get NULL in this test - since if the arg is set
it will always return non-NULL value here.
(in-release update)
---
tools/lvconvert.c | 18 +++---------------
1 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index b630ee2..63a1d98 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -242,10 +242,7 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
" the cache or cache-pool segment type.");
return 0;
}
- if (!(lp->pool_data_lv_name = arg_str_value(cmd, cachepool_ARG, NULL))) {
- log_error("Missing cache pool logical volume name.");
- return 0;
- }
+ lp->pool_data_lv_name = arg_str_value(cmd, cachepool_ARG, NULL);
cachepool = 1;
type_str = "cache-pool";
} else if (!strcmp(type_str, "cache-pool"))
@@ -259,10 +256,7 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
" the thin or thin-pool segment type.");
return 0;
}
- if (!(lp->pool_data_lv_name = arg_str_value(cmd, thinpool_ARG, NULL))) {
- log_error("Missing thin pool logical volume name.");
- return 0;
- }
+ lp->pool_data_lv_name = arg_str_value(cmd, thinpool_ARG, NULL);
thinpool = 1;
type_str = "thin-pool";
} else if (!strcmp(type_str, "thin-pool"))
@@ -270,13 +264,7 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
if (thinpool) {
lp->discards = (thin_discards_t) arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_PASSDOWN);
-
- if (arg_count(cmd, originname_ARG)) {
- if (!(lp->origin_lv_name = arg_str_value(cmd, originname_ARG, NULL))) {
- log_error("Missing --originname argument.");
- return 0;
- }
- }
+ lp->origin_lv_name = arg_str_value(cmd, originname_ARG, NULL);
} else {
if (!arg_is_any_set(cmd, "is valid only with thin pools",
discards_ARG, originname_ARG, zero_ARG,
9 years, 8 months
master - cleanup: typo in message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ffa1a7b046b0ec...
Commit: ffa1a7b046b0ec62d478a848181f16c4ee0126bb
Parent: ab72cdbf81ef5a52a63098b1997b3a6765a9edc5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 14:46:38 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:19:57 2014 +0200
cleanup: typo in message
in-release fix.
---
tools/lvconvert.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index eef408a..b630ee2 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -529,7 +529,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
;
else if (lp->snapshot) { /* Snapshot creation from pre-existing cow */
if (!argc) {
- log_error("Please provide logical volume path for snaphost origin.");
+ log_error("Please provide logical volume path for snapshot origin.");
return 0;
}
lp->origin_lv_name = argv[0];
9 years, 8 months
master - cleanup: check arg_count once
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ab72cdbf81ef5a...
Commit: ab72cdbf81ef5a52a63098b1997b3a6765a9edc5
Parent: 321592af71686b8963a6bae276533f4f19946578
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 14 17:34:49 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:18:35 2014 +0200
cleanup: check arg_count once
Do not check quiet_ARG more then necessary.
---
tools/lvmcmdline.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index be7844b..ccef904 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -935,11 +935,9 @@ static int _get_settings(struct cmd_context *cmd)
if (arg_count(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_count(cmd, quiet_ARG) > 1)
- cmd->current_settings.silent = 1;
-
if (arg_count(cmd, test_ARG))
cmd->current_settings.test = arg_count(cmd, test_ARG);
9 years, 8 months
master - raid: support lvdisplay --maps
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=321592af71686b...
Commit: 321592af71686b8963a6bae276533f4f19946578
Parent: cac0722cacaac06ac1211194f1d6c21572a32998
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 16 23:55:46 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:18:34 2014 +0200
raid: support lvdisplay --maps
Add legs printing for --maps
Somewhat similar to mirror support - maybe there are more things to
show...
---
lib/raid/raid.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 33ba5b7..c3f5c3f 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -30,6 +30,21 @@ static const char *_raid_name(const struct lv_segment *seg)
return seg->segtype->name;
}
+static void _raid_display(const struct lv_segment *seg)
+{
+ unsigned s;
+
+ for (s = 0; s < seg->area_count; ++s) {
+ log_print(" Raid Data LV%2d", s);
+ display_stripe(seg, s, " ");
+ }
+
+ for (s = 0; s < seg->area_count; ++s)
+ log_print(" Raid Metadata LV%2d\t%s", s, seg_metalv(seg, s)->name);
+
+ log_print(" ");
+}
+
static int _raid_text_import_area_count(const struct dm_config_node *sn,
uint32_t *area_count)
{
@@ -404,6 +419,7 @@ static int _raid_target_unmonitor_events(struct lv_segment *seg, int events)
static struct segtype_handler _raid_ops = {
.name = _raid_name,
+ .display = _raid_display,
.text_import_area_count = _raid_text_import_area_count,
.text_import = _raid_text_import,
.text_export = _raid_text_export,
9 years, 8 months
master - metadata: use outfc for comments
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cac0722cacaac0...
Commit: cac0722cacaac06ac1211194f1d6c21572a32998
Parent: f5d6c4b0f3527b42ff3e7ef7a68010c3540d6f41
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 16 23:57:43 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:17:44 2014 +0200
metadata: use outfc for comments
Few unecessary comments were written to on-disc metadata.
Use outfc() to have comments only in archived files.
(may also save couple bytes in ringbuffer).
TODO: needed validation against newline char...
---
lib/format_text/export.c | 10 ++++++----
lib/striped/striped.c | 4 ++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 319e5ea..aa0d905 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -329,6 +329,7 @@ static int _print_header(struct formatter *f,
{
char *buf;
time_t t;
+ char com[PATH_MAX];
t = time(NULL);
@@ -344,9 +345,10 @@ static int _print_header(struct formatter *f,
}
outf(f, "description = \"%s\"", dm_escape_double_quotes(buf, desc));
outnl(f);
- outf(f, "creation_host = \"%s\"\t# %s %s %s %s %s", _utsname.nodename,
- _utsname.sysname, _utsname.nodename, _utsname.release,
- _utsname.version, _utsname.machine);
+ (void) dm_snprintf(com, sizeof(com), "# %s %s %s %s %s",
+ _utsname.sysname, _utsname.nodename, _utsname.release,
+ _utsname.version, _utsname.machine);
+ outfc(f, com, "creation_host = \"%s\"", _utsname.nodename);
outf(f, "creation_time = %lu\t# %s", t, ctime(&t));
return 1;
@@ -396,7 +398,7 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outf(f, "seqno = %u", vg->seqno);
if (vg->fid && vg->fid->fmt)
- outf(f, "format = \"%s\" # informational", vg->fid->fmt->name);
+ outfc(f, "# informational", "format = \"%s\"", vg->fid->fmt->name);
if (!_print_flag_config(f, vg->status, VG_FLAGS))
return_0;
diff --git a/lib/striped/striped.c b/lib/striped/striped.c
index 3b08467..dfd4518 100644
--- a/lib/striped/striped.c
+++ b/lib/striped/striped.c
@@ -94,8 +94,8 @@ static int _striped_text_import(struct lv_segment *seg, const struct dm_config_n
static int _striped_text_export(const struct lv_segment *seg, struct formatter *f)
{
- outf(f, "stripe_count = %u%s", seg->area_count,
- (seg->area_count == 1) ? "\t# linear" : "");
+ outfc(f, (seg->area_count == 1) ? "# linear" : NULL,
+ "stripe_count = %u", seg->area_count);
if (seg->area_count > 1)
outsize(f, (uint64_t) seg->stripe_size,
9 years, 8 months
master - cache: use get_cache_mode for validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f5d6c4b0f3527b...
Commit: f5d6c4b0f3527b42ff3e7ef7a68010c3540d6f41
Parent: 8f9f18013948f696bffaddb612d55a94f6279c9c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 15:12:21 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:16:45 2014 +0200
cache: use get_cache_mode for validation
Use a single function to validate cache mode arg
and set DM_ feature flags.
---
lib/cache_segtype/cache.c | 6 +-----
lib/metadata/cache_manip.c | 14 ++++++++++++++
lib/metadata/metadata-exported.h | 1 +
tools/lvconvert.c | 13 +++----------
tools/lvcreate.c | 14 +++-----------
5 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 0e49530..ddaf3cf 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -74,11 +74,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
if (dm_config_has_node(sn, "cache_mode")) {
if (!(str = dm_config_find_str(sn, "cache_mode", NULL)))
return SEG_LOG_ERROR("cache_mode must be a string in");
- if (!strcmp(str, "writethrough"))
- seg->feature_flags |= DM_CACHE_FEATURE_WRITETHROUGH;
- else if (!strcmp(str, "writeback"))
- seg->feature_flags |= DM_CACHE_FEATURE_WRITEBACK;
- else
+ if (!get_cache_mode(str, &seg->feature_flags))
return SEG_LOG_ERROR("Unknown cache_mode in");
}
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index e220dd9..8a5e5e3 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -299,3 +299,17 @@ int lv_cache_remove(struct logical_volume *cache_lv)
return 1;
}
+
+int get_cache_mode(const char *str, uint32_t *flags)
+{
+ if (!strcmp(str, "writethrough"))
+ *flags |= DM_CACHE_FEATURE_WRITETHROUGH;
+ else if (!strcmp(str, "writeback"))
+ *flags |= DM_CACHE_FEATURE_WRITEBACK;
+ else {
+ log_error("Cache pool cachemode \"%s\" is unknown.", str);
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index f2521db..2b06718 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1050,6 +1050,7 @@ int update_cache_pool_params(struct volume_group *vg, unsigned attr,
struct logical_volume *lv_cache_create(struct logical_volume *pool,
struct logical_volume *origin);
int lv_cache_remove(struct logical_volume *cache_lv);
+int get_cache_mode(const char *str, uint32_t *flags);
/* -- metadata/cache_manip.c */
struct cmd_vg *cmd_vg_add(struct dm_pool *mem, struct dm_list *cmd_vgs,
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e128b81..eef408a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -289,16 +289,9 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
}
if (cachepool) {
- if ((tmp_str = arg_str_value(cmd, cachemode_ARG, NULL))) {
- if (!strcmp(tmp_str, "writeback"))
- lp->feature_flags |= DM_CACHE_FEATURE_WRITEBACK;
- else if (!strcmp(tmp_str, "writethrough"))
- lp->feature_flags |= DM_CACHE_FEATURE_WRITETHROUGH;
- else {
- log_error("Unknown cachemode argument");
- return 0;
- }
- }
+ if ((tmp_str = arg_str_value(cmd, cachemode_ARG, NULL)) &&
+ !get_cache_mode(tmp_str, &lp->feature_flags))
+ return_0;
} else {
if (!arg_is_any_set(cmd, "is valid only with cache pools",
cachemode_ARG, -1))
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 8e45cc1..e9a170c 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -713,17 +713,9 @@ static int _read_cache_pool_params(struct lvcreate_params *lp,
lp->chunk_size = arg_uint_value(cmd, chunksize_ARG,
DEFAULT_CACHE_POOL_CHUNK_SIZE * 2);
- str_arg = arg_str_value(cmd, cachemode_ARG, NULL);
- if (str_arg) {
- if (!strcmp(str_arg, "writeback"))
- lp->feature_flags |= DM_CACHE_FEATURE_WRITEBACK;
- else if (!strcmp(str_arg, "writethrough"))
- lp->feature_flags |= DM_CACHE_FEATURE_WRITETHROUGH;
- else {
- log_error("Unknown cachemode argument");
- return 0;
- }
- }
+ if ((str_arg = arg_str_value(cmd, cachemode_ARG, NULL)) &&
+ !get_cache_mode(str_arg, &lp->feature_flags))
+ return_0;
return 1;
}
9 years, 8 months
master - lvconvert: improve merge validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8f9f18013948f6...
Commit: 8f9f18013948f696bffaddb612d55a94f6279c9c
Parent: 7abad9ef88a9c47e302a454fe15d0c9989bf89a0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 15:38:13 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:16:00 2014 +0200
lvconvert: improve merge validation
Easier check for conflicting options with --merge.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 15 ++++++---------
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9b498b0..956b07b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Improve lvconvert --merge validation.
Improve lvconvert --splitsnapshot validation.
Add report/list_item_separator lvm.conf option.
Add lv_active_{locally,remotely,exclusively} LV reporting fields.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0f58677..e128b81 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -523,15 +523,12 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
/* There are six types of lvconvert. */
if (lp->merge) { /* Snapshot merge */
- if (arg_count(cmd, regionsize_ARG) || arg_count(cmd, chunksize_ARG) ||
- arg_count(cmd, zero_ARG) || arg_count(cmd, regionsize_ARG) ||
- arg_count(cmd, poolmetadata_ARG) || arg_count(cmd, poolmetadatasize_ARG) ||
- arg_count(cmd, readahead_ARG) ||
- arg_count(cmd, stripes_long_ARG) || arg_count(cmd, stripesize_ARG)) {
- log_error("Only --background and --interval are valid "
- "arguments for snapshot merge");
- return 0;
- }
+ if (!arg_is_only_set(cmd, "cannot be used with --merge",
+ merge_ARG,
+ background_ARG, interval_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
+ return_0;
if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot")))
return_0;
9 years, 8 months
master - lvconvert: improve splitsnapshot test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7abad9ef88a9c4...
Commit: 7abad9ef88a9c47e302a454fe15d0c9989bf89a0
Parent: 4dcacbe369346e957398fd4951fc1a6d1fd4560f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 15:36:07 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:15:30 2014 +0200
lvconvert: improve splitsnapshot test
Easier check for conflicting options with --splitsnapshot.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 23 +++++++----------------
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index db78347..9b498b0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Improve lvconvert --splitsnapshot validation.
Add report/list_item_separator lvm.conf option.
Add lv_active_{locally,remotely,exclusively} LV reporting fields.
Comment out devices/{preferred_names,filter} in default lvm.conf file.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6ec7fa5..0f58677 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -406,8 +406,14 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
- if (arg_count(cmd, splitsnapshot_ARG))
+ if (arg_is_set(cmd, splitsnapshot_ARG)) {
+ if (!arg_is_only_set(cmd, "cannot be used with --splitsnapshot",
+ splitsnapshot_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
+ return_0;
lp->splitsnapshot = 1;
+ }
if ((_snapshot_type_requested(cmd, type_str) || arg_count(cmd, merge_ARG)) &&
(arg_count(cmd, mirrorlog_ARG) || _mirror_or_raid_type_requested(cmd, type_str) ||
@@ -513,21 +519,6 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, SIGN_NONE);
}
- if (lp->splitsnapshot &&
- (lp->snapshot || lp->thin || lp->merge || lp->merge_mirror || arg_count(cmd, thinpool_ARG) ||
- arg_count(cmd, mirrors_ARG) || arg_count(cmd, repair_ARG) || arg_count(cmd, replace_ARG) ||
- arg_count(cmd, chunksize_ARG) || arg_count(cmd, zero_ARG) || arg_count(cmd, regionsize_ARG) ||
- arg_count(cmd, poolmetadata_ARG) || arg_count(cmd, poolmetadatasize_ARG) ||
- arg_count(cmd, readahead_ARG) || arg_count(cmd, stripes_long_ARG) ||
- arg_count(cmd, stripesize_ARG) || arg_count(cmd, background_ARG) ||
- arg_count(cmd, interval_ARG) || arg_count(cmd, type_ARG) || arg_count(cmd, alloc_ARG) ||
- arg_count(cmd, corelog_ARG) || arg_count(cmd, mirrorlog_ARG) ||
- arg_count(cmd, splitmirrors_ARG) || arg_count(cmd, originname_ARG) ||
- arg_count(cmd, trackchanges_ARG) || arg_count(cmd, use_policies_ARG))) {
- log_error("Incompatible arguments supplied with --splitsnapshot.");
- return 0;
- }
-
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT);
/* There are six types of lvconvert. */
9 years, 8 months
master - lvconvert: move to single name validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4dcacbe369346e...
Commit: 4dcacbe369346e957398fd4951fc1a6d1fd4560f
Parent: 04acf7a8d0713c858df893584401e96100f9d9d5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 17 12:19:48 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 17 16:14:36 2014 +0200
lvconvert: move to single name validation
Validate all LV names in _lvconvert_name_params().
---
tools/lvconvert.c | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 8370b49..6ec7fa5 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -146,6 +146,9 @@ static int _lvconvert_name_params(struct lvconvert_params *lp,
if (!_lvconvert_vg_name(lp, cmd, &lp->origin_lv_name))
return_0;
+ if (!_lvconvert_vg_name(lp, cmd, &lp->lv_split_name))
+ return_0;
+
if (strchr(lp->lv_name_full, '/') &&
(vg_name = extract_vgname(cmd, lp->lv_name_full)) &&
lp->vg_name && strcmp(vg_name, lp->vg_name)) {
@@ -483,21 +486,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
- lp->lv_split_name = arg_value(cmd, name_ARG);
- if (lp->lv_split_name) {
- if (strchr(lp->lv_split_name, '/')) {
- if (!(lp->vg_name = extract_vgname(cmd, lp->lv_split_name)))
- return_0;
-
- /* Strip VG from lv_split_name */
- if ((tmp_str = strrchr(lp->lv_split_name, '/')))
- lp->lv_split_name = tmp_str + 1;
- }
-
- if (!apply_lvname_restrictions(lp->lv_split_name))
- return_0;
- }
-
+ lp->lv_split_name = arg_str_value(cmd, name_ARG, NULL);
lp->keep_mimages = 1;
lp->mirrors = arg_uint_value(cmd, splitmirrors_ARG, 0);
lp->mirrors_sign = SIGN_MINUS;
9 years, 8 months