[PATCH v2 00/11] Getting it work with SLES / openSUSE
by Cédric Bosdonnat
Hi all,
v2 includes all comments from Pino and Richard. I also removed the
mkdir /run/lvm in the init since it only failed in one case and couldn't
reproduce it anymore.
Cédric Bosdonnat (11):
v2v: also search for windows virtio drivers in symlinks
Update packagelist for SLES and openSUSE
customize: fix windows firstboot script
customize: change windows firstboot path
customize: add support for pvvxsvc
v2v: document SUSE's Xen as a working input hypervisor
v2v: add support for SUSE VMDP drivers
v2v: don't set spice display if QXL isn't supported
appliance: skip /etc/mtab creation is already existing
v2v: rename RHEL 5 Xen input section into Xen in man
v2v: improve initrd search
appliance/init | 4 +-
appliance/packagelist.in | 4 ++
builder/virt-builder.pod | 13 +++++--
customize/firstboot.ml | 51 ++++++++++++++-----------
customize/virt-customize.pod | 6 +++
sysprep/virt-sysprep.pod | 6 +++
v2v/convert_linux.ml | 10 ++---
v2v/convert_windows.ml | 78 ++++++++++++++++++++++++++++----------
v2v/output_libvirt.ml | 4 +-
v2v/test-v2v-in-place.sh | 2 +-
v2v/test-v2v-virtio-win-iso.sh | 2 +-
v2v/test-v2v-windows-conversion.sh | 2 +-
v2v/virt-v2v.pod | 15 ++++++--
v2v/windows_virtio.ml | 37 ++++++++++++------
14 files changed, 163 insertions(+), 71 deletions(-)
--
2.6.6
8 years, 7 months
[PATCH] protocol: Ignore rest of option when replying with error
by Eric Blake
We must consume the payload of any option received, whether or
not we can answer the option successfully, in order to be in
sync for reading the next option. This is particularly true
once clients start using NBD_OPT_GO, as long as we don't happen
to service that option.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/connections.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/connections.c b/src/connections.c
index 0c93f35..840e315 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -334,6 +334,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn)
if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID)
== -1)
return -1;
+ if (xread (conn->sockin, data, optlen) == -1) {
+ nbdkit_error ("read: %m");
+ return -1;
+ }
continue;
}
@@ -351,6 +355,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn)
/* Unknown option. */
if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_UNSUP) == -1)
return -1;
+ if (xread (conn->sockin, data, optlen) == -1) {
+ nbdkit_error ("read: %m");
+ return -1;
+ }
}
/* Note, since it's not very clear from the protocol doc, that the
--
2.5.5
8 years, 7 months
[PATCH] tests: disable UUID change on ext journal_dev
by Pino Toscano
Newer versions of e2fsprogs refuse modifying journal devices, causing
the test #1 of get_e2uuid to fail with:
libguestfs: error: set_e2uuid: Cannot modify a journal device.
Since the test case just needs to verify get_e2uuid runs without
failing, run it without expecting a certain UUID set earlier.
Followup of commit da4812ab6b44c29cb3cf181c7aa896420ecb8aa6.
---
generator/actions.ml | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/generator/actions.ml b/generator/actions.ml
index 3566371..b17808e 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -5349,14 +5349,13 @@ of a filesystem." };
style = RString "uuid", [Device "device"], [];
proc_nr = Some 83;
deprecated_by = Some "vfs_uuid";
- tests =
- (* Regression test for RHBZ#597112. *)
- (let uuid = uuidgen () in [
- InitNone, Always, TestResultString (
- [["mke2journal"; "1024"; "/dev/sdc"];
- ["set_e2uuid"; "/dev/sdc"; uuid];
- ["get_e2uuid"; "/dev/sdc"]], uuid), []
- ]);
+ tests = [
+ (* We can't predict what UUID will be, so just check
+ the command run; regression test for RHBZ#597112. *)
+ InitNone, Always, TestRun (
+ [["mke2journal"; "1024"; "/dev/sdc"];
+ ["get_e2uuid"; "/dev/sdc"]]), []
+ ];
shortdesc = "get the ext2/3/4 filesystem UUID";
longdesc = "\
This returns the ext2/3/4 filesystem UUID of the filesystem on
--
2.5.5
8 years, 7 months
[PATCH 1/2] customize: minor function factoring in ssh_key
by Pino Toscano
Turn the snippet reading user information from /etc/passwd in a slightly
more generic function, so there is no need to copy&paste for other
details.
Mostly code motion.
---
customize/ssh_key.ml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/customize/ssh_key.ml b/customize/ssh_key.ml
index a4e4a51..7c482e7 100644
--- a/customize/ssh_key.ml
+++ b/customize/ssh_key.ml
@@ -106,13 +106,15 @@ let do_ssh_inject_unix (g : Guestfs.guestfs) user selector =
(* Get user's home directory. *)
g#aug_init "/" 0;
- let home_dir =
+ let read_user_detail what =
try
- let expr = sprintf "/files/etc/passwd/%s/home" user in
+ let expr = sprintf "/files/etc/passwd/%s/%s" user what in
g#aug_get expr
with G.Error _ ->
error (f_"ssh-inject: the user %s does not exist on the guest")
- user in
+ user
+ in
+ let home_dir = read_user_detail "home" in
g#aug_close ();
(* Create ~user/.ssh if it doesn't exist. *)
--
2.5.5
8 years, 7 months
[PATCH 0/3] misc tests-only changes
by Pino Toscano
Hi,
small series with small improvements to the tests.
Pino Toscano (3):
tests: specify the image format when possible
tests: remove remaining relative paths to binaries
fish: generate test-prep.sh with generator
.gitignore | 1 +
align/test-virt-alignment-scan.sh | 2 +-
cat/Makefile.am | 2 +-
cat/test-virt-cat.sh | 4 ++--
cat/test-virt-filesystems.sh | 4 ++--
cat/test-virt-log.sh | 2 +-
cat/test-virt-ls.sh | 4 ++--
customize/test-virt-customize.sh | 2 +-
df/Makefile.am | 2 +-
df/test-virt-df.sh | 2 +-
diff/test-virt-diff.sh | 4 ++--
edit/test-virt-edit.sh | 6 +++---
fish/test-copy.sh | 2 +-
fish/test-inspect.sh | 2 +-
fish/test-prep.sh | 35 -------------------------------
fish/test-run.sh | 2 +-
format/test-virt-format.sh | 4 ++--
fuse/test-fuse-umount-race.sh | 6 +++---
fuse/test-guestmount-fd.c | 4 ++--
fuse/test-guestunmount-fd.c | 2 +-
fuse/test-guestunmount-not-mounted.sh | 2 +-
generator/fish.ml | 33 +++++++++++++++++++++++++++++
generator/fish.mli | 1 +
generator/main.ml | 1 +
inspector/Makefile.am | 2 +-
inspector/test-virt-inspector.sh | 2 +-
rescue/test-virt-rescue-suggest.sh | 2 +-
rescue/test-virt-rescue.pl | 2 +-
sparsify/test-virt-sparsify-in-place.sh | 2 +-
sparsify/test-virt-sparsify.sh | 2 +-
sysprep/Makefile.am | 6 +++---
sysprep/test-virt-sysprep-passwords.sh | 1 +
sysprep/test-virt-sysprep-script.sh | 8 +++----
sysprep/test-virt-sysprep.sh | 2 +-
test-data/phony-guests/make-fedora-img.pl | 6 +++---
tests/gdisk/test-expand-gpt.pl | 4 ++--
tests/md/test-inspect-fstab-md.sh | 6 +++---
tests/md/test-inspect-fstab.sh | 8 +++----
tests/md/test-list-md-devices.sh | 2 +-
tests/mountable/test-mountable-inspect.sh | 4 ++--
tests/ntfs/test-ntfscat.sh | 2 +-
tests/ntfs/test-ntfsclone.sh | 2 +-
tests/regressions/rhbz1011907-1165785.sh | 4 ++--
tests/regressions/rhbz1054761.sh | 2 +-
tests/regressions/rhbz1174551.sh | 2 +-
tests/regressions/rhbz1285847.sh | 2 +-
tests/regressions/rhbz563450.sh | 4 ++--
tests/regressions/rhbz580246.sh | 2 +-
tests/regressions/rhbz690819.sh | 2 +-
tests/regressions/rhbz789960.sh | 2 +-
tests/regressions/rhbz811649.sh | 2 +-
tests/regressions/rhbz975797.sh | 6 +++---
tests/tsk/test-download-inode.sh | 2 +-
tools/test-virt-list-filesystems.sh | 2 +-
54 files changed, 113 insertions(+), 111 deletions(-)
delete mode 100755 fish/test-prep.sh
--
2.5.5
8 years, 7 months
[PATCH] v2v: handle subfolders in ova files
by Cédric Bosdonnat
Some ova files have their ovf and other files inside a folder rather
than at the root of the tarball. Consider the paths relative to the
ovf file to cover this case too.
---
v2v/Makefile.am | 1 +
v2v/input_ova.ml | 3 +-
v2v/test-v2v-i-ova-subfolders.sh | 88 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+), 1 deletion(-)
create mode 100755 v2v/test-v2v-i-ova-subfolders.sh
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 0203317..1d219b6 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -294,6 +294,7 @@ TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = \
test-v2v-i-ova-formats.sh \
test-v2v-i-ova-gz.sh \
+ test-v2v-i-ova-subfolders.sh \
test-v2v-i-ova-two-disks.sh \
test-v2v-copy-to-local.sh \
test-v2v-bad-networks-and-bridges.sh
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 1aba662..b0d9357 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -165,6 +165,7 @@ object
) mf;
(* Parse the ovf file. *)
+ let ovf_folder = Filename.dirname ovf in
let xml = read_whole_file ovf in
let doc = Xml.parse_memory xml in
@@ -265,7 +266,7 @@ object
| Some s -> s in
(* Does the file exist and is it readable? *)
- let filename = exploded // filename in
+ let filename = ovf_folder // filename in
Unix.access filename [Unix.R_OK];
(* The spec allows the file to be gzip-compressed, in which case
diff --git a/v2v/test-v2v-i-ova-subfolders.sh b/v2v/test-v2v-i-ova-subfolders.sh
new file mode 100755
index 0000000..fd59f07
--- /dev/null
+++ b/v2v/test-v2v-i-ova-subfolders.sh
@@ -0,0 +1,88 @@
+#!/bin/bash -
+# libguestfs virt-v2v test script
+# Copyright (C) 2014 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.
+
+# Test -i ova option.
+
+unset CDPATH
+export LANG=C
+set -e
+set -x
+
+if [ -n "$SKIP_TEST_V2V_I_OVA_SH" ]; then
+ echo "$0: test skipped because environment variable is set"
+ exit 77
+fi
+
+if [ "$(guestfish get-backend)" = "uml" ]; then
+ echo "$0: test skipped because UML backend does not support network"
+ exit 77
+fi
+
+f=../test-data/phony-guests/windows.img
+if ! test -f $f || ! test -s $f; then
+ echo "$0: test skipped because phony Windows image was not created"
+ exit 77
+fi
+
+export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
+export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
+
+. $srcdir/../test-data/guestfs-hashsums.sh
+
+d=test-v2v-i-ova-subfolders.d
+rm -rf $d
+mkdir -p $d/subfolder
+
+vmdk=test-ova.vmdk
+ovf=test-v2v-i-ova.ovf
+mf=test-ova.mf
+ova=test-ova-subfolders.ova
+raw=TestOva-sda
+
+qemu-img convert $f -O vmdk $d/subfolder/$vmdk
+cp $ovf $d/subfolder/$ovf
+sha1=`do_sha1 $d/subfolder/$ovf`
+echo "SHA1($ovf)= $sha1" > $d/subfolder/$mf
+sha1=`do_sha1 $d/subfolder/$vmdk`
+echo "SHA1($vmdk)= $sha1" >> $d/subfolder/$mf
+
+pushd .
+cd $d
+tar -cf $ova subfolder
+rm -rf subfolder
+popd
+
+$VG virt-v2v --debug-gc \
+ -i ova $d/$ova \
+ -o local -of raw -os $d
+
+# Test the libvirt XML metadata and a disk was created.
+test -f $d/$raw
+test -f $d/TestOva.xml
+
+# Normalize the XML output.
+mv $d/TestOva.xml $d/TestOva.xml.old
+sed \
+ -e "s,source file='.*TestOva-sda',source file='TestOva-sda'," \
+ -e "s,generated by.*--,generated by --," \
+ < $d/TestOva.xml.old > $d/TestOva.xml
+
+# Check the libvirt XML output.
+diff -u test-v2v-i-ova.xml $d/TestOva.xml
+
+rm -rf $d
--
2.6.6
8 years, 7 months
[PATCH v2] drives: force format=raw for /dev/null dummy drives
by Pino Toscano
When creating the dummy scratch disk for a /dev/null drive, force its
format as raw if it was not specified already. After all, raw was
already the only format allowed for this kind of drives, so it makes
sense to specify the format explicitly and avoid the autodetection in
qemu.
---
src/drives.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/drives.c b/src/drives.c
index c55b87e..5e7eb12 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -410,9 +410,15 @@ create_drive_dev_null (guestfs_h *g,
{
CLEANUP_FREE char *tmpfile = NULL;
- if (data->format && STRNEQ (data->format, "raw")) {
- error (g, _("for device '/dev/null', format must be 'raw'"));
- return NULL;
+ if (data->format) {
+ if (STRNEQ (data->format, "raw")) {
+ error (g, _("for device '/dev/null', format must be 'raw'"));
+ return NULL;
+ }
+ } else {
+ /* Manual set format=raw for /dev/null drives, if that was not
+ * already manually specified. */
+ data->format = "raw";
}
if (guestfs_int_lazy_make_tmpdir (g) == -1)
--
2.5.5
8 years, 7 months
[PATCH] drives: force format=raw for /dev/null dummy drives
by Pino Toscano
When creating the dummy scratch disk for a /dev/null drive, force its
format as raw if it was not specified already. After all, raw was
already the only format allowed for this kind of drives, so it makes
sense to specify the format explicitly and avoid the autodetection in
qemu.
---
src/drives.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/drives.c b/src/drives.c
index c55b87e..1a4ae27 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -410,9 +410,15 @@ create_drive_dev_null (guestfs_h *g,
{
CLEANUP_FREE char *tmpfile = NULL;
- if (data->format && STRNEQ (data->format, "raw")) {
- error (g, _("for device '/dev/null', format must be 'raw'"));
- return NULL;
+ if (data->format) {
+ if (data->format && STRNEQ (data->format, "raw")) {
+ error (g, _("for device '/dev/null', format must be 'raw'"));
+ return NULL;
+ }
+ } else {
+ /* Manual set format=raw for /dev/null drives, if that was not
+ * already manually specified. */
+ data->format = "raw";
}
if (guestfs_int_lazy_make_tmpdir (g) == -1)
--
2.5.5
8 years, 7 months