master - libdm: fix parentheses in assignment + comparison
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a02db1c45ab571d0c61...
Commit: a02db1c45ab571d0c614d269a713b56cd47c2e1e
Parent: a65649b45d0d0a417b64bf9918b2aeedb7f3993b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 20 14:21:38 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 20 15:14:16 2017 +0200
libdm: fix parentheses in assignment + comparison
As reported, fix incorrect placement of parentheses.
TODO: add testing code.
---
WHATS_NEW_DM | 1 +
libdm/libdm-report.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 5f71327..2a351a4 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.144 -
======================================
+ Correct return value testing when get reserved values for reporting.
Take -S with dmsetup suspend/resume/clear/wipe_table/remove/deps/status/table.
Version 1.02.143 - 13th September 2017
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index d2371db..05f5ea0 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -3414,7 +3414,7 @@ static int _get_reserved_value(struct dm_report *rh, uint32_t field_num,
handler = (dm_report_reserved_handler) tmp_value;
if ((r = handler(rh, rh->selection->mem, field_num,
DM_REPORT_RESERVED_GET_DYNAMIC_VALUE,
- rvw->matched_name, &tmp_value) <= 0)) {
+ rvw->matched_name, &tmp_value)) <= 0) {
if (r == -1)
log_error(INTERNAL_ERROR "%s reserved value handler for field %s has missing"
"implementation of DM_REPORT_RESERVED_GET_DYNAMIC_VALUE action",
6 years, 6 months
master - lvconvert: support repair of cache/cachepool
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a65649b45d0d0a417b6...
Commit: a65649b45d0d0a417b64bf9918b2aeedb7f3993b
Parent: aeb4f2bf3d25927e6cac2e37842498b207fefd1c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 18 11:33:47 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 20 15:14:16 2017 +0200
lvconvert: support repair of cache/cachepool
Extend repair for cache and cachepool target
and user 'lvconvert_repair' routine name.
---
WHATS_NEW | 1 +
tools/command-lines.in | 11 ++-
tools/lvconvert.c | 206 +++++++++++++++++++++++++++++++++++++++++++++---
tools/lvmcmdline.c | 4 +-
tools/tools.h | 2 +-
5 files changed, 209 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e76214d..7927673 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.175 -
======================================
+ Support lvconvert --repair with cache and cachepool volumes.
lvconvert --repair respects --poolmetadataspare option.
Version 2.02.174 - 13th September 2017
diff --git a/tools/command-lines.in b/tools/command-lines.in
index e915483..ec02fa4 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -658,17 +658,24 @@ FLAGS: SECONDARY_SYNTAX
# lvconvert --repair-thinpool LV_thinpool
# DESC: Repair a thin pool.
#
+# lvconvert --repair-cache LV_cache
+# DESC: Repair a cache.
+#
+# lvconvert --repair-cachepool LV_cachepool
+# DESC: Repair a cachepool.
+#
# lvm may want to do different things, or allow different options
# depending on which operation is being run, but as it stands, it
# cannot do anything operation-specific until after the VG is read
# and the LV type is known.
-lvconvert --repair LV_raid_mirror_thinpool
+lvconvert --repair LV_cache_cachepool_mirror_raid_thinpool
OO: --usepolicies, --interval Number, --poolmetadataspare Bool, OO_LVCONVERT
OP: PV ...
-ID: lvconvert_repair_pvs_or_thinpool
+ID: lvconvert_repair
DESC: Replace failed PVs in a raid or mirror LV.
DESC: Repair a thin pool.
+DESC: Repair a cache pool.
RULE: all not lv_is_locked lv_is_pvmove
RULE: --poolmetadataspare Bool and LV_cache LV_cachepool LV_thinpool
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 94dee9d..77d9174 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2386,6 +2386,180 @@ deactivate_pmslv:
return 1;
}
+/* TODO: lots of similar code with thinpool repair
+ * investigate possible better code sharing...
+ */
+static int _lvconvert_cache_repair(struct cmd_context *cmd,
+ struct logical_volume *cache_lv,
+ struct dm_list *pvh, int poolmetadataspare)
+{
+ const char *dmdir = dm_dir();
+ const char *cache_repair =
+ find_config_tree_str_allow_empty(cmd, global_cache_repair_executable_CFG, NULL);
+ const struct dm_config_node *cn;
+ const struct dm_config_value *cv;
+ int ret = 0, status;
+ int args = 0;
+ const char *argv[19]; /* Max supported 10 args */
+ char *dm_name;
+ char meta_path[PATH_MAX];
+ char pms_path[PATH_MAX];
+ struct logical_volume *pool_lv;
+ struct logical_volume *pmslv;
+ struct logical_volume *mlv;
+
+ pool_lv = lv_is_cache_pool(cache_lv) ? cache_lv : first_seg(cache_lv)->pool_lv;
+ mlv = first_seg(pool_lv)->metadata_lv;
+
+ if (!cache_repair || !cache_repair[0]) {
+ log_error("Cache repair commnand is not configured. Repair is disabled.");
+ return 0; /* Checking disabled */
+ }
+
+ pmslv = cache_lv->vg->pool_metadata_spare_lv;
+
+ /* Check we have pool metadata spare LV */
+ if (!handle_pool_metadata_spare(cache_lv->vg, 0, pvh, 1))
+ return_0;
+
+ if (pmslv != cache_lv->vg->pool_metadata_spare_lv) {
+ if (!vg_write(cache_lv->vg) || !vg_commit(cache_lv->vg))
+ return_0;
+ pmslv = cache_lv->vg->pool_metadata_spare_lv;
+ }
+
+ if (!(dm_name = dm_build_dm_name(cmd->mem, mlv->vg->name,
+ mlv->name, NULL)) ||
+ (dm_snprintf(meta_path, sizeof(meta_path), "%s/%s", dmdir, dm_name) < 0)) {
+ log_error("Failed to build cache metadata path.");
+ return 0;
+ }
+
+ if (!(dm_name = dm_build_dm_name(cmd->mem, pmslv->vg->name,
+ pmslv->name, NULL)) ||
+ (dm_snprintf(pms_path, sizeof(pms_path), "%s/%s", dmdir, dm_name) < 0)) {
+ log_error("Failed to build pool metadata spare path.");
+ return 0;
+ }
+
+ if (!(cn = find_config_tree_array(cmd, global_cache_repair_options_CFG, NULL))) {
+ log_error(INTERNAL_ERROR "Unable to find configuration for global/cache_repair_options");
+ return 0;
+ }
+
+ for (cv = cn->v; cv && args < 16; cv = cv->next) {
+ if (cv->type != DM_CFG_STRING) {
+ log_error("Invalid string in config file: "
+ "global/cache_repair_options");
+ return 0;
+ }
+ argv[++args] = cv->v.str;
+ }
+
+ if (args == 10) {
+ log_error("Too many options for cache repair command.");
+ return 0;
+ }
+
+ argv[0] = cache_repair;
+ argv[++args] = "-i";
+ argv[++args] = meta_path;
+ argv[++args] = "-o";
+ argv[++args] = pms_path;
+ argv[++args] = NULL;
+
+ if (lv_is_active(cache_lv)) {
+ log_error("Only inactive cache can be repaired.");
+ return 0;
+ }
+
+ if (!activate_lv_local(cmd, pmslv)) {
+ log_error("Cannot activate pool metadata spare volume %s.",
+ pmslv->name);
+ return 0;
+ }
+
+ if (!activate_lv_local(cmd, mlv)) {
+ log_error("Cannot activate cache pool metadata volume %s.",
+ mlv->name);
+ goto deactivate_pmslv;
+ }
+
+ if (!(ret = exec_cmd(cmd, (const char * const *)argv, &status, 1))) {
+ log_error("Repair of cache metadata volume of cache %s failed (status:%d). "
+ "Manual repair required!",
+ display_lvname(cache_lv), status);
+ goto deactivate_mlv;
+ }
+
+ /* TODO: any active validation of cache-pool metadata? */
+
+deactivate_mlv:
+ if (!deactivate_lv(cmd, mlv)) {
+ log_error("Cannot deactivate pool metadata volume %s.",
+ mlv->name);
+ return 0;
+ }
+
+deactivate_pmslv:
+ if (!deactivate_lv(cmd, pmslv)) {
+ log_error("Cannot deactivate pool metadata spare volume %s.",
+ mlv->name);
+ return 0;
+ }
+
+ if (!ret)
+ return 0;
+
+ if (pmslv == cache_lv->vg->pool_metadata_spare_lv) {
+ cache_lv->vg->pool_metadata_spare_lv = NULL;
+ pmslv->status &= ~POOL_METADATA_SPARE;
+ lv_set_visible(pmslv);
+ }
+
+ /* Try to allocate new pool metadata spare LV */
+ if (!handle_pool_metadata_spare(cache_lv->vg, 0, pvh, poolmetadataspare))
+ stack;
+
+ if (dm_snprintf(meta_path, sizeof(meta_path), "%s_meta%%d", cache_lv->name) < 0) {
+ log_error("Can't prepare new metadata name for %s.", cache_lv->name);
+ return 0;
+ }
+
+ if (!generate_lv_name(cache_lv->vg, meta_path, pms_path, sizeof(pms_path))) {
+ log_error("Can't generate new name for %s.", meta_path);
+ return 0;
+ }
+
+ if (!detach_pool_metadata_lv(first_seg(pool_lv), &mlv))
+ return_0;
+
+ /* Swap _pmspare and _cmeta name */
+ if (!swap_lv_identifiers(cmd, mlv, pmslv))
+ return_0;
+
+ if (!attach_pool_metadata_lv(first_seg(pool_lv), pmslv))
+ return_0;
+
+ /* Used _cmeta (now _pmspare) becomes _meta%d */
+ if (!lv_rename_update(cmd, mlv, pms_path, 0))
+ return_0;
+
+ if (!vg_write(cache_lv->vg) || !vg_commit(cache_lv->vg))
+ return_0;
+
+ /* FIXME: just as with thinpool repair - fix the warning
+ * where moving doesn't make any sense (same disk storage)
+ */
+ log_warn("WARNING: If everything works, remove %s volume.",
+ display_lvname(mlv));
+
+ log_warn("WARNING: Use pvmove command to move %s on the best fitting PV.",
+ display_lvname(first_seg(pool_lv)->metadata_lv));
+
+ return 1;
+}
+
static int _lvconvert_to_thin_with_external(struct cmd_context *cmd,
struct logical_volume *lv,
struct logical_volume *thinpool_lv)
@@ -3371,12 +3545,11 @@ static int _lvconvert_repair_pvs(struct cmd_context *cmd, struct logical_volume
return ret ? ECMD_PROCESSED : ECMD_FAILED;
}
-static int _lvconvert_repair_thinpool(struct cmd_context *cmd, struct logical_volume *lv,
+static int _lvconvert_repair_cachepool_thinpool(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle)
{
int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
struct dm_list *use_pvh;
- int ret;
if (cmd->position_argc > 1) {
/* First pos arg is required LV, remaining are optional PVs. */
@@ -3385,28 +3558,41 @@ static int _lvconvert_repair_thinpool(struct cmd_context *cmd, struct logical_vo
} else
use_pvh = &lv->vg->pvs;
- ret = _lvconvert_thin_pool_repair(cmd, lv, use_pvh, poolmetadataspare);
+ if (lv_is_thin_pool(lv)) {
+ if (!_lvconvert_thin_pool_repair(cmd, lv, use_pvh, poolmetadataspare))
+ return_ECMD_FAILED;
+ } else /* cache */ {
+ if (!_lvconvert_cache_repair(cmd, lv, use_pvh, poolmetadataspare))
+ return_ECMD_FAILED;
+ }
- return ret ? ECMD_PROCESSED : ECMD_FAILED;
+ return ECMD_PROCESSED;
}
-static int _lvconvert_repair_pvs_or_thinpool_single(struct cmd_context *cmd, struct logical_volume *lv,
+static int _lvconvert_repair_single(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle)
{
- if (lv_is_thin_pool(lv))
- return _lvconvert_repair_thinpool(cmd, lv, handle);
+ if (lv_is_thin_pool(lv) ||
+ lv_is_cache(lv) ||
+ lv_is_cache_pool(lv))
+ return _lvconvert_repair_cachepool_thinpool(cmd, lv, handle);
if (lv_is_raid(lv) || lv_is_mirror(lv))
return _lvconvert_repair_pvs(cmd, lv, handle);
- return_ECMD_FAILED;
+ log_error("Unsupported volume type for repair of volume %s.",
+ display_lvname(lv));
+
+ return ECMD_FAILED;
}
/*
* FIXME: add option --repair-pvs to call _lvconvert_repair_pvs() directly,
* and option --repair-thinpool to call _lvconvert_repair_thinpool().
+ * and option --repair-cache to call _lvconvert_repair_cache().
+ * and option --repair-cachepool to call _lvconvert_repair_cachepool().
*/
-int lvconvert_repair_pvs_or_thinpool_cmd(struct cmd_context *cmd, int argc, char **argv)
+int lvconvert_repair_cmd(struct cmd_context *cmd, int argc, char **argv)
{
struct processing_handle *handle;
struct lvconvert_result lr = { 0 };
@@ -3429,7 +3615,7 @@ int lvconvert_repair_pvs_or_thinpool_cmd(struct cmd_context *cmd, int argc, char
cmd->handles_missing_pvs = 1;
ret = process_each_lv(cmd, 1, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
- handle, NULL, &_lvconvert_repair_pvs_or_thinpool_single);
+ handle, NULL, &_lvconvert_repair_single);
init_ignore_suspended_devices(saved_ignore_suspended_devices);
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 55f72ac..fc4b3bb 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -109,7 +109,7 @@ static const struct command_function command_functions[CMD_COUNT] = {
{ vgchange_systemid_CMD, vgchange_systemid_cmd },
/* lvconvert utilities related to repair. */
- { lvconvert_repair_pvs_or_thinpool_CMD, lvconvert_repair_pvs_or_thinpool_cmd },
+ { lvconvert_repair_CMD, lvconvert_repair_cmd },
{ lvconvert_replace_pv_CMD, lvconvert_replace_pv_cmd },
/* lvconvert utilities related to snapshots. */
@@ -2877,7 +2877,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
lvmetad_make_unused(cmd);
}
- if (cmd->command->command_enum == lvconvert_repair_pvs_or_thinpool_CMD) {
+ if (cmd->command->command_enum == lvconvert_repair_CMD) {
log_warn("WARNING: Disabling lvmetad cache for repair command.");
lvmetad_set_disabled(cmd, LVMETAD_DISABLE_REASON_REPAIR);
log_warn("WARNING: Not using lvmetad because of repair.");
diff --git a/tools/tools.h b/tools/tools.h
index ba4edeb..53f8ddc 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -240,7 +240,7 @@ int lvchange_rebuild_cmd(struct cmd_context *cmd, int argc, char **argv);
int lvchange_monitor_poll_cmd(struct cmd_context *cmd, int argc, char **argv);
int lvchange_persistent_cmd(struct cmd_context *cmd, int argc, char **argv);
-int lvconvert_repair_pvs_or_thinpool_cmd(struct cmd_context *cmd, int argc, char **argv);
+int lvconvert_repair_cmd(struct cmd_context *cmd, int argc, char **argv);
int lvconvert_replace_pv_cmd(struct cmd_context *cmd, int argc, char **argv);
int lvconvert_merge_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv);
6 years, 6 months
master - lvconvert: repair supports poometadatespare switch
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=aeb4f2bf3d25927e6ca...
Commit: aeb4f2bf3d25927e6cac2e37842498b207fefd1c
Parent: 03bcd29481e879eb890278997e7f7214757de952
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 13 11:48:15 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 20 15:14:16 2017 +0200
lvconvert: repair supports poometadatespare switch
Enable handling of --poolmetadataspare so if user can prevent
creation of _pmspare volume during --repair operation (just
like during actual lvcreate or lvconvert) for pool volumes.
---
WHATS_NEW | 1 +
tools/command-lines.in | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8e8ed2c..e76214d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.175 -
======================================
+ lvconvert --repair respects --poolmetadataspare option.
Version 2.02.174 - 13th September 2017
======================================
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 2f4e48f..e915483 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -664,12 +664,13 @@ FLAGS: SECONDARY_SYNTAX
# and the LV type is known.
lvconvert --repair LV_raid_mirror_thinpool
-OO: --usepolicies, --interval Number, OO_LVCONVERT
+OO: --usepolicies, --interval Number, --poolmetadataspare Bool, OO_LVCONVERT
OP: PV ...
ID: lvconvert_repair_pvs_or_thinpool
DESC: Replace failed PVs in a raid or mirror LV.
DESC: Repair a thin pool.
RULE: all not lv_is_locked lv_is_pvmove
+RULE: --poolmetadataspare Bool and LV_cache LV_cachepool LV_thinpool
lvconvert --replace PV LV_raid
OO: OO_LVCONVERT
6 years, 6 months
master - configure: Add warning for D-Bus w/o notifications
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=03bcd29481e879eb890...
Commit: 03bcd29481e879eb890278997e7f7214757de952
Parent: 0c46f9cf0cf712e96dd2078b9121df1078b11e2a
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Sep 20 10:25:29 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Sep 20 13:07:06 2017 +0200
configure: Add warning for D-Bus w/o notifications
Building D-Bus support without notifications is not recommended.
---
configure | 4 ++++
configure.in | 2 ++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 78c738d..9f2f744 100755
--- a/configure
+++ b/configure
@@ -12825,6 +12825,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_LVMDBUSD" >&5
$as_echo "$BUILD_LVMDBUSD" >&6; }
+if test "$NOTIFYDBUS_SUPPORT" = yes && test "BUILD_LVMDBUSD" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building D-Bus support without D-Bus notifications." >&5
+$as_echo "$as_me: WARNING: Building D-Bus support without D-Bus notifications." >&2;}
+fi
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Python wrapper for liblvm2app.so" >&5
diff --git a/configure.in b/configure.in
index e2f448e..00e70aa 100644
--- a/configure.in
+++ b/configure.in
@@ -1486,6 +1486,8 @@ AC_ARG_ENABLE(dbus-service,
AC_HELP_STRING([--enable-dbus-service], [install D-Bus support]),
BUILD_LVMDBUSD=$enableval, BUILD_LVMDBUSD=no)
AC_MSG_RESULT($BUILD_LVMDBUSD)
+AS_IF([test "$NOTIFYDBUS_SUPPORT" = yes && test "BUILD_LVMDBUSD" = yes],
+ [AC_MSG_WARN([Building D-Bus support without D-Bus notifications.])])
################################################################################
dnl -- Enable Python liblvm2app bindings
6 years, 6 months
master - configure: Update configure
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0c46f9cf0cf712e96dd...
Commit: 0c46f9cf0cf712e96dd2078b9121df1078b11e2a
Parent: 8493df8eddc5a05a2af9a9c4d8e11192f07ec79a
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Sep 20 10:13:39 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Sep 20 13:07:06 2017 +0200
configure: Update configure
---
configure | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 2afbe6e..78c738d 100755
--- a/configure
+++ b/configure
@@ -12791,6 +12791,10 @@ $as_echo "$APPLIB" >&6; }
test "$APPLIB" = yes \
&& LVM2APP_LIB=-llvm2app \
|| LVM2APP_LIB=
+if test "$APPLIB"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Python bindings are deprecated. Use D-Bus API" >&5
+$as_echo "$as_me: WARNING: Python bindings are deprecated. Use D-Bus API" >&2;}
+fi
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile liblvm2cmd.so" >&5
@@ -13868,6 +13872,8 @@ $as_echo "no" >&6; }
fi
if test "$PYTHON_BINDINGS" = yes -o "$PYTHON2_BINDINGS" = yes -o "$PYTHON3_BINDINGS" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Python bindings are deprecated. Use D-Bus API" >&5
+$as_echo "$as_me: WARNING: Python bindings are deprecated. Use D-Bus API" >&2;}
test "$APPLIB" != yes && as_fn_error $? "Python_bindings require --enable-applib" "$LINENO" 5
fi
6 years, 6 months
master - liblvm: Add deprecation warning to configure
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8493df8eddc5a05a2af...
Commit: 8493df8eddc5a05a2af9a9c4d8e11192f07ec79a
Parent: 4cbacf6bac47227ec3460da1619ab29557f2c89b
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Sep 20 10:00:59 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Sep 20 13:07:06 2017 +0200
liblvm: Add deprecation warning to configure
---
configure.in | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/configure.in b/configure.in
index 43e8652..e2f448e 100644
--- a/configure.in
+++ b/configure.in
@@ -1464,6 +1464,8 @@ AC_SUBST([LVM2APP_LIB])
test "$APPLIB" = yes \
&& LVM2APP_LIB=-llvm2app \
|| LVM2APP_LIB=
+AS_IF([test "$APPLIB"],
+ [AC_MSG_WARN([Python bindings are deprecated. Use D-Bus API])])
################################################################################
dnl -- Enable cmdlib
@@ -1546,6 +1548,7 @@ if test "$BUILD_LVMDBUSD" = yes; then
fi
if test "$PYTHON_BINDINGS" = yes -o "$PYTHON2_BINDINGS" = yes -o "$PYTHON3_BINDINGS" = yes; then
+ AC_MSG_WARN([Python bindings are deprecated. Use D-Bus API])
test "$APPLIB" != yes && AC_MSG_ERROR([Python_bindings require --enable-applib])
fi
6 years, 6 months
master - liblvm: Deprecate library and bindings
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4cbacf6bac47227ec34...
Commit: 4cbacf6bac47227ec3460da1619ab29557f2c89b
Parent: 5407327bc6fff77dabb6dd55150832373ba163a7
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Sep 19 15:17:01 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Sep 20 13:07:06 2017 +0200
liblvm: Deprecate library and bindings
It is recommended to use D-Bus API instead of liblvm2app or python
bindings.
---
liblvm/lvm2app.h | 2 ++
python/liblvm.c | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index be53b2d..f64262d 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -18,6 +18,8 @@
#include <stdint.h>
+#warning "liblvm2app is deprecated, use D-Bus API instead."
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/python/liblvm.c b/python/liblvm.c
index 1b3534e..6d67b8b 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -2085,6 +2085,8 @@ PyMODINIT_FUNC initlvm(void)
PyModule_AddObject(m, "LibLVMError", _LibLVMError);
}
+ PyErr_Warn(PyExc_DeprecationWarning, "Python API is deprecated, use D-Bus API instead.");
+
Py_AtExit(_liblvm_cleanup);
#ifdef IS_PY3K
return m;
6 years, 6 months
master - toollib: fix parentheses in assignment + comparison
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5407327bc6fff77dabb...
Commit: 5407327bc6fff77dabb6dd55150832373ba163a7
Parent: 200793edc681ac956e9341af6b5f20dc4e3f9ee8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 19 09:19:24 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 19 09:19:24 2017 -0500
toollib: fix parentheses in assignment + comparison
---
tools/toollib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 1799bc9..bf3e9d6 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -4464,7 +4464,7 @@ int process_each_pv(struct cmd_context *cmd,
* from all VGs are processed first, removing them from all_devices. Then
* any devs remaining in all_devices are processed.
*/
- if ((ret = _get_all_devices(cmd, &all_devices) != ECMD_PROCESSED)) {
+ if ((ret = _get_all_devices(cmd, &all_devices)) != ECMD_PROCESSED) {
ret_max = ret;
goto_out;
}
6 years, 6 months
master - man pvscan: just write --activate in description
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=200793edc681ac956e9...
Commit: 200793edc681ac956e9341af6b5f20dc4e3f9ee8
Parent: d73eddcdc02420793c2287b6aa184dc8eb2dcef4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Sep 18 10:56:39 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Sep 18 10:56:39 2017 -0500
man pvscan: just write --activate in description
rather than -a|--activate, because web pages on
man7.org are not printing the | character.
---
man/pvscan.8_des | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/man/pvscan.8_des b/man/pvscan.8_des
index d6b554e..c3d80b4 100644
--- a/man/pvscan.8_des
+++ b/man/pvscan.8_des
@@ -64,8 +64,7 @@ When event-driven system services detect a new LVM device, the first step
is to automatically scan and cache the metadata from the device. This is
done by pvscan --cache. A second step is to automatically activate LVs
that are present on the new device. This auto-activation is done by the
-same pvscan --cache command when the option '-a|--activate ay' is
-included.
+same pvscan --cache command when the option --activate ay is included.
Auto-activation of VGs or LVs can be enabled/disabled using:
.br
@@ -80,11 +79,11 @@ When this setting is undefined, all LVs are auto-activated (when lvm is
fully integrated with the event-driven system services.)
When a VG or LV is not auto-activated, traditional activation using
-vgchange or lvchange -a|--activate is needed.
+vgchange or lvchange --activate is needed.
.IP \[bu] 2
pvscan auto-activation can be only done in combination with --cache.
.IP \[bu] 2
-Auto-activation is designated by the "a" argument in '-a|--activate ay'.
+Auto-activation is designated by the "a" argument in --activate ay.
This is meant to distinguish system generated commands from explicit user
commands, although it can be used in any activation command. Whenever it
is used, the auto_activation_volume_list is applied.
6 years, 6 months
master - dmsetup: Process -S to filter input device lists.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d73eddcdc02420793c2...
Commit: d73eddcdc02420793c2287b6aa184dc8eb2dcef4
Parent: 8e8755319c8a8848b8bcd830a6341eccf750f798
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Sep 14 23:41:17 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Sep 14 23:41:17 2017 +0100
dmsetup: Process -S to filter input device lists.
The following commands now pass the device list through a
--select|-S filter before processing:
suspend resume clear wipe_table remove deps status table
---
WHATS_NEW_DM | 1 +
man/dmsetup.8_main | 16 ++++++++--------
tools/dmsetup.c | 48 ++++++++++++++++++++++++++++++++++++++----------
3 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index a100689..5f71327 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.144 -
======================================
+ Take -S with dmsetup suspend/resume/clear/wipe_table/remove/deps/status/table.
Version 1.02.143 - 13th September 2017
======================================
diff --git a/man/dmsetup.8_main b/man/dmsetup.8_main
index 1e778ad..054746c 100644
--- a/man/dmsetup.8_main
+++ b/man/dmsetup.8_main
@@ -559,14 +559,14 @@ Set the table being loaded read-only.
.BR -S | --select
.IR selection
.br
-Display only rows that match \fIselection\fP criteria. All rows are displayed
-with the additional "selected" column (\fB-o selected\fP) showing 1 if the row
-matches the \fIselection\fP and 0 otherwise. The selection criteria are defined
-by specifying column names and their valid values while making use of
-supported comparison operators. As a quick help and to see full list of
-column names that can be used in selection and the set of supported
-selection operators, check the output of \fBdmsetup\ info\ -c\ -S\ help\fP
-command.
+Process only items that match \fIselection\fP criteria. If the command is
+producing report output, adding the "selected" column (\fB-o
+selected\fP) displays all rows and shows 1 if the row matches the
+\fIselection\fP and 0 otherwise. The selection criteria are defined by
+specifying column names and their valid values while making use of supported
+comparison operators. As a quick help and to see full list of column names that
+can be used in selection and the set of supported selection operators, check
+the output of \fBdmsetup\ info\ -c\ -S\ help\fP command.
.
.HP
.BR --table
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index d9532fb..5a9f006 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -275,6 +275,8 @@ static char _disp_units = 's';
const char *_program_id = DM_STATS_PROGRAM_ID; /* program_id used for reports. */
static uint64_t _statstype = 0; /* stats objects to report */
static int _concise_output_produced = 0; /* Was any concise output already printed? */
+struct command;
+static const struct command *_selection_cmd = NULL; /* Command to run against each device select with -S */
/* string names for stats object types */
const char *_stats_types[] = {
@@ -308,7 +310,6 @@ static uint64_t _last_interval = 0; /* approx. measured interval in nsecs */
* Commands
*/
-struct command;
#define CMD_ARGS const struct command *cmd, const char *subcommand, int argc, char **argv, struct dm_names *names, int multiple_devices
typedef int (*command_fn) (CMD_ARGS);
@@ -318,6 +319,7 @@ struct command {
int min_args;
int max_args;
int repeatable_cmd; /* Repeat to process device list? */
+ /* 2 means --select is also supported */
int has_subcommands; /* Command implements sub-commands. */
command_fn fn;
};
@@ -861,6 +863,8 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
struct dmsetup_report_obj obj;
uint64_t walk_flags = _statstype;
int r = 0;
+ int selected;
+ char *device_name;
if (!info->exists) {
fprintf(stderr, "Device does not exist.\n");
@@ -891,8 +895,17 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
goto_out;
if (!(_report_type & (DR_STATS | DR_STATS_META))) {
- if (!dm_report_object(_report, &obj))
+ /*
+ * If _selection_cmd is set we are applying -S to some other command, so suppress
+ * output and run that other command if the device matches the criteria.
+ */
+ if (!dm_report_object_is_selected(_report, &obj, _selection_cmd ? 0 : 1, &selected))
goto_out;
+ if (_selection_cmd && selected) {
+ device_name = dm_task_get_name(dmt);
+ if (!_selection_cmd->fn(_selection_cmd, NULL, 1, &device_name, NULL, 1))
+ goto_out;
+ }
r = 1;
goto out;
}
@@ -2177,6 +2190,11 @@ static int _error_device(CMD_ARGS)
name = names ? names->name : argv[0];
+ if (!name || !*name) {
+ printf("No device specified\n");
+ return_0;
+ }
+
size = _get_device_size(name);
if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
@@ -6161,24 +6179,24 @@ static struct command _dmsetup_commands[] = {
"\t [--readahead {[+]<sectors>|auto|none}]\n"
"\t [-n|--notable|--table {<table>|<table_file>}]\n"
"\tcreate --concise [<concise_device_spec_list>]", 0, 2, 0, 0, _create},
- {"remove", "[--deferred] [-f|--force] [--retry] <device>...", 0, -1, 1, 0, _remove},
+ {"remove", "[--deferred] [-f|--force] [--retry] <device>...", 0, -1, 2, 0, _remove},
{"remove_all", "[-f|--force]", 0, 0, 0, 0, _remove_all},
- {"suspend", "[--noflush] [--nolockfs] <device>...", 0, -1, 1, 0, _suspend},
+ {"suspend", "[--noflush] [--nolockfs] <device>...", 0, -1, 2, 0, _suspend},
{"resume", "[--noflush] [--nolockfs] <device>...\n"
"\t [--addnodeonresume|--addnodeoncreate]\n"
- "\t [--readahead {[+]<sectors>|auto|none}]", 0, -1, 1, 0, _resume},
+ "\t [--readahead {[+]<sectors>|auto|none}]", 0, -1, 2, 0, _resume},
{"load", "<device> [<table>|<table_file>]", 0, 2, 0, 0, _load},
- {"clear", "<device>", 0, -1, 1, 0, _clear},
+ {"clear", "<device>", 0, -1, 2, 0, _clear},
{"reload", "<device> [<table>|<table_file>]", 0, 2, 0, 0, _load},
- {"wipe_table", "[-f|--force] [--noflush] [--nolockfs] <device>...", 1, -1, 1, 0, _error_device},
+ {"wipe_table", "[-f|--force] [--noflush] [--nolockfs] <device>...", 0, -1, 2, 0, _error_device},
{"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, 0, 0, _rename},
{"message", "<device> <sector> <message>", 2, -1, 0, 0, _message},
{"ls", "[--target <target_type>] [--exec <command>] [-o <options>] [--tree]", 0, 0, 0, 0, _ls},
{"info", "[<device>...]", 0, -1, 1, 0, _info},
- {"deps", "[-o <options>] [<device>...]", 0, -1, 1, 0, _deps},
+ {"deps", "[-o <options>] [<device>...]", 0, -1, 2, 0, _deps},
{"stats", "<command> [<options>] [<device>...]", 1, -1, 1, 1, _stats},
- {"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
- {"table", "[<device>...] [--concise] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
+ {"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 2, 0, _status},
+ {"table", "[<device>...] [--concise] [--target <target_type>] [--showkeys]", 0, -1, 2, 0, _status},
{"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
{"mknodes", "[<device>...]", 0, -1, 1, 0, _mknodes},
{"mangle", "[<device>...]", 0, -1, 1, 0, _mangle},
@@ -7326,6 +7344,16 @@ unknown:
/* Default to success */
ret = 0;
+ /* When -S is given, store the real command for later and run "info -c" first */
+ if (_switches[SELECT_ARG] && (cmd->repeatable_cmd == 2)) {
+ _selection_cmd = cmd;
+ _switches[COLS_ARG] = 1;
+ if (!(cmd = _find_dmsetup_command("info"))) {
+ fprintf(stderr, "Internal error finding dmsetup info command struct.\n");
+ goto out;
+ }
+ }
+
if (_switches[COLS_ARG]) {
if (!_report_init(cmd, subcommand))
ret = 1;
6 years, 6 months