Roman Kagan | 28 Aug 16:56 2015

[PATCH] handle --debug-gc universally via at_exit hook

Several tools handle --debug-gc command-line option, by explicitly
forcing GC on every exit path.  This is tedious and prone to forgetting
some of the exit paths.

Instead, add a generic handler for --debug-gc, which installs an at_exit
hook to do the GC consistency check, and which can be called right in
the command-line parser.  Also adjust all users of --debug-gc to use
that handler.

Signed-off-by: Roman Kagan <rkagan <at> virtuozzo.com>
---
 customize/customize_main.ml |  9 ++-------
 mllib/common_utils.ml       |  4 ++++
 mllib/common_utils.mli      |  3 +++
 resize/resize.ml            | 13 ++++---------
 sparsify/cmdline.ml         |  6 ++----
 sparsify/sparsify.ml        |  7 ++-----
 sysprep/main.ml             | 13 ++++---------
 v2v/cmdline.ml              |  6 ++----
 v2v/v2v.ml                  |  9 ++-------
 9 files changed, 25 insertions(+), 45 deletions(-)

diff --git a/customize/customize_main.ml b/customize/customize_main.ml
index fa55c90..03c97e4 100644
--- a/customize/customize_main.ml
+++ b/customize/customize_main.ml
 <at>  <at>  -39,7 +39,6  <at>  <at>  let main () =
     | s -> attach_format := Some s
   in
   let attach_disk s = attach := (!attach_format, s) :: !attach in
(Continue reading)

Richard W.M. Jones | 28 Aug 15:19 2015
Picon

v2v: -i libvirtxml: Map empty network or bridge name to a default (RHBZ#1257895).

When importing from VMware via the libvirt driver, the libvirt driver
can add an empty source bridge name:

    <interface type='bridge'>
      <mac address='00:01:02:03:04:05:06'/>
      <source bridge=''/>
    </interface>

Replicate what we do on the -i ova path, and map these to "eth0",
"eth1" etc.

This also includes a bunch of changes to how we do xpath parsing to
make it type-safe.

Rich.
Richard W.M. Jones | 28 Aug 13:23 2015
Picon

[PATCH 0/2] v2v: vcenter: Calculate dcPath correctly (RHBZ#1256823).

Calculate dcPath correctly for vCenter conversions.

Rich.
Richard W.M. Jones | 27 Aug 20:08 2015
Picon

[PATCH v2] customize: Use setarch when running commands on i686 guest

v2: Fix problem when running multiple commands.
Richard W.M. Jones | 27 Aug 18:32 2015
Picon

[PATCH] customize: Use setarch when running commands on i686 guest (RHBZ#1256405).

When running (eg) dnf on a 32 bit i686 guest when the host is 64 bit
x86_64, dnf believes it is running on a 64 bit machine and so tries to
install x86_64 packages.  We can 'trick' dnf into believing it's a 32
bit machine using the setarch program.

$ virt-builder fedora-22 --arch i686 --install 'gperf'
...
[  27.4] Installing packages: gperf
...
Running transaction test
Error: Transaction check error:
  package libgcc-5.1.1-4.fc22.x86_64 is intended for a different architecture
...

Thanks: Jan Sedlák for finding the solution.
---
 customize/customize_run.ml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 828c711..2a4c71e 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
 <at>  <at>  -59,6 +59,7  <at>  <at>  let run (g : Guestfs.guestfs) root (ops : ops) =
      * - Pass environment variables through from the host.
      * - Send stdout and stderr to a log file so we capture all output
      *   in error messages.
+     * - Use setarch when running x86_64 host + i686 guest.
      * Also catch errors and dump the log file completely on error.
      *)
(Continue reading)

Richard W.M. Jones | 27 Aug 17:10 2015
Picon

[PATCH v2 0/4] p2v: Wait for network to come online before testing connection

Fixes https://bugzilla.redhat.com/1256222
Maros Zatko | 27 Aug 15:18 2015
Picon

[PATCH v4 0/2] RFE: journal reader in guestfish

There seems to be a minor issue when user wants to run it through pager (more)
and wants cancel it. User will end up with stuck guestfish until journal-view
transfers all journal items.

Output is configurable, it's the same format as virt-log has, since both
uses same code.

Maros Zatko (2):
  cat: move get_journal_field to fish/journal.c
  fish: add journal-view command

 cat/Makefile.am       |   1 +
 cat/log.c             | 113 ++-------------------------------------
 fish/Makefile.am      |   1 +
 fish/fish.h           |   3 ++
 fish/journal.c        | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++
 generator/Makefile.am |   6 ++-
 generator/actions.ml  |  22 ++++++++
 generator/main.ml     |   3 ++
 8 files changed, 179 insertions(+), 112 deletions(-)
 create mode 100644 fish/journal.c

--

-- 
1.9.3
Richard W.M. Jones | 25 Aug 20:34 2015
Picon

[PATCH 0/4] Various p2v fixes and features

A mixed bag, but all the patches make sense together!

Patch 1: Fix a bug that Tingting found:
https://bugzilla.redhat.com/show_bug.cgi?id=1256222

Patch 2: Revert a patch that makes no sense now that we've added
virt-v2v into base RHEL.  This is just included because it's a cleanup
needed before applying patch 3.

Patch 3: Add the ability to use SSH identities (private keys) for
virt-p2v to authenticate with the conversion server (as a possibly
more secure alternative to passwords).

Patch 4: Test the bug fixed in patch 1, which involves for various
convoluted reasons using SSH identities.

Rich.
Pino Toscano | 25 Aug 17:40 2015
Picon

[PATCH 1/2] inspect: recognize the ALT Linux distribution

Check its presence ahead of /etc/redhat-release, as the distro provides
it and thus previously it was recognized as "redhat-based".
---
 generator/actions.ml   |  4 ++++
 src/guestfs-internal.h |  1 +
 src/inspect-fs-unix.c  | 21 +++++++++++++++++++++
 src/inspect-fs.c       |  2 ++
 src/inspect-icon.c     |  1 +
 src/inspect.c          |  1 +
 6 files changed, 30 insertions(+)

diff --git a/generator/actions.ml b/generator/actions.ml
index 1c22f9f..13c8bc8 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
 <at>  <at>  -1059,6 +1059,10  <at>  <at>  Currently defined distros are:

 Alpine Linux.

+=item \"altlinux\"
+
+ALT Linux.
+
 =item \"archlinux\"

 Arch Linux.
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 0c8857c..6cf3dad 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
(Continue reading)

andywood2610@126.com | 25 Aug 04:12 2015

Can I get some help from you?

Hello, there:
    I wish to get some help from you. And here is my problem: 
    
    When I tried to boot a instance on OpenStack Kilo,
========================================================================================================================
nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64 --nic net-id=3be58b93-32ad-42bb-80c7-7979554d6bc4 --security-group default --key-name demo-key demo-instance7
========================================================================================================================
 the instance didn't boot as I expected and the "nova-compute.log" file contains some sentences like this:
===================================nova-compute.log===============================================
2015-08-25 09:42:53.009 6440 WARNING nova.virt.disk.api [req-3bcf4c8f-57e0-4ae1-9a43-730c02b02621 - - - - -] Unable to mount image /var/lib/nova/instances/54626e50-e17a-4bfc-9f0e-a6ed581582be/disk with error libguestfs installed but not usable (/usr/bin/supermin-helper exited with error status 1.
To see full error messages you may need to enable debugging.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs). Cannot resize.
2015-08-25 09:42:53.128 6440 ERROR nova.compute.manager [req-3bcf4c8f-57e0-4ae1-9a43-730c02b02621 - - - - -] [instance: 54626e50-e17a-4bfc-9f0e-a6ed581582be] Instance failed to spawn
=====================================nova-compute.log=============================================
   
     After I run "libguestfs-test-tool" in my terminal, I get these compute and unedited info below:
================================================================================
     ************************************************************
     *                    IMPORTANT NOTICE
     *
     * When reporting bugs, include the COMPLETE, UNEDITED
     * output below in your bug report.
     *
     ************************************************************
LIBVIRT_DEFAULT_URI=qemu:///system
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SELinux: sh: 1: getenforce: not found
guestfs_get_append: (null)
guestfs_get_backend: direct
guestfs_get_autosync: 1
guestfs_get_cachedir: /var/tmp
guestfs_get_direct: 0
guestfs_get_hv: /usr/bin/qemu-system-x86_64
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.24.5
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsLMdzHt
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ -f checksum
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = (none)
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = (none)
supermin helper [00000ms] appliance = (none)
checking modpath /lib/modules/3.16.0-30-generic is a directory
checking modpath /lib/modules/3.16.0-45-generic is a directory
picked kernel vmlinuz-3.16.0-45-generic
supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.img
supermin helper [00000ms] adding kernel modules
supermin helper [00044ms] finished creating appliance
libguestfs: checksum of existing appliance: b6869d6d612edfa2e0c627a79d62b1cbe17737ad5a9c3452b2d349d7c2b6c217
libguestfs: [00047ms] begin building supermin appliance
libguestfs: [00047ms] run supermin-helper
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
libguestfs: command: run: \ --output-kernel /var/tmp/guestfs.sZ4SFI/kernel
libguestfs: command: run: \ --output-initrd /var/tmp/guestfs.sZ4SFI/initrd
libguestfs: command: run: \ --output-appliance /var/tmp/guestfs.sZ4SFI/root
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = /var/tmp/guestfs.sZ4SFI/kernel
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = /var/tmp/guestfs.sZ4SFI/initrd
supermin helper [00000ms] appliance = /var/tmp/guestfs.sZ4SFI/root
checking modpath /lib/modules/3.16.0-30-generic is a directory
checking modpath /lib/modules/3.16.0-45-generic is a directory
picked kernel vmlinuz-3.16.0-45-generic
supermin helper [00038ms] finished creating kernel
supermin helper [01967ms] finished mke2fs
supermin helper [01968ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [01968ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz
supermin helper [02021ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [02021ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.img
/usr/bin/supermin-helper: ext2: parent directory not found: /lib: File not found by ext2_lookup
libguestfs: error: /usr/bin/supermin-helper exited with error status 1, see debug messages above
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /var/tmp/guestfs.sZ4SFI
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0xa11480 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsLMdzHt
================================================================================
    I wish to get some help from you , thank you

    Best wishes!

_______________________________________________
Libguestfs mailing list
Libguestfs <at> redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
Pino Toscano | 24 Aug 18:28 2015
Picon

[PATCH 1/3] ocaml: dynamically generate the content of Guestfs.Errno

Put in a list the errnos to expose, filling the content of the
Guestfs.Errno submodule from that.
Also, generate a separate guestfs-c-errnos.c with the implementations of
the functions returning the errno codes.

Only code motion and refactoring, no actual changes on the content of
the ocaml Guestfs module.
---
 .gitignore         |  1 +
 generator/main.ml  |  1 +
 generator/ocaml.ml | 77 +++++++++++++++++++++++++++++++++++++++++++++---------
 ocaml/Makefile.am  |  2 ++
 ocaml/guestfs-c.c  | 32 -----------------------
 po/POTFILES        |  1 +
 6 files changed, 70 insertions(+), 44 deletions(-)

diff --git a/.gitignore b/.gitignore
index e968399..fb972a7 100644
--- a/.gitignore
+++ b/.gitignore
 <at>  <at>  -332,6 +332,7  <at>  <at>  Makefile.in
 /ocaml/examples/inspect_vm
 /ocaml/examples/stamp-guestfs-ocaml.pod
 /ocaml/guestfs-c-actions.c
+/ocaml/guestfs-c-errnos.c
 /ocaml/guestfs.ml
 /ocaml/guestfs.mli
 /ocamlinit-stamp
diff --git a/generator/main.ml b/generator/main.ml
index 94f0d09..1e0e7d6 100644
--- a/generator/main.ml
+++ b/generator/main.ml
 <at>  <at>  -125,6 +125,7  <at>  <at>  Run it from the top source directory using the command
   output_to "ocaml/guestfs.mli" generate_ocaml_mli;
   output_to "ocaml/guestfs.ml" generate_ocaml_ml;
   output_to "ocaml/guestfs-c-actions.c" generate_ocaml_c;
+  output_to "ocaml/guestfs-c-errnos.c" generate_ocaml_c_errnos;
   output_to "ocaml/bindtests.ml" generate_ocaml_bindtests;
   output_to "perl/Guestfs.xs" generate_perl_xs;
   output_to "perl/lib/Sys/Guestfs.pm" generate_perl_pm;
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 05c7456..7742209 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
 <at>  <at>  -30,6 +30,14  <at>  <at>  open Structs
 open C
 open Events

+(* List of errnos to expose on Guestfs.Errno. *)
+let ocaml_errnos = [
+  "EINVAL";
+  "ENOTSUP";
+  "EPERM";
+  "ESRCH";
+]
+
 (* Generate the OCaml bindings interface. *)
 let rec generate_ocaml_mli () =
   generate_header OCamlStyle LGPLv2plus;
 <at>  <at>  -132,10 +140,12  <at>  <at>  val last_errno : t -> int
     which you can use to test the return value of {!Guestfs.last_errno}. *)

 module Errno : sig
-  val errno_EINVAL : int
-  val errno_ENOTSUP : int
-  val errno_EPERM : int
-  val errno_ESRCH : int
+";
+  List.iter (
+    fun e ->
+      pr "  val errno_%s : int\n" e
+  ) ocaml_errnos;
+  pr "\
 end

 ";
 <at>  <at>  -287,14 +297,15  <at>  <at>  external event_to_string : event list -> string
 external last_errno : t -> int = \"ocaml_guestfs_last_errno\"

 module Errno = struct
-  external einval : unit -> int = \"ocaml_guestfs_get_EINVAL\" \"noalloc\"
-  let errno_EINVAL = einval ()
-  external enotsup : unit -> int = \"ocaml_guestfs_get_ENOTSUP\" \"noalloc\"
-  let errno_ENOTSUP = enotsup ()
-  external eperm : unit -> int = \"ocaml_guestfs_get_EPERM\" \"noalloc\"
-  let errno_EPERM = eperm ()
-  external esrch : unit -> int = \"ocaml_guestfs_get_ESRCH\" \"noalloc\"
-  let errno_ESRCH = esrch ()
+";
+  List.iter (
+    fun e ->
+      let le = String.lowercase e in
+      pr "  external %s : unit -> int = \"ocaml_guestfs_get_%s\" \"noalloc\"\n"
+        le e;
+      pr "  let errno_%s = %s ()\n" e le
+  ) ocaml_errnos;
+  pr "\
 end

 (* Give the exceptions names, so they can be raised from the C code. *)
 <at>  <at>  -717,6 +728,48  <at>  <at>  copy_table (char * const * argv)
       )
   ) external_functions_sorted

+(* Generate the OCaml bindings C errnos. *)
+and generate_ocaml_c_errnos () =
+  generate_header CStyle LGPLv2plus;
+
+  pr "\
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <caml/config.h>
+#include <caml/alloc.h>
+#include <caml/fail.h>
+#include <caml/memory.h>
+#include <caml/mlvalues.h>
+
+#include \"guestfs.h\"
+
+#include \"guestfs-c.h\"
+
+/* These prototypes are solely to quiet gcc warnings. */
+";
+  List.iter (
+    fun e ->
+      pr "value ocaml_guestfs_get_%s (value unitv);\n" e
+  ) ocaml_errnos;
+
+  List.iter (
+    fun e ->
+      pr "\
+
+/* NB: \"noalloc\" function. */
+value
+ocaml_guestfs_get_%s (value unitv)
+{
+  return Val_int (%s);
+}
+" e e
+  ) ocaml_errnos
+
 and generate_ocaml_structure_decls () =
   List.iter (
     fun { s_name = typ; s_cols = cols } ->
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index db13a8f..e781363 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
 <at>  <at>  -21,6 +21,7  <at>  <at>  generator_built = \
 	guestfs.mli \
 	guestfs.ml \
 	guestfs-c-actions.c \
+	guestfs-c-errnos.c \
 	$(srcdir)/bindtests.ml

 EXTRA_DIST = \
 <at>  <at>  -89,6 +90,7  <at>  <at>  libguestfsocaml_a_CFLAGS = \
 libguestfsocaml_a_SOURCES = \
 	guestfs-c.c \
 	guestfs-c-actions.c \
+	guestfs-c-errnos.c \
 	../src/utils.c

 if HAVE_OCAMLDOC
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 9603f04..03e3659 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
 <at>  <at>  -63,10 +63,6  <at>  <at>  value ocaml_guestfs_set_event_callback (value gv, value closure, value events);
 value ocaml_guestfs_delete_event_callback (value gv, value eh);
 value ocaml_guestfs_event_to_string (value events);
 value ocaml_guestfs_last_errno (value gv);
-value ocaml_guestfs_get_EINVAL (value unitv);
-value ocaml_guestfs_get_ENOTSUP (value unitv);
-value ocaml_guestfs_get_EPERM (value unitv);
-value ocaml_guestfs_get_ESRCH (value unitv);

 /* Allocate handles and deal with finalization. */
 static void
 <at>  <at>  -442,31 +438,3  <at>  <at>  ocaml_guestfs_last_errno (value gv)
   rv = Val_int (r);
   CAMLreturn (rv);
 }
-
-/* NB: "noalloc" function. */
-value
-ocaml_guestfs_get_EINVAL (value unitv)
-{
-  return Val_int (EINVAL);
-}
-
-/* NB: "noalloc" function. */
-value
-ocaml_guestfs_get_ENOTSUP (value unitv)
-{
-  return Val_int (ENOTSUP);
-}
-
-/* NB: "noalloc" function. */
-value
-ocaml_guestfs_get_EPERM (value unitv)
-{
-  return Val_int (EPERM);
-}
-
-/* NB: "noalloc" function. */
-value
-ocaml_guestfs_get_ESRCH (value unitv)
-{
-  return Val_int (ESRCH);
-}
diff --git a/po/POTFILES b/po/POTFILES
index 7f1580c..6a0a3fc 100644
--- a/po/POTFILES
+++ b/po/POTFILES
 <at>  <at>  -263,6 +263,7  <at>  <at>  mllib/mkdtemp-c.c
 mllib/progress-c.c
 mllib/uri-c.c
 ocaml/guestfs-c-actions.c
+ocaml/guestfs-c-errnos.c
 ocaml/guestfs-c.c
 p2v/about-authors.c
 p2v/about-license.c
--

-- 
2.1.0

Gmane