Picon

Convert Xen PV to KVM

Hello!
Is it possible to convert a live centos xen pv vps to kvm?

Marian Titieni
Edelweiss srl
Tel: +4 0746.149496

---------------------------------------------------------------------------------------------------------------
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
Please consider the environmental impact before printing this document and its attachment(s). Print black and white and double-sided where possible.
------------------------------------------------------------------------------

_______________________________________________
Libguestfs mailing list
Libguestfs <at> redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
Richard W.M. Jones | 24 Oct 11:01 2014
Picon

[PATCH] inspector: Document that -a option can take a URI for remote storage (RHBZ#1156301).

---
 inspector/virt-inspector.pod | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
index f8744b1..1282608 100644
--- a/inspector/virt-inspector.pod
+++ b/inspector/virt-inspector.pod
 <at>  <at>  -68,6 +68,12  <at>  <at>  them with separate I<-a> options.
 The format of the disk image is auto-detected.  To override this and
 force a particular format use the I<--format=..> option.

+=item B<-a> URI
+
+=item B<--add> URI
+
+Add a remote disk.  See L<guestfish(1)/ADDING REMOTE STORAGE>.
+
 =item B<-c URI>

 =item B<--connect URI>
--

-- 
2.0.4
Richard W.M. Jones | 24 Oct 10:14 2014
Picon

[PATCH 0/2] bash-completion: Install symbolic links instead of copies of files (RHBZ#1156298).

Previously we copied the files instead of the symlinks.
Pino Toscano | 23 Oct 20:18 2014
Picon

[PATCH 00/16] Small bits of non-Linux porting

Hi,

from time to time, there have been requests (or attempts, like the
mingw port posted on the list some months ago) to make libguestfs work
on OSes different than Linux. Of course this would imply using a fixed
appliance, since it is currently heavily dependent on Linux.

The attached series provides some easy changes in this direction,
resolving some of the easy issues found in porting to FreeBSD; while
they don't solve all the build and runtime issues, at least they get
libguestfs a bit closer to it, while causing no actual changes on
Linux.

Other issues (with partial solutions, or not dealt yet) w.r.t porting
to non-Linux so far found are the following:

a) lack of UNIX_PATH_MAX (which seems Linux-specific anyway)

b) usage of meta /dev/fd/N files; while on (k)FreeBSD there's a fdescfs
   filesystem providing it, IMHO a better solution would be adding API
   using FDs, like download_fd, upload_fd, tar_in_fd, and tar_out_fd

c) program_invocation_short_name is specific to GNU libc

d) iconv outside of GNU libc, in an own libintl

e) different cli tools, and different output for them

Also, as mentioned in the mingw porting patch,
https://www.redhat.com/archives/libguestfs/2014-February/msg00160.html
a way to disable entirely the usage of supermin (thus leaving only the
fixed appliance as appliance style) is needed too.

Thanks,
-- 
Pino

Pino Toscano (16):
  build: use the ptsname_r gnulib module
  Include string.h where needed
  Include sys/wait.h where needed
  build: look for and use sys/endian.h
  fuse: test-fuse: enclose acl vars within HAVE_ACL
  p2v: remove unused variable
  normalize iconv handling
  builder: rename "program_name" into "progname"
  tests: isolate iso_system_id baseline string
  Include stdint.h where needed
  build: use $(SED) instead of sed when possible
  tests/c-api: add a way to skip test when host and appliance differ
  actions: mark as IfNotCrossAppliance tests of command and
    command_lines
  customize, mllib: use the libvirt CFLAGS
  tests: switch from get_current_dir_name to getcwd(0, NULL)
  configure: map also amd64 as host_cpu to x86_64 qemu

 bootstrap                                  |  2 ++
 builder/index-parse.y                      |  4 +--
 builder/index-parser-c.c                   |  2 +-
 builder/index-struct.h                     |  2 +-
 configure.ac                               |  4 ++-
 customize/Makefile.am                      |  1 +
 daemon/ext2.c                              |  1 +
 daemon/hotplug.c                           |  1 +
 daemon/initrd.c                            |  1 +
 daemon/journal.c                           |  5 +++
 daemon/ldm.c                               |  1 +
 daemon/lvm-filter.c                        |  1 +
 daemon/mktemp.c                            |  1 +
 daemon/utsname.c                           |  1 +
 diff/diff.c                                |  1 +
 fish/Makefile.am                           |  2 +-
 fish/file-edit.c                           |  1 +
 fuse/test-fuse.c                           |  2 ++
 generator/actions.ml                       | 50 +++++++++++++++---------------
 generator/c.ml                             |  1 +
 generator/tests_c_api.ml                   | 20 +++++++++++-
 generator/types.ml                         |  5 +++
 m4/.gitignore                              |  3 ++
 mllib/Makefile.am                          |  1 +
 p2v/Makefile.am                            |  2 +-
 p2v/ssh.c                                  |  2 --
 po-docs/Makefile.am                        |  2 +-
 run.in                                     |  2 +-
 sparsify/statvfs-c.c                       |  1 +
 src/Makefile.am                            |  3 +-
 src/create.c                               |  1 +
 src/dbdump.c                               |  1 +
 src/file.c                                 |  1 +
 src/filearch.c                             |  1 +
 src/fuse.c                                 |  1 +
 src/info.c                                 |  1 +
 src/inspect-apps.c                         |  3 ++
 src/inspect-fs-windows.c                   |  5 ++-
 src/inspect-icon.c                         |  1 +
 src/journal.c                              |  3 ++
 src/launch-direct.c                        |  1 +
 src/launch-libvirt.c                       |  1 +
 src/launch-unix.c                          |  1 +
 src/libvirt-auth.c                         |  1 +
 src/libvirt-domain.c                       |  1 +
 tests/c-api/test-pwd.c                     |  2 +-
 tests/c-api/tests-main.c                   | 39 +++++++++++++++++++++++
 tests/c-api/tests.h                        |  1 +
 tests/events/test-libvirt-auth-callbacks.c |  4 +--
 tests/guests/Makefile.am                   |  2 +-
 50 files changed, 153 insertions(+), 43 deletions(-)

--

-- 
1.9.3
Richard W.M. Jones | 23 Oct 17:16 2014
Picon

[PATCH v6 00/10] tests: Introduce test harness for running tests.

For v6:

This is mainly just a rebase, but I have also added tests in the
ocaml/ language bindings directory, and for all the OCaml-written virt
tools.

Rich.
Richard W.M. Jones | 23 Oct 16:51 2014
Picon

[PATCH 1/2] ocaml: Factor out flags into configure script.

No change, just refactoring.
---
 builder/Makefile.am   | 2 +-
 configure.ac          | 6 ++++++
 customize/Makefile.am | 2 +-
 generator/Makefile.am | 2 +-
 mllib/Makefile.am     | 2 +-
 ocaml/Makefile.am     | 2 +-
 resize/Makefile.am    | 2 +-
 sparsify/Makefile.am  | 2 +-
 sysprep/Makefile.am   | 2 +-
 v2v/Makefile.am       | 2 +-
 10 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/builder/Makefile.am b/builder/Makefile.am
index dd96533..fd5c8e2 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
 <at>  <at>  -158,7 +158,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 OCAMLCLIBS  = \
diff --git a/configure.ac b/configure.ac
index d464615..20f87ca 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -1093,6 +1093,12  <at>  <at>  AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no])
 AM_CONDITIONAL([HAVE_OCAML_GETTEXT],
     [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_gettext" != "xno" && test
"x$OCAML_GETTEXT" != "xno"])

+dnl Flags we want to pass to every OCaml compiler call.
+OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
+AC_SUBST([OCAML_WARN_ERROR])
+OCAML_FLAGS="-g"
+AC_SUBST([OCAML_FLAGS])
+
 dnl Check for Perl (optional, for Perl bindings and Perl tools).
 AC_ARG_ENABLE([perl],
     AS_HELP_STRING([--disable-perl], [disable Perl language bindings]),
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 0760476..0ea8d39 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
 <at>  <at>  -115,7 +115,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 OCAMLCLIBS  = \
diff --git a/generator/Makefile.am b/generator/Makefile.am
index 3716c77..6e4928f 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
 <at>  <at>  -95,7 +95,7  <at>  <at>  objects = \

 EXTRA_DIST = $(sources) files-generated.txt

-OCAMLCFLAGS = -warn-error CDEFLMPSUVYZX-3 -I $(srcdir) -I . -package unix,str
+OCAMLCFLAGS = $(OCAML_WARN_ERROR) -I $(srcdir) -I . -package unix,str

 noinst_PROGRAM = generator

diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 653b8aa..903a77d 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
 <at>  <at>  -95,7 +95,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 OCAMLCLIBS  = \
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 94f11ef..41270a6 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
 <at>  <at>  -37,7 +37,7  <at>  <at>  CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so

 if HAVE_OCAML

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 noinst_DATA = mlguestfs.cma META
diff --git a/resize/Makefile.am b/resize/Makefile.am
index eb4ded3..629fa22 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
 <at>  <at>  -67,7 +67,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 OCAMLCLIBS  = \
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 48cd5f0..a7d4166 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
 <at>  <at>  -72,7 +72,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3
+OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)

 if !HAVE_OCAMLOPT
 OBJECTS = $(BOBJECTS)
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index b1cebc2..6c760a8 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
 <at>  <at>  -130,7 +130,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
+OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)

 OCAMLCLIBS  = \
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 921fb93..2f1f9bc 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
 <at>  <at>  -156,7 +156,7  <at>  <at>  if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif

-OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3
+OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)

 if !HAVE_OCAMLOPT
 OBJECTS = $(BOBJECTS)
--

-- 
2.0.4
Pino Toscano | 22 Oct 17:30 2014
Picon

[PATCH] tests/regressions: Remove executable stack test.

From: "Richard W.M. Jones" <rjones <at> redhat.com>

It's not our job to worry about downstream packaging issues ...
---
 tests/regressions/Makefile.am          |  6 +--
 tests/regressions/test-noexec-stack.pl | 84 ----------------------------------
 2 files changed, 2 insertions(+), 88 deletions(-)
 delete mode 100755 tests/regressions/test-noexec-stack.pl

diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index a5e7cfc..661f6f9 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
 <at>  <at>  -41,8 +41,7  <at>  <at>  EXTRA_DIST = \
 	rhbz1044014.in \
 	rhbz1044014.xml \
 	rhbz1054761.sh \
-	rhbz1091803.sh \
-	test-noexec-stack.pl
+	rhbz1091803.sh

 TESTS = \
 	rhbz501893 \
 <at>  <at>  -65,8 +64,7  <at>  <at>  TESTS = \
 	rhbz1001875.sh \
 	rhbz1054761.sh \
 	rhbz1055452 \
-	rhbz1091803.sh \
-	test-noexec-stack.pl
+	rhbz1091803.sh

 if HAVE_LIBVIRT
 TESTS += rhbz1044014.sh
diff --git a/tests/regressions/test-noexec-stack.pl b/tests/regressions/test-noexec-stack.pl
deleted file mode 100755
index 68bbb0b..0000000
--- a/tests/regressions/test-noexec-stack.pl
+++ /dev/null
 <at>  <at>  -1,84 +0,0  <at>  <at> 
-#!/usr/bin/perl
-# Copyright (C) 2009 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.
-
-use strict;
-use warnings;
-
-if ($ENV{SKIP_TEST_NOEXEC_STACK_PL}) {
-    print "$0: skipped test because environment variable is set\n";
-    exit 77;
-}
-
-die("NOEXEC_CHECK not set") unless(exists($ENV{NOEXEC_CHECK}));
-
-my  <at> files = split(/ /, $ENV{NOEXEC_CHECK});
-
-FILES: foreach my $file ( <at> files) {
-    my $output;
-    my  <at> cmd = ('readelf', '-l', $file);
-    open($output, '-|',  <at> cmd)
-        or die("$0: failed to run: '".join(' ',  <at> cmd)."': $!\n");
-
-    my $offset;
-    my $line = 1;
-
-    # Find the offset of the Flags field
-    while(<$output>) {
-        next unless(/^\s*Type\b/);
-
-        my  <at> lines;
-        push( <at> lines, $_);
-
-        # Look for a Flg field on this line (32 bit)
-        $offset = index($_, 'Flg ');
-
-        if(-1 == $offset) {
-            # 64 bit is split over 2 lines. Look for a Flags field on the next
-            # line
-            $_ = <$output>;
-            $offset = index($_, 'Flags ');
-            $line = 2;
-            push( <at> lines, $_);
-        }
-
-        die("Unrecognised header: ".join("\n",  <at> lines)) if(-1 == $offset);
-        last;
-    }
-
-    # Find the GNU_STACK entry
-    while(<$output>) {
-        next unless(/^\s*GNU_STACK\b/);
-
-        # Skip over input lines according to the header
-        for(my $i = 1; $i < $line; $i++) {
-            $_ = <$output>;
-        }
-
-        my $flags = substr($_, $offset, 3);
-
-        $flags =~ /^[ R][ W]([ E])$/ or die("Unrecognised flags: $flags");
-
-        if('E' eq $1) {
-            print "***** $file has an executable stack *****\n";
-            exit(1);
-        }
-
-        next FILES;
-    }
-
-    die("Didn't find GNU_STACK entry");
-}
--

-- 
1.9.3
Pino Toscano | 22 Oct 17:30 2014
Picon

[PATCH] tests: c-api: add $datadir and $databuilddir

Modify "tests" to expand any kind of environment variable than just
$srcdir; use $datadir and $databuilddir to point to the files in
$srcdir/tests/data and $builddir/tests/data, so it is easier to point at
the data for the tests.

Most of the work (except the $databuilddir and the integration in the
Makefile.am) has been done as part of larger changes by
Richard W.M. Jones <rjones <at> redhat.com>, see
https://www.redhat.com/archives/libguestfs/2014-October/msg00044.html
---
 generator/actions.ml     | 62 ++++++++++++++++++++++++------------------------
 generator/tests_c_api.ml |  9 ++++---
 tests/c-api/Makefile.am  |  2 ++
 tests/c-api/tests-main.c | 58 ++++++++++++++++++++++++++++++--------------
 tests/c-api/tests.h      |  2 +-
 5 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/generator/actions.ml b/generator/actions.ml
index 4cfba0d..370e6e0 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
 <at>  <at>  -2744,19 +2744,19  <at>  <at>  data." };
     style = RString "format", [String "filename"], [];
     tests = [
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1s.raw"]], "raw"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1s.raw"]], "raw"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1s.qcow2"]], "qcow2"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1s.qcow2"]], "qcow2"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1K.raw"]], "raw"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1K.raw"]], "raw"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1K.qcow2"]], "qcow2"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1K.qcow2"]], "qcow2"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1M.raw"]], "raw"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1M.raw"]], "raw"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-1M.qcow2"]], "qcow2"), [];
+        [["disk_format"; "$databuilddir/blank-disk-1M.qcow2"]], "qcow2"), [];
       InitEmpty, Always, TestResultString (
-        [["disk_format"; "../data/blank-disk-with-backing.qcow2"]], "qcow2"), [];
+        [["disk_format"; "$databuilddir/blank-disk-with-backing.qcow2"]], "qcow2"), [];
     ];
     shortdesc = "detect the disk format of a disk image";
     longdesc = "\
 <at>  <at>  -2774,19 +2774,19  <at>  <at>  See also: L<guestfs(3)/DISK IMAGE FORMATS>" };
     style = RInt64 "size", [String "filename"], [];
     tests = [
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1s.raw"]], "ret == 512"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1s.raw"]], "ret == 512"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1s.qcow2"]], "ret == 512"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1s.qcow2"]], "ret == 512"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1K.raw"]], "ret == 1024"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1K.raw"]], "ret == 1024"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1K.qcow2"]], "ret == 1024"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1K.qcow2"]], "ret == 1024"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1M.raw"]], "ret == 1024*1024"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1M.raw"]], "ret == 1024*1024"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-1M.qcow2"]], "ret == 1024*1024"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-1M.qcow2"]], "ret == 1024*1024"), [];
       InitEmpty, Always, TestResult (
-        [["disk_virtual_size"; "../data/blank-disk-with-backing.qcow2"]], "ret == 1024*1024"), [];
+        [["disk_virtual_size"; "$databuilddir/blank-disk-with-backing.qcow2"]], "ret == 1024*1024"), [];
     ];
     shortdesc = "return virtual size of a disk";
     longdesc = "\
 <at>  <at>  -2801,19 +2801,19  <at>  <at>  circumstances.  See L<guestfs(3)/CVE-2010-3851>." };
     style = RBool "backingfile", [String "filename"], [];
     tests = [
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1s.raw"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1s.raw"]]), [];
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1s.qcow2"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1s.qcow2"]]), [];
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1K.raw"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1K.raw"]]), [];
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1K.qcow2"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1K.qcow2"]]), [];
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1M.raw"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1M.raw"]]), [];
       InitEmpty, Always, TestResultFalse (
-        [["disk_has_backing_file"; "../data/blank-disk-1M.qcow2"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-1M.qcow2"]]), [];
       InitEmpty, Always, TestResultTrue (
-        [["disk_has_backing_file"; "../data/blank-disk-with-backing.qcow2"]]), [];
+        [["disk_has_backing_file"; "$databuilddir/blank-disk-with-backing.qcow2"]]), [];
     ];
     shortdesc = "return whether disk has a backing file";
     longdesc = "\
 <at>  <at>  -4735,15 +4735,15  <at>  <at>  To get the checksums for many files, use C<guestfs_checksums_out>." };
     tests = [
       InitScratchFS, Always, TestResultString (
         [["mkdir"; "/tar_in"];
-         ["tar_in"; "$srcdir/../data/helloworld.tar"; "/tar_in"; "NOARG"];
+         ["tar_in"; "$datadir/helloworld.tar"; "/tar_in"; "NOARG"];
          ["cat"; "/tar_in/hello"]], "hello\n"), [];
       InitScratchFS, Always, TestResultString (
         [["mkdir"; "/tar_in_gz"];
-         ["tar_in"; "$srcdir/../data/helloworld.tar.gz"; "/tar_in_gz"; "gzip"];
+         ["tar_in"; "$datadir/helloworld.tar.gz"; "/tar_in_gz"; "gzip"];
          ["cat"; "/tar_in_gz/hello"]], "hello\n"), [];
       InitScratchFS, IfAvailable "xz", TestResultString (
         [["mkdir"; "/tar_in_xz"];
-         ["tar_in"; "$srcdir/../data/helloworld.tar.xz"; "/tar_in_xz"; "xz"];
+         ["tar_in"; "$datadir/helloworld.tar.xz"; "/tar_in_xz"; "xz"];
          ["cat"; "/tar_in_xz/hello"]], "hello\n"), []
     ];
     shortdesc = "unpack tarfile to directory";
 <at>  <at>  -4800,7 +4800,7  <at>  <at>  instead of user/group names.
     tests = [
       InitScratchFS, Always, TestResultString (
         [["mkdir"; "/tgz_in"];
-         ["tgz_in"; "$srcdir/../data/helloworld.tar.gz"; "/tgz_in"];
+         ["tgz_in"; "$datadir/helloworld.tar.gz"; "/tgz_in"];
          ["cat"; "/tgz_in/hello"]], "hello\n"), []
     ];
     shortdesc = "unpack compressed tarball to directory";
 <at>  <at>  -8130,7 +8130,7  <at>  <at>  or growing unnecessarily." };
     tests = [
       InitScratchFS, Always, TestResultString (
         [["mkdir"; "/txz_in"];
-         ["txz_in"; "$srcdir/../data/helloworld.tar.xz"; "/txz_in"];
+         ["txz_in"; "$datadir/helloworld.tar.xz"; "/txz_in"];
          ["cat"; "/txz_in/hello"]], "hello\n"), []
     ];
     shortdesc = "unpack compressed tarball to directory";
 <at>  <at>  -8242,7 +8242,7  <at>  <at>  types (see C<guestfs_part_get_parttype>)." };
     tests = [
       InitISOFS, Always, TestResult (
         [["checksum_device"; "md5"; "/dev/sdd"]],
-        "check_file_md5 (ret, \"../data/test.iso\") == 0"), []
+        "check_file_md5 (ret, \"$databuilddir/test.iso\") == 0"), []
     ];
     shortdesc = "compute MD5, SHAx or CRC checksum of the contents of a device";
     longdesc = "\
 <at>  <at>  -8316,7 +8316,7  <at>  <at>  to find out what it is for." };
     cancellable = true;
     tests = [
       InitScratchFS, Always, TestResultString (
-        [["base64_in"; "../data/hello.b64"; "/base64_in"];
+        [["base64_in"; "$databuilddir/hello.b64"; "/base64_in"];
          ["cat"; "/base64_in"]], "hello\n"), []
     ];
     shortdesc = "upload base64-encoded data to file";
 <at>  <at>  -10708,7 +10708,7  <at>  <at>  C<guestfs_xfs_growfs> calls." };
     optional = Some "hivex";
     tests = [
       InitScratchFS, Always, TestRun (
-        [["upload"; "$srcdir/../data/minimal"; "/hivex_open"];
+        [["upload"; "$datadir/minimal"; "/hivex_open"];
          ["hivex_open"; "/hivex_open"; ""; ""; "false"];
          ["hivex_root"]; (* in this hive, it returns 0x1020 *)
          ["hivex_node_name"; "0x1020"];
 <at>  <at>  -10856,11 +10856,11  <at>  <at>  See also: C<guestfs_hivex_value_utf8>." };
     optional = Some "hivex";
     tests = [
       InitScratchFS, Always, TestRun (
-        [["upload"; "$srcdir/../data/minimal"; "/hivex_commit1"];
+        [["upload"; "$datadir/minimal"; "/hivex_commit1"];
          ["hivex_open"; "/hivex_commit1"; ""; ""; "true"];
          ["hivex_commit"; "NULL"]]), [["hivex_close"]];
       InitScratchFS, Always, TestResultTrue (
-        [["upload"; "$srcdir/../data/minimal"; "/hivex_commit2"];
+        [["upload"; "$datadir/minimal"; "/hivex_commit2"];
          ["hivex_open"; "/hivex_commit2"; ""; ""; "true"];
          ["hivex_commit"; "/hivex_commit2_copy"];
          ["is_file"; "/hivex_commit2_copy"; "false"]]), [["hivex_close"]]
diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
index 88aa07e..86bf08e 100644
--- a/generator/tests_c_api.ml
+++ b/generator/tests_c_api.ml
 <at>  <at>  -385,17 +385,16  <at>  <at>  and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd=
     | String _, arg, sym
     | OptString _, arg, sym
     | Key _, arg, sym
-    | GUID _, arg, sym ->
-      pr "  const char *%s = \"%s\";\n" sym (c_quote arg);
+    | GUID _, arg, sym
+    | FileIn _, arg, sym ->
+      pr "  CLEANUP_FREE char *%s = substitute_environment (\"%s\");\n"
+        sym (c_quote arg)
     | BufferIn _, arg, sym ->
       pr "  const char *%s = \"%s\";\n" sym (c_quote arg);
       pr "  size_t %s_size = %d;\n" sym (String.length arg)
     | Int _, _, _
     | Int64 _, _, _
     | Bool _, _, _ -> ()
-    | FileIn _, arg, sym ->
-      pr "  CLEANUP_FREE char *%s = substitute_srcdir (\"%s\");\n"
-        sym (c_quote arg)
     | FileOut _, _, _ -> ()
     | StringList _, "", sym
     | DeviceList _, "", sym ->
diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am
index 6ea22e9..17c88d7 100644
--- a/tests/c-api/Makefile.am
+++ b/tests/c-api/Makefile.am
 <at>  <at>  -69,6 +69,8  <at>  <at>  TESTS_ENVIRONMENT = \
 	SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
 	SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
 	SKIP_TEST_COMMAND=$(shell ldd test-pwd | grep -sq 'not a dynamic executable' || echo 1) \
+	datadir=$(srcdir)/../data \
+	databuilddir=$(builddir)/../data \
 	$(top_builddir)/run --test $(VG)

 #SKIP_TEST_CHECKSUM_8=$(shell if test `find ../initramfs -name squashfs.ko | wc -l` -eq 0; then echo 1; fi)
diff --git a/tests/c-api/tests-main.c b/tests/c-api/tests-main.c
index e81e15e..986894d 100644
--- a/tests/c-api/tests-main.c
+++ b/tests/c-api/tests-main.c
 <at>  <at>  -357,35 +357,45  <at>  <at>  match_re (const char *str, const char *pattern)
   return r != PCRE_ERROR_NOMATCH;
 }

-/* Used for FileIn parameters in tests.  If the path starts with
- * "$srcdir" then replace that with the contents of the $srcdir
- * environment variable (this is set by automake and run time).  The
- * caller must free the returned string.
+/* Used for some parameters in tests.  If the string starts with
+ * "$variable" then replace that with the contents of the named
+ * environment variable.  The caller must free the returned string.
  */
 char *
-substitute_srcdir (const char *path)
+substitute_environment (const char *str)
 {
   char *ret;
+  size_t len;
+  CLEANUP_FREE char *name = NULL;
+  const char *value;
+
+  if (STRPREFIX (str, "$")) {
+    len = strspn (str+1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
+    if (len == 0) {
+      fprintf (stderr, "tests: invalid environment variable in string (%s)\n",
+               str);
+      exit (EXIT_FAILURE);
+    }
+    name = strndup (str+1, len);
+    if (name == NULL) {
+      perror ("strndup");
+      exit (EXIT_FAILURE);
+    }

-  if (STRPREFIX (path, "$srcdir")) {
-    const char *srcdir;
-
-    srcdir = getenv ("srcdir");
-    if (!srcdir) {
-      fprintf (stderr, "tests: environment variable $srcdir is not defined.\n"
-               "Normally it is defined by automake.  If you are running the\n"
-               "tests directly, set $srcdir to point to the source tests/c-api\n"
-               "directory.\n");
+    value = getenv (name);
+    if (!value) {
+      fprintf (stderr, "tests: environment variable $%s is not defined.\n",
+               name);
       exit (EXIT_FAILURE);
     }

-    if (asprintf (&ret, "%s%s", srcdir, path + 7) == -1) {
+    if (asprintf (&ret, "%s%s", value, str + 1 + len) == -1) {
       perror ("asprintf");
       exit (EXIT_FAILURE);
     }
   }
   else {
-    ret = strdup (path);
+    ret = strdup (str);
     if (!ret) {
       perror ("strdup");
       exit (EXIT_FAILURE);
 <at>  <at>  -424,6 +434,8  <at>  <at>  static guestfs_h *
 create_handle (void)
 {
   guestfs_h *g;
+  const char *databuilddir;
+  CLEANUP_FREE char *test_iso = NULL;

   g = guestfs_create ();
   if (g == NULL) {
 <at>  <at>  -446,8 +458,18  <at>  <at>  create_handle (void)
     exit (EXIT_FAILURE);
   }

-  if (guestfs_add_drive_ro (g, "../data/test.iso") == -1) {
-    printf ("FAIL: guestfs_add_drive_ro ../data/test.iso\n");
+  databuilddir = getenv ("databuilddir");
+  if (databuilddir == NULL) {
+    fprintf (stderr, "environment variable $databuilddir is not defined\n");
+    exit (EXIT_FAILURE);
+  }
+  if (asprintf (&test_iso, "%s/test.iso", databuilddir) == -1) {
+    perror ("asprintf");
+    exit (EXIT_FAILURE);
+  }
+
+  if (guestfs_add_drive_ro (g, test_iso) == -1) {
+    printf ("FAIL: guestfs_add_drive_ro $databuilddir/test.iso\n");
     exit (EXIT_FAILURE);
   }

diff --git a/tests/c-api/tests.h b/tests/c-api/tests.h
index 7959570..129aee6 100644
--- a/tests/c-api/tests.h
+++ b/tests/c-api/tests.h
 <at>  <at>  -43,7 +43,7  <at>  <at>  extern int check_file_md5 (const char *ret, const char *filename);
 extern const char *get_key (char **hash, const char *key);
 extern int check_hash (char **ret, const char *key, const char *expected);
 extern int match_re (const char *str, const char *pattern);
-extern char *substitute_srcdir (const char *path);
+extern char *substitute_environment (const char *str);
 extern void skipped (const char *test_name, const char *fs, ...) __attribute__((format (printf,2,3)));

 #endif /* TESTS_H_ */
--

-- 
1.9.3
Pino Toscano | 22 Oct 17:30 2014
Picon

[PATCH] tests: rename $SRCDIR to $srcdir

No functional changes to the tests.
---
 tests/guests/Makefile.am                   | 12 ++++++------
 tests/guests/guest-aux/make-debian-img.sh  |  6 +++---
 tests/guests/guest-aux/make-fedora-img.pl  | 10 +++++-----
 tests/guests/guest-aux/make-ubuntu-img.sh  |  4 ++--
 tests/guests/guest-aux/make-windows-img.sh |  6 +++---
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am
index 62f5d14..88e0f57 100644
--- a/tests/guests/Makefile.am
+++ b/tests/guests/Makefile.am
 <at>  <at>  -75,7 +75,7  <at>  <at>  fedora.img: guest-aux/make-fedora-img.pl \
 		guest-aux/fedora-journal.tar.xz \
 		guest-aux/fedora-name.db \
 		guest-aux/fedora-packages.db
-	SRCDIR=$(srcdir) LAYOUT=partitions $(top_builddir)/run --test $<
+	srcdir=$(srcdir) LAYOUT=partitions $(top_builddir)/run --test $<

 # Make a (dummy) Fedora image using md devices
 fedora-md1.img fedora-md2.img: stamp-fedora-md.img
 <at>  <at>  -85,27 +85,27  <at>  <at>  stamp-fedora-md.img: guest-aux/make-fedora-img.pl \
 		guest-aux/fedora-name.db \
 		guest-aux/fedora-packages.db
 	rm -f $ <at> 
-	SRCDIR=$(srcdir) LAYOUT=partitions-md $(top_builddir)/run --test $<
+	srcdir=$(srcdir) LAYOUT=partitions-md $(top_builddir)/run --test $<
 	touch $ <at> 

 fedora-btrfs.img: guest-aux/make-fedora-img.pl \
 		guest-aux/fedora-journal.tar.xz \
 		guest-aux/fedora-name.db \
 		guest-aux/fedora-packages.db
-	SRCDIR=$(srcdir) LAYOUT=btrfs $(top_builddir)/run --test $<
+	srcdir=$(srcdir) LAYOUT=btrfs $(top_builddir)/run --test $<

 # Make a (dummy) Debian image.
 debian.img: guest-aux/make-debian-img.sh
-	SRCDIR=$(srcdir) $(top_builddir)/run --test $<
+	srcdir=$(srcdir) $(top_builddir)/run --test $<

 # Make a (dummy) Ubuntu image.
 ubuntu.img: guest-aux/make-ubuntu-img.sh
-	SRCDIR=$(srcdir) $(top_builddir)/run --test $<
+	srcdir=$(srcdir) $(top_builddir)/run --test $<

 # Make a (dummy) Windows image.
 windows.img: guest-aux/make-windows-img.sh \
 	     guest-aux/windows-software guest-aux/windows-system
-	SRCDIR=$(srcdir) $(top_builddir)/run --test $<
+	srcdir=$(srcdir) $(top_builddir)/run --test $<

 guests-all-good.xml: guest-aux/make-guests-all-good.pl $(disk_images)
 	rm -f $ <at>  $ <at> -t
diff --git a/tests/guests/guest-aux/make-debian-img.sh b/tests/guests/guest-aux/make-debian-img.sh
index 95228ab..a86d939 100755
--- a/tests/guests/guest-aux/make-debian-img.sh
+++ b/tests/guests/guest-aux/make-debian-img.sh
 <at>  <at>  -82,11 +82,11  <at>  <at>  upload fstab.tmp.$$ /etc/fstab
 write /etc/debian_version "5.0.1"
 write /etc/hostname "debian.invalid"

-upload $SRCDIR/guest-aux/debian-packages /var/lib/dpkg/status
+upload $srcdir/guest-aux/debian-packages /var/lib/dpkg/status

-upload $SRCDIR/../data/bin-x86_64-dynamic /bin/ls
+upload $srcdir/../data/bin-x86_64-dynamic /bin/ls

-upload $SRCDIR/guest-aux/debian-syslog /var/log/syslog
+upload $srcdir/guest-aux/debian-syslog /var/log/syslog

 mkdir /boot/grub
 touch /boot/grub/grub.conf
diff --git a/tests/guests/guest-aux/make-fedora-img.pl b/tests/guests/guest-aux/make-fedora-img.pl
index 1c23b6d..a693eed 100755
--- a/tests/guests/guest-aux/make-fedora-img.pl
+++ b/tests/guests/guest-aux/make-fedora-img.pl
 <at>  <at>  -44,7 +44,7  <at>  <at>  my $g = Sys::Guestfs->new ();

 my $bootdev;

-foreach ('LAYOUT', 'SRCDIR') {
+foreach ('LAYOUT', 'srcdir') {
   defined ($ENV{$_}) or die "Missing environment variable: $_";
 }

 <at>  <at>  -217,12 +217,12  <at>  <at>  if (-f "mdadm.tmp.$$") {
   unlink ("mdadm.tmp.$$") or die;
 }

-$g->upload ($ENV{SRCDIR}.'/guest-aux/fedora-name.db', '/var/lib/rpm/Name');
-$g->upload ($ENV{SRCDIR}.'/guest-aux/fedora-packages.db', '/var/lib/rpm/Packages');
+$g->upload ($ENV{srcdir}.'/guest-aux/fedora-name.db', '/var/lib/rpm/Name');
+$g->upload ($ENV{srcdir}.'/guest-aux/fedora-packages.db', '/var/lib/rpm/Packages');

-$g->upload ($ENV{SRCDIR}.'/../data/bin-x86_64-dynamic', '/bin/ls');
+$g->upload ($ENV{srcdir}.'/../data/bin-x86_64-dynamic', '/bin/ls');

-$g->txz_in ($ENV{SRCDIR}.'/guest-aux/fedora-journal.tar.xz', '/var/log/journal');
+$g->txz_in ($ENV{srcdir}.'/guest-aux/fedora-journal.tar.xz', '/var/log/journal');

 $g->mkdir ('/boot/grub');
 $g->touch ('/boot/grub/grub.conf');
diff --git a/tests/guests/guest-aux/make-ubuntu-img.sh b/tests/guests/guest-aux/make-ubuntu-img.sh
index 183985b..49cc9fc 100755
--- a/tests/guests/guest-aux/make-ubuntu-img.sh
+++ b/tests/guests/guest-aux/make-ubuntu-img.sh
 <at>  <at>  -73,9 +73,9  <at>  <at>  write /etc/debian_version "5.0.1"
 upload release.tmp.$$ /etc/lsb-release
 write /etc/hostname "ubuntu.invalid"

-upload $SRCDIR/guest-aux/debian-packages /var/lib/dpkg/status
+upload $srcdir/guest-aux/debian-packages /var/lib/dpkg/status

-upload $SRCDIR/../data/bin-x86_64-dynamic /bin/ls
+upload $srcdir/../data/bin-x86_64-dynamic /bin/ls

 mkdir /boot/grub
 touch /boot/grub/grub.conf
diff --git a/tests/guests/guest-aux/make-windows-img.sh b/tests/guests/guest-aux/make-windows-img.sh
index 575c2ee..fa6fa09 100755
--- a/tests/guests/guest-aux/make-windows-img.sh
+++ b/tests/guests/guest-aux/make-windows-img.sh
 <at>  <at>  -59,10 +59,10  <at>  <at>  mount /dev/sda2 /
 mkdir-p /Windows/System32/Config
 mkdir-p /Windows/System32/Drivers

-upload $SRCDIR/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
-upload $SRCDIR/guest-aux/windows-system /Windows/System32/Config/SYSTEM
+upload $srcdir/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
+upload $srcdir/guest-aux/windows-system /Windows/System32/Config/SYSTEM

-upload $SRCDIR/../data/bin-win32.exe /Windows/System32/cmd.exe
+upload $srcdir/../data/bin-win32.exe /Windows/System32/cmd.exe

 mkdir "/Program Files"
 touch /autoexec.bat
--

-- 
1.9.3
Richard W.M. Jones | 18 Oct 23:05 2014
Picon

GIT: [PATCH 0/5] v2v: Multiple fixes for handling semi-standard OVA files (RHBZ#1152998).

OVA not a real standard.  Colour me surprised ...
Richard W.M. Jones | 17 Oct 19:42 2014
Picon

Re: Virt-v2v conversion issue

[Please keep replies on the list]

On Thu, Oct 16, 2014 at 04:23:52PM +0000, VONDRA Alain wrote:
> It would be great in my case to import the VM in ovirt without using
> a nfs connection because the share is on the same server...  But at
> my knowledge, when you put the option -o rhev, you have to link with
> a nfs server, am I right ?

It's simply not possible to make it work without the NFS server.
That's just how it works.  I suggest you need to ask whoever runs your
NFS server to fix it so it has more capacity.

BTW 1.27.64, uploading later today, will fix some Windows conversion bugs.

Rich.

--

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

Gmane