daemon: lvm: Use lvcreate --yes to avoid interactive prompts.

See https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930996
This commit is contained in:
Richard W.M. Jones
2021-02-22 10:18:45 +00:00
parent a5e6e764c8
commit 4e87c9e46f
3 changed files with 39 additions and 1 deletions

View File

@@ -219,7 +219,7 @@ do_lvcreate (const char *logvol, const char *volgroup, int mbytes)
snprintf (size, sizeof size, "%d", mbytes);
r = command (NULL, &err,
"lvm", "lvcreate",
"lvm", "lvcreate", "--yes",
"-L", size, "-n", logvol, volgroup, NULL);
if (r == -1) {
reply_with_error ("%s", err);

View File

@@ -51,6 +51,7 @@ EXTRA_DIST = \
rhbz1370424.sh \
rhbz1370424.xml \
rhbz1477623.sh \
rhbz1930996.sh \
test-noexec-stack.pl
TESTS = \
@@ -82,6 +83,7 @@ TESTS = \
rhbz1285847.sh \
rhbz1370424.sh \
rhbz1477623.sh \
rhbz1930996.sh \
test-big-heap \
test-noexec-stack.pl \
$(SLOW_TESTS)

View File

@@ -0,0 +1,36 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2017-2021 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Regression test for:
# https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1
#
# Actually a bug/change in LVM, previously we failed to create an LV
# if the underlying disk contained a filesystem signature.
set -e
$TEST_FUNCTIONS
skip_if_skipped
skip_unless_phony_guest fedora.img
f=rhbz1930996.img
rm -f $f
guestfish -N $f=lvfs vgremove VG : vgcreate VG /dev/sda1 : lvcreate LV2 VG 100
rm $f