Blame SOURCES/0007-daemon-lvm-Use-lvcreate-yes-to-avoid-interactive-pro.patch

ff8314
From 22416a2329ec531b9608c21b11ff3d53275fe7a0 Mon Sep 17 00:00:00 2001
12670e
From: "Richard W.M. Jones" <rjones@redhat.com>
12670e
Date: Mon, 22 Feb 2021 10:18:45 +0000
12670e
Subject: [PATCH] daemon: lvm: Use lvcreate --yes to avoid interactive prompts.
12670e
12670e
See https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1
12670e
12670e
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930996
ff8314
(cherry picked from commit 21cd97732c4973db835b8b6540c8ad582ebd2bda)
12670e
---
12670e
 daemon/lvm.c                     |  2 +-
12670e
 tests/regressions/Makefile.am    |  2 ++
12670e
 tests/regressions/rhbz1930996.sh | 36 ++++++++++++++++++++++++++++++++
12670e
 3 files changed, 39 insertions(+), 1 deletion(-)
12670e
 create mode 100755 tests/regressions/rhbz1930996.sh
12670e
12670e
diff --git a/daemon/lvm.c b/daemon/lvm.c
ff8314
index 841dc4b6b..72c59c3a1 100644
12670e
--- a/daemon/lvm.c
12670e
+++ b/daemon/lvm.c
12670e
@@ -219,7 +219,7 @@ do_lvcreate (const char *logvol, const char *volgroup, int mbytes)
12670e
   snprintf (size, sizeof size, "%d", mbytes);
12670e
 
12670e
   r = command (NULL, &err,
12670e
-               "lvm", "lvcreate",
12670e
+               "lvm", "lvcreate", "--yes",
12670e
                "-L", size, "-n", logvol, volgroup, NULL);
12670e
   if (r == -1) {
12670e
     reply_with_error ("%s", err);
12670e
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
ff8314
index ecb0d68a7..c1e0ee8a9 100644
12670e
--- a/tests/regressions/Makefile.am
12670e
+++ b/tests/regressions/Makefile.am
ff8314
@@ -49,6 +49,7 @@ EXTRA_DIST = \
12670e
 	rhbz1370424.sh \
12670e
 	rhbz1370424.xml \
12670e
 	rhbz1477623.sh \
12670e
+	rhbz1930996.sh \
12670e
 	test-noexec-stack.pl
12670e
 
12670e
 TESTS = \
ff8314
@@ -79,6 +80,7 @@ TESTS = \
12670e
 	rhbz1285847.sh \
12670e
 	rhbz1370424.sh \
12670e
 	rhbz1477623.sh \
12670e
+	rhbz1930996.sh \
12670e
 	test-big-heap \
12670e
 	test-noexec-stack.pl \
12670e
 	$(SLOW_TESTS)
12670e
diff --git a/tests/regressions/rhbz1930996.sh b/tests/regressions/rhbz1930996.sh
12670e
new file mode 100755
12670e
index 000000000..27089beaa
12670e
--- /dev/null
12670e
+++ b/tests/regressions/rhbz1930996.sh
12670e
@@ -0,0 +1,36 @@
12670e
+#!/bin/bash -
12670e
+# libguestfs
12670e
+# Copyright (C) 2017-2021 Red Hat Inc.
12670e
+#
12670e
+# This program is free software; you can redistribute it and/or modify
12670e
+# it under the terms of the GNU General Public License as published by
12670e
+# the Free Software Foundation; either version 2 of the License, or
12670e
+# (at your option) any later version.
12670e
+#
12670e
+# This program is distributed in the hope that it will be useful,
12670e
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
12670e
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12670e
+# GNU General Public License for more details.
12670e
+#
12670e
+# You should have received a copy of the GNU General Public License
12670e
+# along with this program; if not, write to the Free Software
12670e
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
12670e
+
12670e
+# Regression test for:
12670e
+# https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1
12670e
+#
12670e
+# Actually a bug/change in LVM, previously we failed to create an LV
12670e
+# if the underlying disk contained a filesystem signature.
12670e
+
12670e
+set -e
12670e
+
12670e
+$TEST_FUNCTIONS
12670e
+skip_if_skipped
12670e
+skip_unless_phony_guest fedora.img
12670e
+
12670e
+f=rhbz1930996.img
12670e
+rm -f $f
12670e
+
12670e
+guestfish -N $f=lvfs vgremove VG : vgcreate VG /dev/sda1 : lvcreate LV2 VG 100
12670e
+
12670e
+rm $f
12670e
-- 
e29d66
2.31.1
12670e