[lvm-devel] master - tests: check read-only backup archive

Zdenek Kabelac zkabelac at fedoraproject.org
Thu Dec 3 17:22:31 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=89418c1253db901eb6f22b342bc5d98d63aa32e5
Commit:        89418c1253db901eb6f22b342bc5d98d63aa32e5
Parent:        d2524315e6e9ed6796555d8cafbaf56470260b11
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Thu Dec 3 18:16:07 2015 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Thu Dec 3 18:17:45 2015 +0100

tests: check read-only backup archive

---
 test/shell/backup-read-only.sh |   70 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/test/shell/backup-read-only.sh b/test/shell/backup-read-only.sh
new file mode 100644
index 0000000..810db0d
--- /dev/null
+++ b/test/shell/backup-read-only.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# Copyright (C) 2015 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+SKIP_WITH_CLVMD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext3 || skip
+
+aux prepare_vg 2
+
+# Note: inittest.sh  sets   LVM_SYSTEM_DIR to 'just' etc
+etc_lv="$DM_DEV_DIR/$vg/$lv1"
+
+cleanup_mounted_and_teardown()
+{
+	umount "$mount_dir" || true
+	aux teardown
+}
+
+vgreduce $vg "$dev2"
+
+lvcreate -n $lv1 -l 20%FREE $vg
+mkfs.ext3 -b4096 -j "$etc_lv"
+
+#
+# check  read-only  archive dir
+#
+mount_dir="etc/archive"
+trap 'cleanup_mounted_and_teardown' EXIT
+mkdir -p "$mount_dir"
+mount -n -r "$etc_lv" "$mount_dir"
+
+aux lvmconf "backup/archive = 1" "backup/backup = 1"
+
+# cannot archive to read-only
+not lvcreate -n $lv2 -l 10%FREE $vg
+lvcreate -An -n $lv2 -l 10%FREE $vg
+
+not vgextend  $vg "$dev2"
+vgextend -An $vg "$dev2"
+
+umount "$mount_dir" || true
+
+vgreduce $vg "$dev2"
+
+#
+# check  read-only  backup dir
+#
+mount_dir="etc/backup"
+mount -n -r "$etc_lv" "$mount_dir"
+
+lvcreate -n $lv3 -l 10%FREE $vg
+vgextend $vg "$dev2"
+
+umount "$mount_dir" || true
+#ls -laR
+#grep "" etc/archive/*
+
+# TODO maybe also support --ignorelockingfailure ??
+vgremove -ff $vg




More information about the lvm-devel mailing list