Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5bdcafff47ee6a2e57e0c…
Commit: 5bdcafff47ee6a2e57e0c57d18cbc36cf1a2973e
Parent: ab1f1a306bf8e146c1221786a1c1c24f8b71a377
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Dec 18 09:51:50 2018 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Dec 20 10:27:30 2018 -0600
lvmdbusd: Handle exported VG(s)
When a VG is exported, the 'fullreport' returns an exit code of 5, but
otherwise returns the data we are wanting.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/cmdhandler.py | 3 ++-
daemons/lvmdbusd/lvm_shell_proxy.py.in | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index a9177c5..fde7f5e 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -497,7 +497,8 @@ def lvm_full_report_json():
])
rc, out, err = call(cmd)
- if rc == 0:
+ # When we have an exported vg the exit code of lvs or fullreport will be 5
+ if rc == 0 or rc == 5:
# With the current implementation, if we are using the shell then we
# are using JSON and JSON is returned back to us as it was parsed to
# figure out if we completed OK or not
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index 203de6f..b76b336 100644
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -220,7 +220,10 @@ class LVMShellProxy(object):
# Parse the report to see what happened
if 'log' in report_json:
- if report_json['log'][-1:][0]['log_ret_code'] == '1':
+ ret_code = int(report_json['log'][-1:][0]['log_ret_code'])
+ # If we have an exported vg we get a log_ret_code == 5 when
+ # we do a 'fullreport'
+ if (ret_code == 1) or (ret_code == 5 and argv[0] == 'fullreport'):
rc = 0
else:
error_msg = self.get_error_msg()
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9785e40b8d52fd87d7c45…
Commit: 9785e40b8d52fd87d7c451ed838f450aee41ba8d
Parent: f05104af76e26f0757df1500540e767dd889ae71
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Dec 19 12:54:14 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Dec 20 13:26:55 2018 +0100
dmeventd: resolve compilation of vdo status parsing
A bit of chicken & egg problem - dmeventd needs to use old libdm library.
VDO is only part of new device_mapper internal library.
So include directly source file for parsing status - this fixes usability
problem of VDO plugin introduced with previous Makefile reshaping
patchset.
NOTE: source file needs to be keep then compilable in both environments.
Also add missing copyright header.
---
daemons/dmeventd/plugins/vdo/dmeventd_vdo.c | 4 +++-
device_mapper/vdo/status.c | 22 ++++++++++++++++++++--
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c b/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
index b5e2766..d5156cd 100644
--- a/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
+++ b/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
@@ -15,7 +15,9 @@
#include "lib/misc/lib.h"
#include "daemons/dmeventd/plugins/lvm2/dmeventd_lvm.h"
#include "daemons/dmeventd/libdevmapper-event.h"
-#include "device_mapper/vdo/target.h"
+
+/* Use parser from new device_mapper library */
+#include "device_mapper/vdo/status.c"
#include <sys/wait.h>
#include <stdarg.h>
diff --git a/device_mapper/vdo/status.c b/device_mapper/vdo/status.c
index 40e69ba..a34029d 100644
--- a/device_mapper/vdo/status.c
+++ b/device_mapper/vdo/status.c
@@ -1,8 +1,26 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of the device-mapper userspace tools.
+ *
+ * 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 Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+/* Note: this object is also used by VDO dmeventd plugin for parsing status */
+/* File could be included by VDO plugin and can use original libdm library */
+#ifndef LIB_DMEVENT_H
#include "configure.h"
-#include "target.h"
-
// For DM_ARRAY_SIZE!
#include "device_mapper/all.h"
+#endif
+
+#include "device_mapper/vdo/target.h"
#include "base/memory/zalloc.h"
#include <ctype.h>
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e82303fd6abc3ae43168f…
Commit: e82303fd6abc3ae43168f8032806c7c17d181a3e
Parent: 1f1d36f6a2b441fbf84e59f435bd5169459392b1
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Dec 17 19:24:37 2018 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Dec 17 19:28:54 2018 +0100
lvcreate/lvconvert: optionally reenable mirrored mirror log for testing purposes only
This is a followup patch to commit edb72cb70cb8abd0acb92f07937715be2816d04a
to support related lvm2 test suite tests.
A 'global/support_mirrored_mirror_log' bool configuration variable gets
introduced allowing the creation of, or conversion to mirrored 'mirror'
logs if set. The capability to create these in turn allows the rest of
the tests to perform activation of such existing LVs and their conversions
to disk/core 'mirror' logs.
Display a disclaimer warning if enabled that this is not for regular use.
Add definition of the enabled config option to respective test scripts.
Related: rhbz1643562
---
conf/example.conf.in | 11 +++++++++++
lib/config/config_settings.h | 11 +++++++++++
lib/metadata/mirror.c | 10 +++++++---
test/shell/lvconvert-mirror.sh | 2 ++
test/shell/lvconvert-repair-replace.sh | 4 +++-
test/shell/lvconvert-repair.sh | 4 +++-
test/shell/lvconvert-twostep.sh | 4 +++-
test/shell/lvcreate-operation.sh | 4 +++-
test/shell/snapshots-of-mirrors.sh | 4 +++-
test/shell/vgsplit-operation.sh | 4 +++-
10 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 0204f4b..85465f5 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -904,6 +904,17 @@ global {
#
mirror_segtype_default = "@DEFAULT_MIRROR_SEGTYPE@"
+ # Configuration option global/support_mirrored_mirror_log.
+ # Enable mirrored 'mirror' log type for testing.
+ #
+ # This type is deprecated to create or convert to but can
+ # be enabled to test that activation of existing mirrored
+ # logs and conversion to disk/core works.
+ #
+ # Not supported for regular operation!
+ #
+ support_mirrored_mirror_log = 0
+
# Configuration option global/raid10_segtype_default.
# The segment type used by the -i -m combination.
# The --type raid10|mirror option overrides this setting.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index e473dd5..b0fcf8a 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -960,6 +960,17 @@ cfg(global_mirror_segtype_default_CFG, "mirror_segtype_default", global_CFG_SECT
" fashion in a cluster.\n"
"#\n")
+cfg(global_support_mirrored_mirror_log_CFG, "support_mirrored_mirror_log", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 3, 2), NULL, 0, NULL,
+ "Configuration option global/support_mirrored_mirror_log.\n"
+ "Enable mirrored 'mirror' log type for testing.\n"
+ "#\n"
+ "This type is deprecated to create or convert to but can\n"
+ "be enabled to test that activation of existing mirrored\n"
+ "logs and conversion to disk/core works.\n"
+ "#\n"
+ "Not supported for regular operation!\n"
+ "\n")
+
cfg(global_raid10_segtype_default_CFG, "raid10_segtype_default", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_RAID10_SEGTYPE, vsn(2, 2, 99), "@DEFAULT_RAID10_SEGTYPE@", 0, NULL,
"The segment type used by the -i -m combination.\n"
"The --type raid10|mirror option overrides this setting.\n"
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 8b20979..6950546 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2008,2018 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -1908,8 +1908,12 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
}
if (log_count > 1) {
- log_err("Log type \"mirrored\" is DEPRECATED. Use RAID1 LV or disk log instead.");
- return 0;
+ if (find_config_tree_bool(cmd, global_support_mirrored_mirror_log_CFG, NULL))
+ log_warn("Log type \"mirrored\" creation/conversion is not supported for regular operation!");
+ else {
+ log_err("Log type \"mirrored\" is DEPRECATED. Use RAID1 LV or disk log instead.");
+ return 0;
+ }
}
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0)))
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 8f37645..7cf498d 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -14,6 +14,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
aux prepare_pvs 5
get_devs
diff --git a/test/shell/lvconvert-repair-replace.sh b/test/shell/lvconvert-repair-replace.sh
index 1fe7965..3cd1fac 100644
--- a/test/shell/lvconvert-repair-replace.sh
+++ b/test/shell/lvconvert-repair-replace.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008,2018 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
@@ -14,6 +14,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
aux prepare_vg 6
aux lvmconf 'allocation/maximise_cling = 0' \
'allocation/mirror_logs_require_separate_pvs = 1'
diff --git a/test/shell/lvconvert-repair.sh b/test/shell/lvconvert-repair.sh
index 5f7b851..ae8fa7e 100644
--- a/test/shell/lvconvert-repair.sh
+++ b/test/shell/lvconvert-repair.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2008-2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008-2013,2018 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
@@ -12,6 +12,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
recreate_vg_()
{
vgremove -ff $vg
diff --git a/test/shell/lvconvert-twostep.sh b/test/shell/lvconvert-twostep.sh
index 44527f0..afc9d47 100644
--- a/test/shell/lvconvert-twostep.sh
+++ b/test/shell/lvconvert-twostep.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2010,2018 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
@@ -14,6 +14,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
aux prepare_vg 4
lvcreate -aey --type mirror -m 1 --mirrorlog disk --ignoremonitoring -L 1 -n mirror $vg
diff --git a/test/shell/lvcreate-operation.sh b/test/shell/lvcreate-operation.sh
index 5faa39f..568af36 100644
--- a/test/shell/lvcreate-operation.sh
+++ b/test/shell/lvcreate-operation.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008,2018 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
@@ -17,6 +17,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
cleanup_lvs() {
lvremove -ff $vg
(dm_table | not grep $vg) || \
diff --git a/test/shell/snapshots-of-mirrors.sh b/test/shell/snapshots-of-mirrors.sh
index 48cadc5..f2f2943 100644
--- a/test/shell/snapshots-of-mirrors.sh
+++ b/test/shell/snapshots-of-mirrors.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2010,2018 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
@@ -14,6 +14,8 @@
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
aux prepare_vg 4
lvcreate -aey --type mirror -m 1 -L 10M --nosync -n lv $vg
diff --git a/test/shell/vgsplit-operation.sh b/test/shell/vgsplit-operation.sh
index ab88866..eb24a58 100644
--- a/test/shell/vgsplit-operation.sh
+++ b/test/shell/vgsplit-operation.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007,2018 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
@@ -17,6 +17,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+aux lvmconf "global/support_mirrored_mirror_log=1"
+
COMM() {
LAST_TEST="$*"
}