diff --git a/0001-daemon-copy-entire-lvm-directory.patch b/0001-daemon-copy-entire-lvm-directory.patch new file mode 100644 index 0000000..7f9cf68 --- /dev/null +++ b/0001-daemon-copy-entire-lvm-directory.patch @@ -0,0 +1,50 @@ +From 8e911927825bcb326359d21ff38f0563a7346a10 Mon Sep 17 00:00:00 2001 +From: Olaf Hering +Date: Wed, 2 Jan 2013 15:27:39 +0100 +Subject: [PATCH] daemon: copy entire lvm directory + +cp will fail if /etc/lvm is an empty directory. Copy the entire +directory and adjust environment variable. + +Signed-off-by: Olaf Hering +--- + daemon/lvm-filter.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c +index 52d6b3d..204e238 100644 +--- a/daemon/lvm-filter.c ++++ b/daemon/lvm-filter.c +@@ -47,7 +47,7 @@ void + copy_lvm (void) + { + struct stat statbuf; +- char cmd[64]; ++ char cmd[64], env[64]; + int r; + + /* If /etc/lvm directory doesn't exist (or isn't a directory) assume +@@ -68,8 +68,8 @@ copy_lvm (void) + exit (EXIT_FAILURE); + } + +- /* Hopefully no dotfiles in there ... XXX */ +- snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/* %s", str_cp, lvm_system_dir); ++ /* Copy the entire directory */ ++ snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/ %s", str_cp, lvm_system_dir); + r = system (cmd); + if (r == -1) { + perror (cmd); +@@ -85,7 +85,8 @@ copy_lvm (void) + } + + /* Set environment variable so we use the copy. */ +- setenv ("LVM_SYSTEM_DIR", lvm_system_dir, 1); ++ snprintf(env, sizeof(env), "%s/lvm", lvm_system_dir); ++ setenv ("LVM_SYSTEM_DIR", env, 1); + + /* Set a handler to remove the temporary directory at exit. */ + atexit (rm_lvm_system_dir); +-- +1.8.0.1 + diff --git a/libguestfs.changes b/libguestfs.changes index e5081ae..592c2ac 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jan 2 16:00:13 CET 2013 - ohering@suse.de + +- copy entire /etc/lvm directory in guestfsd (bnc#795503) + ------------------------------------------------------------------- Mon Dec 17 23:48:22 CET 2012 - ohering@suse.de diff --git a/libguestfs.spec b/libguestfs.spec index fc886b9..3e162f6 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -104,6 +104,7 @@ License: GPL-2 Group: System/Filesystems Version: 1.20.0 Release: 0 +Patch795503: 0001-daemon-copy-entire-lvm-directory.patch Patch5: libguestfs-1.13.14-ruby.patch Patch1000: 1000-force-virtio_blk-in-old-guest-kernel.patch Source0: %{name}-%{version}.tar.gz @@ -384,6 +385,7 @@ virtual machines. %prep %setup -q -a 789653 +%patch795503 -p1 %patch5 -p1 %patch1000 -p1