summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-12-10 13:43:54 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-12-10 14:00:56 +0100
commitb21a8412c482ae735d0d044d355e1541ccba6edf (patch)
tree86e1fd75974a58eedb220a726e6559dee678a592
parent00b36ef06acb15c82d7c9b37872753f02c638316 (diff)
downloadlvm2-b21a8412c482ae735d0d044d355e1541ccba6edf.tar.gz
vgimportclone: also notify lvmetad about changes if it's used
All the LVM commands are run in mode without lvmetad use (since lvmetad can't handle duplicates). When we're finished with vgimportclone, we need to notify lvmetad about changes. Before this patch (/dev/sda and /dev/sdb contains a copy VG called "vg"): $ vgimportclone --basevgname vg_snap /dev/sdb WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: Activation disabled. No device-mapper interaction will be attempted. WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Physical volume "/tmp/snap.zcJ8LCmj/vgimport0" changed 1 physical volume changed / 0 physical volumes not changed WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: Activation disabled. No device-mapper interaction will be attempted. WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully changed WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully renamed to "vg_snap" Reading all physical volumes. This may take a while... Found volume group "vg" using metadata type lvm2 Found volume group "fedora" using metadata type lvm2 $ vgs VG #PV #LV #SN Attr VSize VFree fedora 1 2 0 wz--n- 9.50g 0 vg 1 1 0 wz--n- 124.00m 120.00m (...lvmetad doesn't see the new "vg_snap"!) With this patch applied: $ vgimportclone --basevgname vg_snap /dev/sdb ... WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully renamed to "vg_snap" Notifying lvmetad about changes since it was disabled temporarily. Reading all physical volumes. This may take a while... Found volume group "vg_snap" using metadata type lvm2 Found volume group "fedora" using metadata type lvm2 Found volume group "vg" using metadata type lvm2 $ vgs VG #PV #LV #SN Attr VSize VFree fedora 1 2 0 wz--n- 9.50g 0 vg 1 1 0 wz--n- 124.00m 120.00m vg_snap 1 1 0 wz--n- 124.00m 120.00m The "restart lvmetad before enabling it" message is a bit misleading here - we should probably suppress this one, but we can't suppress warning messages selectively at the moment and we don't want to lose other warning/error messages printed...
-rw-r--r--WHATS_NEW1
-rwxr-xr-xscripts/vgimportclone.sh9
2 files changed, 10 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 72d3b6a05..5e1b143d0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.115 -
=====================================
+ Fix vgimportclone to notify lvmetad about changes done if lvmetad is used.
Fix vgimportclone to properly override config if it is missing in lvm.conf.
Fix automatic use of configure --enable-udev-systemd-background-jobs.
Correctly rename active split LV with -splitmirrors for raid1.
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index bfff13110..719cd8dbb 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -363,6 +363,15 @@ fi
### the device nodes we need are straight
if [ ${CHANGES_MADE} -eq 1 ]
then
+ # get global/use_lvmetad config and if set also notify lvmetad about changes
+ # since we were running LVM commands above with use_lvmetad=0
+ eval $(${LVM} dumpconfig ${LVM_OPTS} global/use_lvmetad)
+ if [ "$use_lvmetad" = "1" ]
+ then
+ echo "Notifying lvmetad about changes since it was disabled temporarily."
+ LVM_OPTS="${LVM_OPTS} --cache"
+ fi
+
"$LVM" vgscan ${LVM_OPTS} --mknodes
fi