master - cleanup: compile fixes for --disable-devmapper
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8e4db009b8f215...
Commit: 8e4db009b8f215cb7f593f4b76a6f4bd4293e2ca
Parent: 8012c223e0beb858bc2a6b1ea809c4a98a90a5c1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 3 12:38:46 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 3 12:46:43 2016 +0200
cleanup: compile fixes for --disable-devmapper
Make lvm2 compilable when configured with: --disable-devmapper.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 15 ++-------------
lib/mm/memlock.c | 9 +++++++--
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ea36c17..92b95c0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Fix compilation error when building with configure --disable-devmapper.
Fix lvmconfig --type diff to display complete diff if config cascade used.
Automatically filter out partitioned loop devices with partscan (losetup -P).
Fix lvm devtypes internal error if -S used with field name from pvs/vgs/lvs.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 1260b10..089af53 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -253,8 +253,9 @@ int lv_status(struct cmd_context *cmd, const struct lv_segment *lv_seg,
int lv_cache_status(const struct logical_volume *cache_lv,
struct lv_status_cache **status)
{
+ return 0;
}
-int lv_check_not_in_use(const struct logical_volume *lv)
+int lv_check_not_in_use(const struct logical_volume *lv, int error_if_used)
{
return 0;
}
@@ -287,18 +288,6 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
{
return 0;
}
-int lv_cache_block_info(struct logical_volume *lv,
- uint32_t *chunk_size, uint64_t *dirty_count,
- uint64_t *used_count, uint64_t *total_count)
-{
- return 0;
-}
-int lv_cache_policy_info(struct logical_volume *lv,
- const char **policy_name, int *policy_argc,
- const char ***policy_argv)
-{
- return 0;
-}
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
dm_percent_t *percent)
{
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 851cd33..da90144 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -72,6 +72,11 @@ void memlock_reset(void)
return;
}
+int memlock_count_daemon(void)
+{
+ return 0;
+}
+
#else /* DEVMAPPER_SUPPORT */
static size_t _size_stack;
@@ -645,9 +650,9 @@ void memlock_unlock(struct cmd_context *cmd)
_unlock_mem_if_possible(cmd);
}
-#endif
-
int memlock_count_daemon(void)
{
return _memlock_count_daemon;
}
+
+#endif
7 years, 6 months
master - man: lvmconfig: add note about --type diff and --mergedconfig
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8012c223e0beb8...
Commit: 8012c223e0beb858bc2a6b1ea809c4a98a90a5c1
Parent: 687bc5cecfe6293ee5556aa4e448459bb5c167e6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 2 14:07:07 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 2 14:07:07 2016 +0200
man: lvmconfig: add note about --type diff and --mergedconfig
---
man/lvmconfig.8.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/man/lvmconfig.8.in b/man/lvmconfig.8.in
index 257029e..f4b6abd 100644
--- a/man/lvmconfig.8.in
+++ b/man/lvmconfig.8.in
@@ -71,6 +71,7 @@ Display all possible configuration settings with default values assigned.
.IP \fBdiff\fP 3
Display all configuration settings for which the values used differ from defaults.
The value assigned for each configuration setting is the value currently used.
+Using this type also implies the use of \fB\-\-mergedconfig\fP option.
This is actually minimal LVM configuration which can be used without
a change to current configured behaviour.
.IP \fBfull\fP 3
7 years, 6 months
master - lvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=687bc5cecfe629...
Commit: 687bc5cecfe6293ee5556aa4e448459bb5c167e6
Parent: fc37ee63c0562d3f42b597d485495ee79a857dc5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 2 13:41:55 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 2 13:49:38 2016 +0200
lvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used
If configuration consists of several sources in config cascade
("config cascade" defined in man lvmconfig(8)), lvmconfig displayed
only difference from defaults of the topmost config in the cascade.
Fix lvmconfig to display complete difference, considering all
the configuration in the cascade.
For example, before this patch:
(use_lvmetad=0 set in lvm.conf which differs from defaults)
$ lvmconfig --type diff
global {
use_lvmetad=0
}
(compact_output=1 set on cmd line)
$ lvmconfig --type diff --config report/compact_output=1
report {
compact_output=1
}
(headings=0 set in profile)
$ lvmconfig --type diff --commandprofile test
report {
headings=0
}
(difference in topmost configuration source is displayed)
$ lvmconfig --type diff --commandprofile test --config report/compact_output=1
report {
compact_output=1
}
With this patch applied (the config cascade is merged before looking for
difference from defaults in configuration):
$ lvmconfig --type diff
global {
use_lvmetad=0
}
$ lvmconfig --type diff --config report/compact_output=1
report {
compact_output=1
}
global {
use_lvmetad=0
}
$ lvmconfig --type diff --profile test
report {
headings=0
}
global {
use_lvmetad=0
}
$ lvmconfig --type diff --profile test --config report/compact_output=1
report {
headings=0
compact_output=1
}
global {
use_lvmetad=0
}
---
WHATS_NEW | 1 +
tools/dumpconfig.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 74b5bdb..ea36c17 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Fix lvmconfig --type diff to display complete diff if config cascade used.
Automatically filter out partitioned loop devices with partscan (losetup -P).
Fix lvm devtypes internal error if -S used with field name from pvs/vgs/lvs.
When reporting Data%,Snap%,Meta%,Cpy%Sync use single ioctl per LV.
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 81b488e..0880740 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -210,7 +210,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
* Set the 'cft' to work with based on whether we need the plain
* config tree or merged config tree cascade if --mergedconfig is used.
*/
- if ((arg_count(cmd, mergedconfig_ARG) || !strcmp(type, "full")) && cmd->cft->cascade) {
+ if ((arg_count(cmd, mergedconfig_ARG) || !strcmp(type, "full") || !strcmp(type, "diff")) && cmd->cft->cascade) {
if (!_merge_config_cascade(cmd, cmd->cft, &cft)) {
log_error("Failed to merge configuration.");
r = ECMD_FAILED;
7 years, 6 months
master - make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc37ee63c0562d...
Commit: fc37ee63c0562d3f42b597d485495ee79a857dc5
Parent: 21cefd3f07f4c6408d5c59c5afd41d3056706513
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 2 11:58:54 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 2 11:58:54 2016 +0200
make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean
---
daemons/lvmdbusd/Makefile.in | 2 ++
scripts/Makefile.in | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmdbusd/Makefile.in b/daemons/lvmdbusd/Makefile.in
index 9ee5b0b..c781452 100644
--- a/daemons/lvmdbusd/Makefile.in
+++ b/daemons/lvmdbusd/Makefile.in
@@ -63,3 +63,5 @@ install_lvm2: install_lvmdbusd
install: install_lvm2
+DISTCLEAN_TARGETS+= \
+ $(LVMDBUS_BUILDDIR_FILES)
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 6df7d05..9c3d72d 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -155,12 +155,14 @@ DISTCLEAN_TARGETS += \
blk_availability_systemd_red_hat.service \
clvmd_init_red_hat \
cmirrord_init_red_hat \
+ com.redhat.lvmdbus1.service \
dm_event_systemd_red_hat.service \
dm_event_systemd_red_hat.socket \
lvm2_cluster_activation_red_hat.sh \
lvm2_cluster_activation_systemd_red_hat.service \
lvm2_clvmd_systemd_red_hat.service \
lvm2_cmirrord_systemd_red_hat.service \
+ lvm2_lvmdbusd_systemd_red_hat.service \
lvm2_lvmetad_init_red_hat \
lvm2_lvmpolld_init_red_hat \
lvm2_lvmetad_systemd_red_hat.service \
7 years, 6 months
master - tests: check losetup -P is correctly handled
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a5d65b4a513b32...
Commit: a5d65b4a513b322def4b6da1d498e4491c9da6d0
Parent: d73a83e8cf508b6d97ee937a01ebd24a678dfabc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 1 17:25:55 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 1 17:37:52 2016 +0200
tests: check losetup -P is correctly handled
Validate pvcreate will not overwrite partitioned loop device.
---
test/shell/losetup_partscan.sh | 63 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/test/shell/losetup_partscan.sh b/test/shell/losetup_partscan.sh
new file mode 100644
index 0000000..90fafc0
--- /dev/null
+++ b/test/shell/losetup_partscan.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Check how lvm2 handles partitions over losetup -P devices
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which sfdisk || skip
+
+aux prepare_loop 1000 -P || skip
+
+test -f LOOP
+LOOP=$(< LOOP)
+
+echo "1 2" | sfdisk $LOOP
+
+# wait for links
+aux udev_wait
+
+# losetup -P should provide partition
+ls -la "${LOOP}"*
+test -e "${LOOP}p1"
+
+aux extend_filter "a|$LOOP|"
+
+# creation should fail for 'partitioned' loop device
+not pvcreate -y $LOOP
+not vgcreate vg $LOOP
+
+aux teardown_devs
+
+aux prepare_loop 1000 || skip
+
+test -f LOOP
+LOOP=$(< LOOP)
+
+
+echo "1 2" | sfdisk $LOOP
+
+# wait for links
+aux udev_wait
+
+# no partitione should be actually there
+ls -la "${LOOP}"*
+test ! -e "${LOOP}p1"
+
+aux extend_filter "a|$LOOP|"
+
+# creation should pass for 'non-partitioned' loop device
+pvcreate -y $LOOP
+
+vgcreate vg $LOOP
7 years, 6 months
master - devices: handle partscan loop devices
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d37a26b680f6c7...
Commit: d37a26b680f6c7ca9ec0bb1ce0cca189d19b525f
Parent: 3d333e5a296eba8ba2858ca007699fe70ec8083e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 1 16:39:47 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 1 17:37:47 2016 +0200
devices: handle partscan loop devices
Treat loop device created with 'losetup -P' as regular
partitioned device - so if it has partition table,
prevent its usage in commands like 'pvcreate'.
Before 'pvcreate /dev/loop0' could have erased and formated as PV,
after this patch, device is filtered out and cannot be used.
---
WHATS_NEW | 1 +
lib/device/dev-type.c | 43 +++++++++++++++++++++++++++++++++++++++++++
lib/device/dev-type.h | 1 +
3 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1bad12a..74b5bdb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Automatically filter out partitioned loop devices with partscan (losetup -P).
Fix lvm devtypes internal error if -S used with field name from pvs/vgs/lvs.
When reporting Data%,Snap%,Meta%,Cpy%Sync use single ioctl per LV.
Add lvseg_percent_with_info_and_seg_status() for percent retrieval.
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index f9f1418..0246c09 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -125,6 +125,9 @@ struct dev_types *create_dev_types(const char *proc_dir,
if (!strncmp("emcpower", line + i, 8) && isspace(*(line + i + 8)))
dt->emcpower_major = line_maj;
+ if (!strncmp("loop", line + i, 4) && isspace(*(line + i + 4)))
+ dt->loop_major = line_maj;
+
if (!strncmp("power2", line + i, 6) && isspace(*(line + i + 6)))
dt->power2_major = line_maj;
@@ -246,6 +249,9 @@ const char *dev_subsystem_name(struct dev_types *dt, struct device *dev)
if (MAJOR(dev->dev) == dt->blkext_major)
return "BLKEXT";
+ if (MAJOR(dev->dev) == dt->loop_major)
+ return "LOOP";
+
return "";
}
@@ -265,6 +271,38 @@ int major_is_scsi_device(struct dev_types *dt, int major)
return (dt->dev_type_array[major].flags & PARTITION_SCSI_DEVICE) ? 1 : 0;
}
+
+static int _loop_is_with_partscan(struct device *dev)
+{
+ FILE *fp;
+ int partscan = 0;
+ char path[PATH_MAX];
+ char buffer[64];
+
+ if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/loop/partscan",
+ dm_sysfs_dir(),
+ (int) MAJOR(dev->dev),
+ (int) MINOR(dev->dev)) < 0) {
+ log_warn("Sysfs path for partscan is too long.");
+ return 0;
+ }
+
+ if (!(fp = fopen(path, "r")))
+ return 0; /* not there -> no partscan */
+
+ if (!fgets(buffer, sizeof(buffer), fp)) {
+ log_warn("Failed to read %s.", path);
+ } else if (sscanf(buffer, "%d", &partscan) != 1) {
+ log_warn("Failed to parse %s '%s'.", path, buffer);
+ partscan = 0;
+ }
+
+ if (fclose(fp))
+ log_sys_debug("fclose", path);
+
+ return partscan;
+}
+
/* See linux/genhd.h and fs/partitions/msdos */
#define PART_MAGIC 0xAA55
#define PART_MAGIC_OFFSET UINT64_C(0x1FE)
@@ -294,6 +332,11 @@ static int _is_partitionable(struct dev_types *dt, struct device *dev)
if (MAJOR(dev->dev) == dt->md_major)
return 1;
+ /* All loop devices are partitionable via blkext (as of 3.2) */
+ if ((MAJOR(dev->dev) == dt->loop_major) &&
+ _loop_is_with_partscan(dev))
+ return 1;
+
if ((parts <= 1) || (MINOR(dev->dev) % parts))
return 0;
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index 6438b44..267b79f 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -43,6 +43,7 @@ struct dev_types {
int emcpower_major;
int power2_major;
int dasd_major;
+ int loop_major;
struct dev_type_def dev_type_array[NUMBER_OF_MAJORS];
};
7 years, 6 months
master - tests: extend prepare_loop
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d73a83e8cf508b...
Commit: d73a83e8cf508b6d97ee937a01ebd24a678dfabc
Parent: d37a26b680f6c7ca9ec0bb1ce0cca189d19b525f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 1 17:25:06 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 1 17:37:52 2016 +0200
tests: extend prepare_loop
Treat args after size as 'extra' params for losetup.
---
test/lib/aux.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 3bb469b..d51a65c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -553,6 +553,7 @@ teardown() {
prepare_loop() {
local size=${1=32}
+ local losetup_params=${@:2}
local i
local slash
@@ -577,9 +578,9 @@ prepare_loop() {
local LOOPFILE="$PWD/test.img"
rm -f "$LOOPFILE"
dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size + 1)) 2> /dev/null
- if LOOP=$(losetup -s -f "$LOOPFILE" 2>/dev/null); then
+ if LOOP=$(losetup ${losetup_params} -s -f "$LOOPFILE" 2>/dev/null); then
:
- elif LOOP=$(losetup -f) && losetup "$LOOP" "$LOOPFILE"; then
+ elif LOOP=$(losetup -f) && losetup ${losetup_params} "$LOOP" "$LOOPFILE"; then
# no -s support
:
else
@@ -590,7 +591,7 @@ prepare_loop() {
local dev="$DM_DEV_DIR/loop$slash$i"
! losetup "$dev" >/dev/null 2>&1 || continue
# got a free
- losetup "$dev" "$LOOPFILE"
+ losetup ${losetup_params} "$dev" "$LOOPFILE"
LOOP=$dev
break
done
7 years, 6 months
master - cleanup: use display_name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21cefd3f07f4c6...
Commit: 21cefd3f07f4c6408d5c59c5afd41d3056706513
Parent: a5d65b4a513b322def4b6da1d498e4491c9da6d0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 1 17:40:26 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 1 17:40:26 2016 +0200
cleanup: use display_name
---
lib/locking/lvmlockd.c | 7 +++----
lib/metadata/lv_manip.c | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index d718ac9..9eb7f92 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -369,18 +369,17 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
struct lvresize_params lp = {
.lv_name = vg->sanlock_lv->name,
.sign = SIGN_NONE,
+ .size = lv->size + ((extend_mb * 1024 * 1024) / SECTOR_SIZE),
.percent = PERCENT_NONE,
.resize = LV_EXTEND,
.ac_force = 1,
.sizeargs = 1,
};
- lp.size = lv->size + ((extend_mb * 1024 * 1024) / SECTOR_SIZE);
-
if (!lv_resize_prepare(cmd, lv, &lp, &vg->pvs) ||
!lv_resize(cmd, lv, &lp, &vg->pvs)) {
- log_error("Extend LV %s/%s to size %llu failed.",
- vg->name, lv->name, (unsigned long long)lp.size);
+ log_error("Extend LV %s to size %s failed.",
+ display_lvname(lv), display_size(cmd, lp.size));
return 0;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b31676d..a908e1e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5410,7 +5410,7 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
bad:
if (inactive && !deactivate_lv(cmd, lock_lv))
- log_error("Problem deactivating %s.", lock_lv->name);
+ log_error("Problem deactivating %s.", display_lvname(lock_lv));
return 0;
}
7 years, 6 months