master - lvmetad: Fix autoactivation for MDA-less PVs.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=789a45d6d7567c...
Commit: 789a45d6d7567c467250db661b937422e03f491d
Parent: cad22be3942809bac979d42195ea5a861a91a71f
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Dec 12 12:51:28 2012 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Dec 12 13:06:26 2012 +0100
lvmetad: Fix autoactivation for MDA-less PVs.
---
lib/cache/lvmetad.c | 12 +++------
lib/cache/lvmetad.h | 3 +-
test/shell/lvmetad-pvscan-nomda.sh | 49 ++++++++++++++++++++++++++++++++++++
tools/pvscan.c | 22 ++++++++++++++-
4 files changed, 75 insertions(+), 11 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index e5c5f51..a636f43 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -675,7 +675,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
daemon_reply reply;
struct lvmcache_info *info;
struct dm_config_tree *pvmeta, *vgmeta;
- const char *status;
+ const char *status, *vgid;
int result;
if (!lvmetad_active() || test_mode())
@@ -724,11 +724,6 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
NULL);
dm_config_destroy(vgmeta);
} else {
- if (handler) {
- log_error(INTERNAL_ERROR "Handler needs existing VG.");
- dm_config_destroy(pvmeta);
- return 0;
- }
/* There are no MDAs on this PV. */
reply = _lvmetad_send("pv_found", "pvmeta = %t", pvmeta, NULL);
}
@@ -744,10 +739,11 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
if (result && handler) {
status = daemon_reply_str(reply, "status", "<missing>");
+ vgid = daemon_reply_str(reply, "vgid", "<missing>");
if (!strcmp(status, "partial"))
- handler(vg, 1, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgid, 1, CHANGE_AAY);
else if (!strcmp(status, "complete"))
- handler(vg, 0, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgid, 0, CHANGE_AAY);
else if (!strcmp(status, "orphan"))
;
else
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index 5f0f552..c644069 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -22,7 +22,8 @@ struct cmd_context;
struct dm_config_tree;
enum activation_change;
-typedef int (*activation_handler) (struct volume_group *vg, int partial,
+typedef int (*activation_handler) (struct cmd_context *cmd,
+ const char *vgid, int partial,
enum activation_change activate);
#ifdef LVMETAD_SUPPORT
diff --git a/test/shell/lvmetad-pvscan-nomda.sh b/test/shell/lvmetad-pvscan-nomda.sh
new file mode 100644
index 0000000..c04a275
--- /dev/null
+++ b/test/shell/lvmetad-pvscan-nomda.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+test -e LOCAL_LVMETAD || skip
+kill $(cat LOCAL_LVMETAD)
+rm LOCAL_LVMETAD
+
+aux prepare_devs 2
+
+pvcreate --metadatacopies 0 $dev1
+pvcreate --metadatacopies 1 $dev2
+vgcreate $vg1 $dev1 $dev2
+lvcreate -n foo -l 1 -an --zero n $vg1
+
+# start lvmetad but make sure it doesn't know about $dev1 or $dev2
+aux disable_dev $dev1
+aux disable_dev $dev2
+aux prepare_lvmetad
+lvs
+mv LOCAL_LVMETAD XXX
+aux enable_dev $dev2
+aux enable_dev $dev1
+mv XXX LOCAL_LVMETAD
+
+aux lvmconf 'global/use_lvmetad = 0'
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache $dev2 -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache $dev1 -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+check active $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 34ab792..81849f5 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -91,18 +91,36 @@ static void _pvscan_display_single(struct cmd_context *cmd,
display_size(cmd, (uint64_t) (pv_pe_count(pv) - pv_pe_alloc_count(pv)) * pv_pe_size(pv)));
}
-static int _auto_activation_handler(struct volume_group *vg, int partial,
+static int _auto_activation_handler(struct cmd_context *cmd,
+ const char *vgid, int partial,
activation_change_t activate)
{
+ struct volume_group *vg;
+ int consistent = 0;
+ struct id vgid_raw;
+
/* TODO: add support for partial and clustered VGs */
- if (partial || vg_is_clustered(vg))
+ if (partial)
return 1;
+ id_read_format(&vgid_raw, vgid);
+ /* NB. This is safe because we know lvmetad is running and we won't hit
+ * disk. */
+ if (!(vg = vg_read_internal(cmd, NULL, &vgid_raw, 0, &consistent)))
+ return 1;
+
+ if (vg_is_clustered(vg)) {
+ release_vg(vg);
+ return 1;
+ }
+
if (!vgchange_activate(vg->cmd, vg, activate)) {
log_error("%s: autoactivation failed.", vg->name);
+ release_vg(vg);
return 0;
}
+ release_vg(vg);
return 1;
}
11 years, 4 months
master - lvconvert: allow lvconvert --stripes/stripesize only with -mirrors/--repair/--thinpool
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cad22be3942809...
Commit: cad22be3942809bac979d42195ea5a861a91a71f
Parent: b38ba2708346b52a48be5596b22b3ad4f1304af1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Dec 11 15:50:25 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Dec 11 15:50:25 2012 +0100
lvconvert: allow lvconvert --stripes/stripesize only with -mirrors/--repair/--thinpool
Also, update lvconvert man page to reflect this and make clear that
the --stripes/stripesize is applied to newly allocated space only.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 7 ++++++-
tools/lvconvert.c | 8 ++++++++
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a9aa152..dbd59bf 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Allow lvconvert --stripes/stripesize only with --mirrors/--repair/--thinpool.
Fix memleak in device_is_usable mirror testing function.
Do not ignore -f in lvconvert --repair -y -f for mirror and raid volumes.
Disallow pvmove on RAID LVs until they are addressed properly
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 4fe9bdd..578047b 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -61,6 +61,10 @@ lvconvert \- convert a logical volume from linear to mirror or snapshot
.sp
.B lvconvert \-\-repair
.RB [ \-h | \-? | \-\-help ]
+.RB [ \-\-stripes
+.I Stripes
+.RB [ \-I | \-\-stripesize
+.IR StripeSize ]]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
.IR LogicalVolume [ Path ]
@@ -274,7 +278,8 @@ This option is only available to RAID segment types
.BR \-\-stripes " " \fIStripes
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
-the logical volume.
+the logical volume. This does not apply to existing allocated
+space, only newly allocated space can be striped.
.TP
.BR \-I ", " \-\-stripesize " " \fIStripeSize
Gives the number of kilobytes for the granularity of the stripes.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2d51069..9c947d7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -167,6 +167,14 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
+ if ((arg_count(cmd, stripes_long_ARG) || arg_count(cmd, stripesize_ARG)) &&
+ !(arg_count(cmd, mirrors_ARG) || arg_count(cmd, repair_ARG) ||
+ arg_count(cmd, thinpool_ARG))) {
+ log_error("--stripes or --stripesize argument is only valid "
+ "with --mirrors, --repair or --thinpool");
+ return 0;
+ }
+
if (!arg_count(cmd, background_ARG))
lp->wait_completion = 1;
11 years, 4 months
master - test: update thin discards testing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b38ba2708346b5...
Commit: b38ba2708346b52a48be5596b22b3ad4f1304af1
Parent: ff5c1c576c9f0162e9d82becfe30b100fc601c88
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Dec 10 10:51:25 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 11 12:05:48 2012 +0100
test: update thin discards testing
Reflect fixed disards behavior.
---
test/shell/lvcreate-thin-power2.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvcreate-thin-power2.sh b/test/shell/lvcreate-thin-power2.sh
index 882b05c..e1effa4 100644
--- a/test/shell/lvcreate-thin-power2.sh
+++ b/test/shell/lvcreate-thin-power2.sh
@@ -27,11 +27,12 @@ vgcreate $vg -s 64K $(cat DEVICES)
# create non-power-of-2 pool
lvcreate -l100 -c 192 -T $vg/pool
-check lv_field $vg/pool discards "ignore"
+check lv_field $vg/pool discards "passdown"
# check we cannot change discards settings
-not lvchange --discard passdown $vg/pool
-not lvchange --discard nopassdown $vg/pool
+not lvchange --discard ignore $vg/pool
+lvchange --discard nopassdown $vg/pool
+check lv_field $vg/pool discards "nopassdown"
# must be multiple of 64KB
not lvcreate -l100 -c 168 -T $vg/pool1
11 years, 4 months
master - lvmetad: use dm_config_destroy to free pvmeta
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ff5c1c576c9f01...
Commit: ff5c1c576c9f0162e9d82becfe30b100fc601c88
Parent: 17be6d521008f4433dc4dc76464af9f993491745
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon Dec 10 14:24:55 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 11 11:55:12 2012 +0100
lvmetad: use dm_config_destroy to free pvmeta
Release pvmeta handler with proper dm_config_destroy() function.
TODO: Fix primary fault for this internal error.
Signed-off-by: mcsontos(a)redhat.com
---
lib/cache/lvmetad.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 72e07fd..e5c5f51 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -726,7 +726,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
} else {
if (handler) {
log_error(INTERNAL_ERROR "Handler needs existing VG.");
- dm_free(pvmeta);
+ dm_config_destroy(pvmeta);
return 0;
}
/* There are no MDAs on this PV. */
11 years, 4 months
master - thin: fix test for dicards ignore settings
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17be6d521008f4...
Commit: 17be6d521008f4433dc4dc76464af9f993491745
Parent: ed65860861edcb5cd41656b05833defef5d592d0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Dec 10 10:22:48 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 11 11:26:19 2012 +0100
thin: fix test for dicards ignore settings
Arghh, this was bad last-minute shortening of if() expression
in the commit 1ef98310187a7.
dm_tree_node_set_thin_pool_discard() must not run in the same
expression as check for non-power-2 discard, otherwise
there are 2 calls for dm_tree_node_set_thin_pool_discard
and whole setting of discards is missinterpretted.
In-relase fix it by using proper parentheses {}.
---
lib/thin/thin.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index d7c45ca..14eb096 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -289,11 +289,11 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
/* FIXME: Check whether underlying dev supports discards */
if (((!(attr & THIN_FEATURE_DISCARDS_NON_POWER_2) &&
(seg->chunk_size & (seg->chunk_size - 1))) ||
- (seg->discards == THIN_DISCARDS_IGNORE)) &&
- !dm_tree_node_set_thin_pool_discard(node, 1, 0))
- return_0;
- else if (!dm_tree_node_set_thin_pool_discard(node, 0,
- (seg->discards == THIN_DISCARDS_NO_PASSDOWN)))
+ (seg->discards == THIN_DISCARDS_IGNORE))) {
+ if (!dm_tree_node_set_thin_pool_discard(node, 1, 0))
+ return_0;
+ } else if (!dm_tree_node_set_thin_pool_discard(node, 0,
+ (seg->discards == THIN_DISCARDS_NO_PASSDOWN)))
return_0;
} else if (seg->discards != THIN_DISCARDS_IGNORE)
log_warn_suppress(_no_discards++, "WARNING: Thin pool target does "
11 years, 4 months
master - thin: remove detection for thin discard support
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ed65860861edcb...
Commit: ed65860861edcb5cd41656b05833defef5d592d0
Parent: ec49f07b0dc89720f4a74a1212e106990099d2d6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Dec 10 10:22:16 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 11 11:24:45 2012 +0100
thin: remove detection for thin discard support
Remove no longer needed warning for unsuppoted discards
for non-power-2 lvcreate commands.
(Missed from the patch for the same update in lvchange made
by commit dde5a6c52b315d7b)
---
tools/toollib.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 4c9a43d..817580f 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1596,10 +1596,6 @@ int update_pool_params(struct cmd_context *cmd, unsigned attr,
log_error("Chunk size must be multiple of %s.",
display_size(cmd, DM_THIN_MIN_DATA_BLOCK_SIZE));
return 0;
- } else if ((*discards != THIN_DISCARDS_IGNORE) &&
- (*chunk_size & (*chunk_size - 1))) {
- log_warn("WARNING: Using discards ignore for chunk size non power of 2.");
- *discards = THIN_DISCARDS_IGNORE;
}
if (!*pool_metadata_size) {
11 years, 4 months
master - mirrors: fix leak in device_is_usable mirror check
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec49f07b0dc897...
Commit: ec49f07b0dc89720f4a74a1212e106990099d2d6
Parent: f942ae4a7af0f9b93c6a6aacb1793ee22f87ed13
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Dec 6 23:37:21 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 11 11:15:22 2012 +0100
mirrors: fix leak in device_is_usable mirror check
Function _ignore_blocked_mirror_devices was not release
allocated strings images_health and log_health.
In error paths it was also not releasing dm_task structure.
Swaped return code of _ignore_blocked_mirror_devices and
use 1 as success.
In _parse_mirror_status use log_error if memory allocation
fails and few more errors so they are no going unnoticed
as debug messages.
On error path always clear return values and free strings.
For dev_create_file use cache mem pool to avoid memleak.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 60 ++++++++++++++++++++++++++++++--------------
2 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2fa5e56..a9aa152 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix memleak in device_is_usable mirror testing function.
Do not ignore -f in lvconvert --repair -y -f for mirror and raid volumes.
Disallow pvmove on RAID LVs until they are addressed properly
Allow empty activation/{auto_activation|read_only|}_volume_list config option.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 40f719e..3f74c2d 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -158,6 +158,10 @@ static int _parse_mirror_status(char *mirror_status_str,
char **args, **log_args;
unsigned num_devs, log_argc;
+ *images_health = NULL;
+ *log_health = NULL;
+ *log_dev = 0;
+
if (!dm_split_words(mirror_status_str, 1, 0, &p) ||
!(num_devs = (unsigned) atoi(p)))
/* On errors, we must assume the mirror is to be avoided */
@@ -176,19 +180,31 @@ static int _parse_mirror_status(char *mirror_status_str,
log_argc, 0, log_args) < log_argc)
return_0;
- *log_health = NULL;
- *log_dev = 0;
if (!strcmp(log_args[0], "disk")) {
- if (!(*log_health = dm_strdup(log_args[2])))
- return_0;
- if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2)
- return_0;
+ if (!(*log_health = dm_strdup(log_args[2]))) {
+ log_error("Allocation of log string failed.");
+ return 0;
+ }
+ if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2) {
+ log_error("Parsing of log's major minor failed.");
+ goto out;
+ }
*log_dev = MKDEV((dev_t)major, minor);
}
- if (!(*images_health = dm_strdup(args[2 + num_devs])))
- return_0;
+
+ if (!(*images_health = dm_strdup(args[2 + num_devs]))) {
+ log_error("Allocation of images string failed.");
+ goto out;
+ }
return 1;
+
+out:
+ dm_free(*log_health);
+ *log_health = NULL;
+ *log_dev = 0;
+
+ return 0;
}
/*
@@ -227,11 +243,12 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
uint64_t s,l;
char *params, *target_type = NULL;
void *next = NULL;
- struct dm_task *dmt;
+ struct dm_task *dmt = NULL;
+ int r = 0;
if (!_parse_mirror_status(mirror_status_str,
&images_health, &log_dev, &log_health))
- goto_out;
+ return_0;
for (i = 0; images_health[i]; i++)
if (images_health[i] != 'A') {
@@ -254,7 +271,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
(int)MINOR(log_dev)) < 0)
goto_out;
- if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 1)))
+ if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 0)))
goto_out;
tmp_dev->dev = log_dev;
@@ -263,8 +280,10 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
}
}
- if (!check_for_blocking)
- return 0;
+ if (!check_for_blocking) {
+ r = 1;
+ goto out;
+ }
/*
* We avoid another system call if we can, but if a device is
@@ -293,16 +312,19 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
strstr(params, "handle_errors")) {
log_debug("%s: I/O blocked to mirror device",
dev_name(dev));
- return 1;
+ goto out;
}
}
} while (next);
- dm_task_destroy(dmt);
-
- return 0;
+ r = 1;
out:
- return 1;
+ if (dmt)
+ dm_task_destroy(dmt);
+ dm_free(log_health);
+ dm_free(images_health);
+
+ return r;
}
int device_is_usable(struct device *dev)
@@ -356,7 +378,7 @@ int device_is_usable(struct device *dev)
&target_type, ¶ms);
if (target_type && !strcmp(target_type, "mirror") &&
- _ignore_blocked_mirror_devices(dev, start, length, params)) {
+ !_ignore_blocked_mirror_devices(dev, start, length, params)) {
log_debug("%s: Mirror device %s not usable.",
dev_name(dev), name);
goto out;
11 years, 4 months
master - lvconvert: do not ignore -f in lvconvert --repair -y -f
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f942ae4a7af0f9...
Commit: f942ae4a7af0f9b93c6a6aacb1793ee22f87ed13
Parent: 1ec6a59dcf2c1c2788d12bd4374c6dbb5cfb8e36
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Dec 11 09:52:54 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Dec 11 09:52:54 2012 +0100
lvconvert: do not ignore -f in lvconvert --repair -y -f
---
WHATS_NEW | 1 +
tools/lvconvert.c | 24 +++++++++++++-----------
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b5b774f..2fa5e56 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Do not ignore -f in lvconvert --repair -y -f for mirror and raid volumes.
Disallow pvmove on RAID LVs until they are addressed properly
Allow empty activation/{auto_activation|read_only|}_volume_list config option.
Add lvm.conf option global/thin_disabled_features.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d0429d8..2d51069 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -806,14 +806,14 @@ static void _lvconvert_mirrors_repair_ask(struct cmd_context *cmd,
return;
}
- if (yes)
- return;
-
if (force != PROMPT) {
*replace_log = *replace_mirrors = 0;
return;
}
+ if (yes)
+ return;
+
if (failed_log &&
yes_no_prompt("Attempt to replace failed mirror log? [y/n]: ") == 'n') {
*replace_log = 0;
@@ -1523,29 +1523,31 @@ static void _lvconvert_raid_repair_ask(struct cmd_context *cmd, int *replace_dev
int force = arg_count(cmd, force_ARG);
int yes = arg_count(cmd, yes_ARG);
- *replace_dev = 0;
+ *replace_dev = 1;
if (arg_count(cmd, use_policies_ARG)) {
dev_policy = find_config_tree_str(cmd, "activation/raid_fault_policy", DEFAULT_RAID_FAULT_POLICY);
if (!strcmp(dev_policy, "allocate") ||
!strcmp(dev_policy, "replace"))
- *replace_dev = 1;
- /* else if (!strcmp(dev_policy, "anything_else")) -- ignore */
+ return;
+
+ /* else if (!strcmp(dev_policy, "anything_else")) -- no replace */
+ *replace_dev = 0;
return;
}
- if (yes) {
- *replace_dev = 1;
+ if (force != PROMPT) {
+ *replace_dev = 0;
return;
}
- if (force != PROMPT)
+ if (yes)
return;
if (yes_no_prompt("Attempt to replace failed RAID images "
- "(requires full device resync)? [y/n]: ") == 'y') {
- *replace_dev = 1;
+ "(requires full device resync)? [y/n]: ") == 'n') {
+ *replace_dev = 0;
}
}
11 years, 4 months
master - Fix Py_BuildValue for i386
by Andy Grover
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1ec6a59dcf2c1c...
Commit: 1ec6a59dcf2c1c2788d12bd4374c6dbb5cfb8e36
Parent: 383575525916d4cafb1c8396c95a40be539d1451
Author: James Antill <james.antill(a)redhat.com>
AuthorDate: Wed Dec 5 16:31:30 2012 -0800
Committer: Andy Grover <agrover(a)redhat.com>
CommitterDate: Wed Dec 5 16:31:50 2012 -0800
Fix Py_BuildValue for i386
see https://bugzilla.redhat.com/show_bug.cgi?id=881989
Signed-off-by: James Antill <james.antill(a)redhat.com>
Signed-off-by: Andy Grover <agrover(a)redhat.com>
---
python/liblvm.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index 831493e..6ccc5ba 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -564,7 +564,7 @@ liblvm_lvm_vg_get_seqno(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_seqno(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_seqno(self->vg));
}
static PyObject *
@@ -572,7 +572,7 @@ liblvm_lvm_vg_get_size(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_size(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_size(self->vg));
}
static PyObject *
@@ -580,7 +580,7 @@ liblvm_lvm_vg_get_free_size(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_free_size(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_free_size(self->vg));
}
static PyObject *
@@ -588,7 +588,7 @@ liblvm_lvm_vg_get_extent_size(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_extent_size(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_extent_size(self->vg));
}
static PyObject *
@@ -596,7 +596,7 @@ liblvm_lvm_vg_get_extent_count(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_extent_count(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_extent_count(self->vg));
}
static PyObject *
@@ -604,7 +604,7 @@ liblvm_lvm_vg_get_free_extent_count(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_free_extent_count(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_free_extent_count(self->vg));
}
/* Builds a python tuple ([string|number], bool) from a struct lvm_property_value */
@@ -755,7 +755,7 @@ liblvm_lvm_vg_get_pv_count(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_pv_count(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_pv_count(self->vg));
}
static PyObject *
@@ -763,7 +763,7 @@ liblvm_lvm_vg_get_max_pv(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_max_pv(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_max_pv(self->vg));
}
static PyObject *
@@ -771,7 +771,7 @@ liblvm_lvm_vg_get_max_lv(vgobject *self)
{
VG_VALID(self);
- return Py_BuildValue("l", lvm_vg_get_max_lv(self->vg));
+ return Py_BuildValue("K", (unsigned long long)lvm_vg_get_max_lv(self->vg));
}
static PyObject *
@@ -1133,7 +1133,7 @@ liblvm_lvm_lv_get_size(lvobject *self)
{
LV_VALID(self);
- return Py_BuildValue("l", lvm_lv_get_size(self->lv));
+ return Py_BuildValue("K", (unsigned long long)lvm_lv_get_size(self->lv));
}
static PyObject *
@@ -1344,7 +1344,7 @@ liblvm_lvm_pv_get_mda_count(pvobject *self)
{
PV_VALID(self);
- return Py_BuildValue("l", lvm_pv_get_mda_count(self->pv));
+ return Py_BuildValue("K", (unsigned long long)lvm_pv_get_mda_count(self->pv));
}
static PyObject *
@@ -1367,7 +1367,7 @@ liblvm_lvm_pv_get_dev_size(pvobject *self)
{
PV_VALID(self);
- return Py_BuildValue("l", lvm_pv_get_dev_size(self->pv));
+ return Py_BuildValue("K", (unsigned long long)lvm_pv_get_dev_size(self->pv));
}
static PyObject *
@@ -1375,7 +1375,7 @@ liblvm_lvm_pv_get_size(pvobject *self)
{
PV_VALID(self);
- return Py_BuildValue("l", lvm_pv_get_size(self->pv));
+ return Py_BuildValue("K", (unsigned long long)lvm_pv_get_size(self->pv));
}
static PyObject *
@@ -1383,7 +1383,7 @@ liblvm_lvm_pv_get_free(pvobject *self)
{
PV_VALID(self);
- return Py_BuildValue("l", lvm_pv_get_free(self->pv));
+ return Py_BuildValue("K", (unsigned long long)lvm_pv_get_free(self->pv));
}
static PyObject *
11 years, 4 months
master - pvmove/RAID: Disallow pvmove on RAID LVs until properly handled
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=383575525916d4...
Commit: 383575525916d4cafb1c8396c95a40be539d1451
Parent: 35a4d70aad02f297d81909ff7c65a032c5e0dbf2
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Dec 4 17:47:47 2012 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Dec 4 17:47:47 2012 -0600
pvmove/RAID: Disallow pvmove on RAID LVs until properly handled
Attempting pvmove on RAID LVs replaces the kernel RAID target with
a temporary pvmove target, ultimately destroying the RAID LV. pvmove
must be prevented on RAID LVs for now.
Use 'lvconvert --replace old_pv vg/lv new_pv' if you want to move
an image of the RAID LV.
---
WHATS_NEW | 1 +
tools/pvmove.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 519d4dd..b5b774f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Disallow pvmove on RAID LVs until they are addressed properly
Allow empty activation/{auto_activation|read_only|}_volume_list config option.
Add lvm.conf option global/thin_disabled_features.
Add lvconvert support to swap thin pool metadata volume.
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 9649f11..fcc5b31 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -179,6 +179,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
unsigned *exclusive)
{
struct logical_volume *lv_mirr, *lv;
+ struct lv_segment *seg;
struct lv_list *lvl;
uint32_t log_count = 0;
int lv_found = 0;
@@ -206,6 +207,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
/* Find segments to be moved and set up mirrors */
dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
+ seg = first_seg(lv);
if (lv == lv_mirr)
continue;
if (lv_name) {
@@ -218,6 +220,19 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
log_print_unless_silent("Skipping snapshot-related LV %s", lv->name);
continue;
}
+ if (seg_is_raid(seg)) {
+ lv_skipped = 1;
+ log_print_unless_silent("Skipping %s LV %s",
+ seg->segtype->ops->name(seg),
+ lv->name);
+ continue;
+ }
+ if (lv_is_raid_type(lv)) {
+ lv_skipped = 1;
+ log_print_unless_silent("Skipping RAID sub-LV %s",
+ lv->name);
+ continue;
+ }
if (lv->status & MIRRORED) {
lv_skipped = 1;
log_print_unless_silent("Skipping mirror LV %s", lv->name);
11 years, 4 months