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

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