master - fix running commands from a script file
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=54726a4950756b8f0c3...
Commit: 54726a4950756b8f0c3e19c4c7d5feb6fb838e00
Parent: c73b9f062c8ed59dc0bfa859cab4a692295a56cb
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 28 16:43:42 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 28 16:51:04 2017 -0500
fix running commands from a script file
Using any arg with a command name in a script file
would cause the command to fail.
The name of the script file being executed was being passed
to lvm_register_commands() and define_commands(), which
prevented command defs from being defined (simple commands
were still being defined only by name which was enough for those
to still work when run trivially with no args).
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2db7dc4..846e998 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.171 -
==================================
+ Fix running commands from a script file.
Add pvcreate prompt when device size doesn't match setphysicalvolumesize.
lvconvert - preserve region size on raid1 image count changes
Adjust pvresize/pvcreate messages and prompt if underlying dev size differs.
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index c0c81ba..29ec06b 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3444,6 +3444,10 @@ int lvm2_main(int argc, char **argv)
goto_out;
}
+ /* Can be the name of a script file. */
+ if (run_name && !find_command_name(run_name))
+ run_name = NULL;
+
if (!lvm_register_commands(run_name)) {
ret = ECMD_FAILED;
goto out;
6 years, 5 months
master - WHATS_NEW: pvcreate prompt
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c73b9f062c8ed59dc0b...
Commit: c73b9f062c8ed59dc0bfa859cab4a692295a56cb
Parent: 1764524b063b226aa715d17a22ed271add514538
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 28 09:06:41 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 28 09:06:41 2017 -0500
WHATS_NEW: pvcreate prompt
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ec5df1..2db7dc4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.171 -
==================================
+ Add pvcreate prompt when device size doesn't match setphysicalvolumesize.
lvconvert - preserve region size on raid1 image count changes
Adjust pvresize/pvcreate messages and prompt if underlying dev size differs.
raid - sanely handle insufficient space on takeover.
6 years, 5 months
master - WHATS_NEW: pvcreate --setphysicalvolumesize
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1764524b063b226aa71...
Commit: 1764524b063b226aa715d17a22ed271add514538
Parent: 86b9c23dbe4a5033eea6667c0274655e7c0c8e68
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 28 14:34:26 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 28 14:34:26 2017 +0100
WHATS_NEW: pvcreate --setphysicalvolumesize
---
WHATS_NEW | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c746bac..6ec5df1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,7 +1,7 @@
Version 2.02.171 -
==================================
lvconvert - preserve region size on raid1 image count changes
- Adjust pvresize messages and add prompt if underlying dev size differs.
+ Adjust pvresize/pvcreate messages and prompt if underlying dev size differs.
raid - sanely handle insufficient space on takeover.
Fix configure --enable-notify-dbus status message.
Change configure option name prefix from --enable-lockd to --enable-lvmlockd.
6 years, 5 months
master - commands: improve syntax suggestion when no command is found
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=86b9c23dbe4a5033eea...
Commit: 86b9c23dbe4a5033eea6667c0274655e7c0c8e68
Parent: 4f9ff14508084789c731e99d8921c052da694319
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 27 14:21:01 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 27 14:21:01 2017 -0500
commands: improve syntax suggestion when no command is found
The logic for suggesting the nearest valid command syntax
was missing the simplest case. If a command has only one
valid syntax, that is the one we should suggest. (We were
suggesting nothing in this case.)
---
tools/lvmcmdline.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 37e9ef8..c0c81ba 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1516,6 +1516,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
int match_required, match_ro, match_rp, match_type, match_unused, mismatch_required;
int best_i = 0, best_required = 0, best_type = 0, best_unused = 0;
int close_i = 0, close_ro = 0, close_type = 0;
+ int only_i = 0;
int temp_unused_options[MAX_UNUSED_COUNT];
int temp_unused_count;
int best_unused_options[MAX_UNUSED_COUNT] = { 0 };
@@ -1525,12 +1526,23 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
int i, j;
int opt_enum, opt_i;
int accepted, count;
+ int variants = 0;
name = last_path_component(path);
+ /* factor_common_options() is only for usage, so cname->variants is not set. */
for (i = 0; i < COMMAND_COUNT; i++) {
if (strcmp(name, commands[i].name))
continue;
+ variants++;
+ }
+
+ for (i = 0; i < COMMAND_COUNT; i++) {
+ if (strcmp(name, commands[i].name))
+ continue;
+
+ if (variants == 1)
+ only_i = i;
/* For help and version just return the first entry with matching name. */
if (arg_is_set(cmd, help_ARG) || arg_is_set(cmd, help2_ARG) || arg_is_set(cmd, longhelp_ARG) || arg_is_set(cmd, version_ARG))
@@ -1701,7 +1713,11 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
if (!best_required) {
/* cmd did not have all the required opt/pos args of any command */
log_error("No command with matching syntax recognised. Run '%s --help' for more information.", name);
- if (close_ro) {
+
+ if (only_i) {
+ log_warn("Correct command syntax is:");
+ print_usage(&_cmdline.commands[only_i], 0, 0);
+ } else if (close_ro) {
log_warn("Nearest similar command has syntax:");
print_usage(&_cmdline.commands[close_i], 0, 0);
}
6 years, 5 months
master - pvcreate: add prompt when setting dev size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4f9ff14508084789c73...
Commit: 4f9ff14508084789c731e99d8921c052da694319
Parent: 5cf51fb2f74ad43a2555bc391cf069caa1d99775
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 27 12:13:09 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 27 13:25:41 2017 -0500
pvcreate: add prompt when setting dev size
If the device size does not match the size requested
by --setphysicalvolumesize, then prompt the user.
Make the pvcreate checking/prompting code handle
multiple prompts for the same device, since the
new prompt can be in addition to the existing
prompt when the PV is in a VG.
---
test/shell/pv-check-dev-size.sh | 4 +-
test/shell/snapshot-usage.sh | 2 +-
tools/args.h | 2 +-
tools/pvcreate.c | 4 +-
tools/pvresize.c | 4 +-
tools/toollib.c | 133 +++++++++++++++++++++++++++++++--------
6 files changed, 115 insertions(+), 34 deletions(-)
diff --git a/test/shell/pv-check-dev-size.sh b/test/shell/pv-check-dev-size.sh
index d3d1b53..76618ad 100644
--- a/test/shell/pv-check-dev-size.sh
+++ b/test/shell/pv-check-dev-size.sh
@@ -27,7 +27,7 @@ not grep "$CHECK_MSG" err
vgremove -ff $vg
# set PV size to 2x dev size
-pvcreate --setphysicalvolumesize 16m $dev1
+pvcreate --yes --setphysicalvolumesize 16m $dev1
vgcreate $vg $dev1 2>err
grep "$CHECK_MSG" err
pvs 2>err
@@ -36,7 +36,7 @@ vgremove -ff $vg
# should be quiet if requested
aux lvmconf 'metadata/check_pv_device_sizes = 0'
-pvcreate --setphysicalvolumesize 16m $dev1
+pvcreate --yes --setphysicalvolumesize 16m $dev1
vgcreate $vg $dev1 2>err
not grep "$CHECK_MSG" err
pvs 2>err
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index a780664..a751f1a 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -78,7 +78,7 @@ aux lvmconf "activation/snapshot_autoextend_percent = 20" \
"activation/snapshot_autoextend_threshold = 50"
# Check usability with smallest (1k) extent size ($lv has 15P)
-pvcreate --setphysicalvolumesize 4T "$DM_DEV_DIR/$vg/$lv"
+pvcreate --yes --setphysicalvolumesize 4T "$DM_DEV_DIR/$vg/$lv"
trap 'cleanup_tail' EXIT
vgcreate -s 1K $vg1 "$DM_DEV_DIR/$vg/$lv"
diff --git a/tools/args.h b/tools/args.h
index be1711b..87b33e7 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -402,7 +402,7 @@ arg(originname_ARG, '\0', "originname", lv_VAL, 0, 0,
"to a thin LV. The LV being converted becomes a read-only external origin\n"
"with this name.\n")
-arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", sizemb_VAL, 0, 0,
+arg(setphysicalvolumesize_ARG, '\0', "setphysicalvolumesize", sizemb_VAL, 0, 0,
"Overrides the automatically detected size of the PV.\n"
"Use with care, or prior to reducing the physical size of the device.\n")
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index e69eed4..0fe5ad5 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -52,11 +52,11 @@ static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
pp->pva.idp = &pp->pva.id;
}
- if (arg_sign_value(cmd, physicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) {
+ if (arg_sign_value(cmd, setphysicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Physical volume size may not be negative");
return 0;
}
- pp->pva.size = arg_uint64_value(cmd, physicalvolumesize_ARG, UINT64_C(0));
+ pp->pva.size = arg_uint64_value(cmd, setphysicalvolumesize_ARG, UINT64_C(0));
if (arg_is_set(cmd, restorefile_ARG) || arg_is_set(cmd, uuidstr_ARG))
pp->zero = 0;
diff --git a/tools/pvresize.c b/tools/pvresize.c
index 1de1709..8a65952 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -72,13 +72,13 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv)
goto out;
}
- if (arg_sign_value(cmd, physicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) {
+ if (arg_sign_value(cmd, setphysicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Physical volume size may not be negative");
ret = EINVALID_CMD_LINE;
goto out;
}
- params.new_size = arg_uint64_value(cmd, physicalvolumesize_ARG,
+ params.new_size = arg_uint64_value(cmd, setphysicalvolumesize_ARG,
UINT64_C(0));
params.done = 0;
diff --git a/tools/toollib.c b/tools/toollib.c
index 838765b..f3cf4ca 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -4751,6 +4751,7 @@ int pvcreate_params_from_args(struct cmd_context *cmd, struct pvcreate_params *p
enum {
PROMPT_PVCREATE_PV_IN_VG = 1,
PROMPT_PVREMOVE_PV_IN_VG = 2,
+ PROMPT_PVCREATE_DEV_SIZE = 4,
};
enum {
@@ -4767,6 +4768,8 @@ enum {
struct pvcreate_prompt {
struct dm_list list;
uint32_t type;
+ uint64_t size;
+ uint64_t new_size;
const char *pv_name;
const char *vg_name;
struct device *dev;
@@ -4808,12 +4811,14 @@ static void _check_pvcreate_prompt(struct cmd_context *cmd,
{
const char *vgname = prompt->vg_name ? prompt->vg_name : "<unknown>";
const char *pvname = prompt->pv_name;
+ int answer_yes = 0;
+ int answer_no = 0;
/* The VG name can be unknown when the PV is used but metadata is not available */
- if (prompt->type == PROMPT_PVCREATE_PV_IN_VG) {
+ if (prompt->type & PROMPT_PVCREATE_PV_IN_VG) {
if (pp->force != DONT_PROMPT_OVERRIDE) {
- prompt->answer = PROMPT_ANSWER_NO;
+ answer_no = 1;
if (prompt->vg_name_unknown) {
log_error("PV %s is used by a VG but its metadata is missing.", pvname);
@@ -4825,20 +4830,39 @@ static void _check_pvcreate_prompt(struct cmd_context *cmd,
log_error("Unable to add physical volume '%s' to volume group '%s'", pvname, vgname);
}
} else if (pp->yes) {
- prompt->answer = PROMPT_ANSWER_YES;
+ answer_yes = 1;
} else if (ask) {
if (yes_no_prompt("Really INITIALIZE physical volume \"%s\" of volume group \"%s\" [y/n]? ", pvname, vgname) == 'n') {
- prompt->answer = PROMPT_ANSWER_NO;
- log_error("%s: physical volume not initialized", pvname);
+ answer_no = 1;
} else {
- prompt->answer = PROMPT_ANSWER_YES;
+ answer_yes = 1;
log_warn("WARNING: Forcing physical volume creation on %s of volume group \"%s\"", pvname, vgname);
}
}
- } else if (prompt->type == PROMPT_PVREMOVE_PV_IN_VG) {
+ }
+
+ if (prompt->type & PROMPT_PVCREATE_DEV_SIZE) {
+ if (pp->yes) {
+ log_warn("WARNING: Faking size of PV %s. Don't write outside real device.", pvname);
+ answer_yes = 1;
+ } else if (ask) {
+ if (prompt->new_size != prompt->size) {
+ if (yes_no_prompt("WARNING: %s: device size %s does not match requested size %s. Proceed? [y/n]: ", pvname,
+ display_size(cmd, (uint64_t)prompt->size),
+ display_size(cmd, (uint64_t)prompt->new_size)) == 'n') {
+ answer_no = 1;
+ } else {
+ answer_yes = 1;
+ log_warn("WARNING: Faking size of PV %s. Don't write outside real device.", pvname);
+ }
+ }
+ }
+ }
+
+ if (prompt->type & PROMPT_PVREMOVE_PV_IN_VG) {
if (pp->force != DONT_PROMPT_OVERRIDE) {
- prompt->answer = PROMPT_ANSWER_NO;
+ answer_no = 1;
if (prompt->vg_name_unknown)
log_error("PV %s is used by a VG but its metadata is missing.", pvname);
@@ -4847,20 +4871,51 @@ static void _check_pvcreate_prompt(struct cmd_context *cmd,
log_error("(If you are certain you need pvremove, then confirm by using --force twice.)");
} else if (pp->yes) {
log_warn("WARNING: PV %s is used by VG %s", pvname, vgname);
- prompt->answer = PROMPT_ANSWER_YES;
+ answer_yes = 1;
} else if (ask) {
log_warn("WARNING: PV %s is used by VG %s", pvname, vgname);
- if (yes_no_prompt("Really WIPE LABELS from physical volume \"%s\" of volume group \"%s\" [y/n]? ", pvname, vgname) == 'n') {
- prompt->answer = PROMPT_ANSWER_NO;
- log_error("%s: physical volume label not removed", pvname);
- } else {
- prompt->answer = PROMPT_ANSWER_YES;
- }
+ if (yes_no_prompt("Really WIPE LABELS from physical volume \"%s\" of volume group \"%s\" [y/n]? ", pvname, vgname) == 'n')
+ answer_no = 1;
+ else
+ answer_yes = 1;
}
+ }
- if ((prompt->answer == PROMPT_ANSWER_YES) && (pp->force == DONT_PROMPT_OVERRIDE))
- log_warn("WARNING: Wiping physical volume label from %s of volume group \"%s\"", pvname, vgname);
+ if (answer_yes && answer_no) {
+ log_warn("WARNING: prompt answer yes is overriden by prompt answer no.");
+ answer_yes = 0;
}
+
+ /*
+ * no answer is valid when not asking the user.
+ * the caller uses this to check if all the prompts
+ * can be answered automatically without prompts.
+ */
+ if (!ask && !answer_yes && !answer_no)
+ return;
+
+ if (answer_no)
+ prompt->answer = PROMPT_ANSWER_NO;
+ else if (answer_yes)
+ prompt->answer = PROMPT_ANSWER_YES;
+
+ /*
+ * Mostly historical messages. Other messages above could be moved
+ * here to separate the answer logic from the messages.
+ */
+
+ if ((prompt->type & (PROMPT_PVCREATE_DEV_SIZE | PROMPT_PVCREATE_PV_IN_VG)) &&
+ (prompt->answer == PROMPT_ANSWER_NO))
+ log_error("%s: physical volume not initialized.", pvname);
+
+ if ((prompt->type & PROMPT_PVREMOVE_PV_IN_VG) &&
+ (prompt->answer == PROMPT_ANSWER_NO))
+ log_error("%s: physical volume label not removed.", pvname);
+
+ if ((prompt->type & PROMPT_PVREMOVE_PV_IN_VG) &&
+ (prompt->answer == PROMPT_ANSWER_YES) &&
+ (pp->force == DONT_PROMPT_OVERRIDE))
+ log_warn("WARNING: Wiping physical volume label from %s of volume group \"%s\".", pvname, vgname);
}
static struct pvcreate_device *_pvcreate_list_find_dev(struct dm_list *devices, struct device *dev)
@@ -4912,6 +4967,10 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
struct pvcreate_params *pp = (struct pvcreate_params *) handle->custom_handle;
struct pvcreate_device *pd;
struct pvcreate_prompt *prompt;
+ uint64_t size = 0;
+ uint64_t new_size = 0;
+ int need_size_prompt = 0;
+ int need_vg_prompt = 0;
int found = 0;
if (!pv->dev)
@@ -4996,35 +5055,57 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
pd->is_not_pv = 1;
}
+ if (arg_is_set(cmd, setphysicalvolumesize_ARG)) {
+ new_size = arg_uint64_value(cmd, setphysicalvolumesize_ARG, UINT64_C(0));
+
+ if (!dev_get_size(pv->dev, &size)) {
+ log_error("Can't get device size of %s.", pv_dev_name(pv));
+ dm_list_move(&pp->arg_fail, &pd->list);
+ return 1;
+ } else if (new_size != size)
+ need_size_prompt = 1;
+ }
+
/*
* pvcreate is being run on this device, and it's not a PV,
* or is an orphan PV. Neither case requires a prompt.
+ * Or, pvcreate is being run on this device, but the device
+ * is already a PV in a VG. A prompt or force option is required
+ * to use it.
*/
- if (pd->is_orphan_pv || pd->is_not_pv) {
+ if (pd->is_orphan_pv || pd->is_not_pv)
+ need_vg_prompt = 0;
+ else
+ need_vg_prompt = 1;
+
+ if (!need_size_prompt && !need_vg_prompt) {
pd->dev = pv->dev;
dm_list_move(&pp->arg_process, &pd->list);
return 1;
}
- /*
- * pvcreate is being run on this device, but the device is already
- * a PV in a VG. A prompt or force option is required to use it.
- */
if (!(prompt = dm_pool_zalloc(cmd->mem, sizeof(*prompt)))) {
log_error("prompt alloc failed.");
pp->check_failed = 1;
return 0;
}
prompt->dev = pd->dev;
- prompt->type = PROMPT_PVCREATE_PV_IN_VG;
prompt->pv_name = dm_pool_strdup(cmd->mem, pd->name);
+ prompt->size = size;
+ prompt->new_size = new_size;
if (pd->is_used_unknown_pv)
prompt->vg_name_unknown = 1;
- else
+ else if (need_vg_prompt)
prompt->vg_name = dm_pool_strdup(cmd->mem, vg->name);
- dm_list_add(&pp->prompts, &prompt->list);
+ if (need_size_prompt)
+ prompt->type |= PROMPT_PVCREATE_DEV_SIZE;
+
+ if (need_vg_prompt)
+ prompt->type |= PROMPT_PVCREATE_PV_IN_VG;
+
+ dm_list_add(&pp->prompts, &prompt->list);
pd->dev = pv->dev;
dm_list_move(&pp->arg_process, &pd->list);
@@ -5254,7 +5335,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
prompt->vg_name_unknown = 1;
else
prompt->vg_name = dm_pool_strdup(cmd->mem, vg->name);
- prompt->type = PROMPT_PVREMOVE_PV_IN_VG;
+ prompt->type |= PROMPT_PVREMOVE_PV_IN_VG;
dm_list_add(&pp->prompts, &prompt->list);
pd->dev = pv->dev;
6 years, 5 months
master - dbus: log_debug needs qualifier
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5cf51fb2f74ad43a255...
Commit: 5cf51fb2f74ad43a2555bc391cf069caa1d99775
Parent: 0e3c16af5699c000f1824c42c596fec58d019dfa
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Apr 27 18:12:20 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Apr 27 18:16:17 2017 +0200
dbus: log_debug needs qualifier
Adding qualifier makes the only unqualified log_debug occurence
consistent with other uses in the same file.
Other possible ways to fix this:
- using `from .utils import log_debug`
- moving the line below `from . import utils` line
---
daemons/lvmdbusd/manager.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/manager.py b/daemons/lvmdbusd/manager.py
index 1ae9c8b..d77c7b4 100644
--- a/daemons/lvmdbusd/manager.py
+++ b/daemons/lvmdbusd/manager.py
@@ -6,7 +6,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from utils import log_debug
from .automatedproperties import AutomatedProperties
from . import utils
@@ -145,7 +144,7 @@ class Manager(AutomatedProperties):
p = cfg.om.get_object_path_by_uuid_lvm_id(key, key)
if not p:
p = '/'
- log_debug('LookUpByLvmId: key = %s, result = %s' % (key, p))
+ utils.log_debug('LookUpByLvmId: key = %s, result = %s' % (key, p))
return p
@dbus.service.method(
6 years, 5 months
master - pvresize: Missing a message on error path.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e3c16af5699c000f18...
Commit: 0e3c16af5699c000f1824c42c596fec58d019dfa
Parent: 33afe2ca76e4bddcfa33aafa2fed28d4ca60e08e
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 27 14:59:40 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 27 15:00:41 2017 +0100
pvresize: Missing a message on error path.
---
lib/metadata/pv_manip.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index 6ee4828..a8cd763 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -648,14 +648,18 @@ int pv_resize_single(struct cmd_context *cmd,
pv_name, display_size(cmd, (uint64_t) size));
if (!yes && yes_no_prompt("%s: Requested size %s exceeds real size %s. Proceed? [y/n]: ",
pv_name, display_size(cmd, (uint64_t) new_size),
- display_size(cmd, (uint64_t) size)) == 'n')
+ display_size(cmd, (uint64_t) size)) == 'n') {
+ log_error("Physical Volume %s not resized.", pv_name);
goto_out;
+ }
} else if (new_size < size)
if (!yes && yes_no_prompt("%s: Requested size %s is less than real size %s. Proceed? [y/n]: ",
pv_name, display_size(cmd, (uint64_t) new_size),
- display_size(cmd, (uint64_t) size)) == 'n')
+ display_size(cmd, (uint64_t) size)) == 'n') {
+ log_error("Physical Volume %s not resized.", pv_name);
goto_out;
+ }
if (new_size == size)
log_verbose("%s: Size is already %s (%" PRIu64 " sectors).",
6 years, 5 months
master - test: add -y to raid1 up conversions
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=33afe2ca76e4bddcfa3...
Commit: 33afe2ca76e4bddcfa33aafa2fed28d4ca60e08e
Parent: 05164479781486dbe2486c0439d42ed03e4483e8
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 27 15:56:58 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 27 15:56:58 2017 +0200
test: add -y to raid1 up conversions
---
test/shell/lvconvert-raid-allocation.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
index b23644c..1a768b6 100644
--- a/test/shell/lvconvert-raid-allocation.sh
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -22,8 +22,8 @@ vgcreate -s 256k $vg $(cat DEVICES)
# Start with linear on 2 PV and ensure that converting to
# RAID is not allowed to reuse PVs for different images. (Bug 1113180)
lvcreate -aey -l 4 -n $lv1 $vg "$dev1:0-1" "$dev2:0-1"
-not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev2"
-not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev3:0-2"
+not lvconvert -y --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev2"
+not lvconvert -y --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev3:0-2"
lvconvert -y --type raid1 -m 1 $vg/$lv1 "$dev3"
not lvconvert -m 0 $vg/$lv1
lvconvert -y -m 0 $vg/$lv1
6 years, 5 months
master - lvconvert: preserve region size on raid1 image count changes (v2)
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05164479781486dbe24...
Commit: 05164479781486dbe2486c0439d42ed03e4483e8
Parent: 14c84c79db91d16f7beed203aa8c03127426d1d9
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 27 15:52:25 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 27 15:52:25 2017 +0200
lvconvert: preserve region size on raid1 image count changes (v2)
Unless a change of the regionsize is requested via "lvconvert -R N ...",
keep the region size when the number of images changes in a raid1 LV.
Related: rhbz1443705
---
WHATS_NEW | 1 +
tools/lvconvert.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 199b1dc..c746bac 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.171 -
==================================
+ lvconvert - preserve region size on raid1 image count changes
Adjust pvresize messages and add prompt if underlying dev size differs.
raid - sanely handle insufficient space on takeover.
Fix configure --enable-notify-dbus status message.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 04201d0..821146f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -60,6 +60,7 @@ struct lvconvert_params {
int need_polling;
uint32_t region_size;
+ unsigned region_size_supplied;
uint32_t mirrors;
sign_t mirrors_sign;
@@ -247,10 +248,13 @@ static int _read_params(struct cmd_context *cmd, struct lvconvert_params *lp)
return 0;
}
- if (arg_is_set(cmd, regionsize_ARG))
+ if (arg_is_set(cmd, regionsize_ARG)) {
lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0);
- else
+ lp->region_size_supplied = 1;
+ } else {
lp->region_size = get_default_region_size(cmd);
+ lp->region_size_supplied = 0;
+ }
/* FIXME man page says in one place that --type and --mirrors can't be mixed */
if (lp->mirrors_supplied && !lp->mirrors)
@@ -1360,7 +1364,9 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
DEFAULT_RAID1_MAX_IMAGES, lp->segtype->name, display_lvname(lv));
return 0;
}
- if (!lv_raid_change_image_count(lv, lp->yes, image_count, lp->region_size, lp->pvh))
+ if (!lv_raid_change_image_count(lv, lp->yes, image_count,
+ (lp->region_size_supplied || !seg->region_size) ?
+ lp->region_size : seg->region_size , lp->pvh))
return_0;
log_print_unless_silent("Logical volume %s successfully converted.",
@@ -1427,7 +1433,8 @@ try_new_takeover_or_reshape:
(seg_is_striped(seg) && seg->area_count > 1 && seg_is_raid4(lp))))) {
if (!lv_raid_convert(lv, lp->segtype,
lp->yes, lp->force, lp->stripes, lp->stripe_size_supplied, lp->stripe_size,
- lp->region_size, lp->pvh))
+ (lp->region_size_supplied || !seg->region_size) ?
+ lp->region_size : seg->region_size , lp->pvh))
return_0;
log_print_unless_silent("Logical volume %s successfully converted.",
6 years, 5 months
master - test: Update pattern to match code
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=14c84c79db91d16f7be...
Commit: 14c84c79db91d16f7beed203aa8c03127426d1d9
Parent: af47ec9f515402e69328fb73a73172845ff05b2f
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Apr 27 10:22:11 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Apr 27 15:30:03 2017 +0200
test: Update pattern to match code
Fix commit a3fdc966b5
---
test/shell/lvcreate-cache.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 646bd10..faa78b2 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -57,7 +57,7 @@ fail lvcreate -l 1 --cachepool pool8 $vg
# no size specified
invalid lvcreate --cachepool pool $vg 2>&1 | tee err
#grep "specify either size or extents" err
-grep "Incorrect syntax" err
+grep "No command with matching syntax recognised" err
# Check nothing has been created yet
check vg_field $vg lv_count 0
6 years, 5 months