Pino Toscano | 5 May 17:53 2016
Picon

[PATCH v2] inspect: check also /etc/hosts for detecting Linux root (RHBZ#1203898)

Use /etc/hosts as alternative of /etc/fstab to detect whether a partition
represents the root of a Linux installation; the latter might not exist
in smaller/special installations like Docker images.
---
Repost (refreshed) of
https://www.redhat.com/archives/libguestfs/2016-February/msg00207.html

 src/inspect-fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 7f7d5d1..e9976cf 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
 <at>  <at>  -217,7 +217,8  <at>  <at>  check_filesystem (guestfs_h *g, const char *mountable,
   else if (is_dir_etc &&
            (is_dir_bin ||
             is_symlink_to (g, "/bin", "usr/bin") > 0) &&
-           guestfs_is_file (g, "/etc/fstab") > 0) {
+           (guestfs_is_file (g, "/etc/fstab") > 0 ||
+            guestfs_is_file (g, "/etc/hosts") > 0)) {
     fs->is_root = 1;
     fs->format = OS_FORMAT_INSTALLED;
     if (guestfs_int_check_linux_root (g, fs) == -1)
--

-- 
2.5.5
Pino Toscano | 5 May 16:09 2016
Picon

[PATCH] python: use constants instead of raw values

Extend the internal libguestfsmod module with the CREATE values, so
there is no need to hardcode values in GuestFS.__init__.
---
 generator/python.ml        | 7 +++++--
 python/guestfs-py-byhand.c | 7 +++++++
 python/guestfs-py.h        | 2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/generator/python.ml b/generator/python.ml
index 9744b8f..470abe7 100644
--- a/generator/python.ml
+++ b/generator/python.ml
 <at>  <at>  -597,6 +597,9  <at>  <at>  moduleinit (void)
   m = Py_InitModule ((char *) \"libguestfsmod\", methods);
 #endif

+  if (m != NULL)
+    guestfs_int_py_extend_module (m);
+
   return m; /* m might be NULL if module init failed */
 }

 <at>  <at>  -719,9 +722,9  <at>  <at>  class GuestFS(object):
         \"\"\"
         flags = 0
         if not environment:
-            flags |= 1
+            flags |= libguestfsmod.GUESTFS_CREATE_NO_ENVIRONMENT
         if not close_on_exit:
-            flags |= 2
(Continue reading)

Pino Toscano | 5 May 14:32 2016
Picon

[PATCH] tools: improve reporting for option errors (RHBZ#1316041)

Improve the error messages produced by C-based tools in case of issues
with the command line options:
- explicitly mention to use -a/-d (and -A/-D in virt-diff)
- when extra arguments are found, mention the correct way to pass
  options to certain command line switches (like --format)
- in virt-inspector, give a cleaner error message when neither -i nor
  any -m is specified

In all the cases, keep the extra notice to use 'TOOL --help' to get more
help with it.
---
 cat/cat.c             |  5 ++++-
 cat/filesystems.c     | 12 ++++++++++--
 cat/log.c             | 12 ++++++++++--
 cat/ls.c              |  5 ++++-
 diff/diff.c           | 21 +++++++++++++++------
 edit/edit.c           |  5 ++++-
 format/format.c       | 12 ++++++++++--
 fuse/guestmount.c     | 13 ++++++++++---
 inspector/inspector.c | 12 ++++++++++--
 rescue/rescue.c       | 12 ++++++++++--
 10 files changed, 87 insertions(+), 22 deletions(-)

diff --git a/cat/cat.c b/cat/cat.c
index 0370fbd..4d671ca 100644
--- a/cat/cat.c
+++ b/cat/cat.c
 <at>  <at>  -224,8 +224,11  <at>  <at>  main (int argc, char *argv[])
   CHECK_OPTION_format_consumed;

(Continue reading)

Pino Toscano | 4 May 16:23 2016
Picon

[PATCH 0/8] python: PEP 8 fixes

Hi,

this series cleans up the Python sources, either static or generated,
including also tests, to make them PEP 8 compliant; see
https://www.python.org/dev/peps/pep-0008/ and tools like pep8.
Almost all the issues reported by pep8 are fixed, reducing the issues
from 3818 to 7.

The changes should have no effect on the actual code, while it will
help Python users with consistency with other Python code.

Thanks,

Pino Toscano (8):
  python: PEP 8: adapt whitespaces in lines
  python: PEP 8: adapt empty lines
  python: PEP 8: remove trailing semicolons
  python: PEP 8: break compound statements
  python: PEP 8: avoid too long lines
  python: PEP 8: miscellaneous indentation fixes
  python: PEP 8: avoid whitespace-only lines in docstrings
  python: PEP 8: miscellaneous coding fixes

 generator/bindtests.ml           |  12 ++--
 generator/python.ml              | 146 ++++++++++++++++++++++++++-------------
 generator/python.mli             |   8 +++
 python/examples/create_disk.py   |  36 +++++-----
 python/examples/inspect_vm.py    |  42 +++++------
 python/setup.py.in               |  69 +++++++++---------
 python/t/test010Load.py          |   5 +-
(Continue reading)

Richard W.M. Jones | 4 May 15:12 2016
Picon
Gravatar

[PATCH 1/2] inspection: Set package manager to "unknown" if parsing major version failed (RHBZ#1332025).

In cases where parsing the release file failed and so we have an
obviously incorrect major version number, don't try to infer the
package manager from the major version number.

In the bug report, parsing the /etc/redhat-release file of a CentOS
7.1 guest failed, so major version was set to 0, and the package
manager was inferred as "up2date".  virt-customize then failed with a
peculiar error:

  virt-customize: sorry, don't know how to use --install with the 'up2date' package manager

Instead this sets it to "unknown" which will cause virt-customize to
fail with:

  virt-customize: --install is not supported for this guest operating system

which is (only very slightly) better.

Problem reported by novegin on IRC.
---
 src/inspect-fs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 0714ae1..7f7d5d1 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
 <at>  <at>  -531,8 +531,11  <at>  <at>  guestfs_int_check_package_management (guestfs_h *g, struct inspect_fs *fs)
         guestfs_is_file_opts (g, "/usr/bin/dnf",
                               GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0)
(Continue reading)

Richard W.M. Jones | 3 May 22:27 2016
Picon
Gravatar

Proposal to start tagging releases in git with v<VERSION>


For historical reasons that don't really matter now, we currently
tag all releases with just the version number, eg:

  commit 6b48977cb7100e4f214b189052d4f0bf61523d11 (HEAD -> master, tag: 1.33.26, origin/master, origin/HEAD)
  Author: Richard W.M. Jones <rjones <at> redhat.com>
  Date:   Tue May 3 14:49:59 2016 +0100

      Version 1.33.26.

Of course this isn't the way that git versions are normally tagged.
The normal convention is to use "v<VERSION>" (eg. "v1.33.26").

I propose that I start tagging new releases this way (see the patch
below).  This shouldn't be controversial.

The question is should I tag new releases with the "old style" tags?
I'd prefer not to.  Should I go back and add "v<VERSION>" tags to all
the old releases?  Again, I'd prefer not to, but could do that if
anyone thinks it's necessary.

Rich.

>From fe9493a5a0dd34d5f3ffc1f5dbe76a8724011225 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones <at> redhat.com>
Date: Tue, 3 May 2016 21:25:54 +0100
Subject: [PATCH] Tag versions with "v<VERSION>" instead of just the version
 number.

This is the normal convention used for tagging git releases.
(Continue reading)

Pino Toscano | 3 May 14:13 2016
Picon

[PATCH] customize: remove "core" from description of --update

--update invokes a distribution update, updating all the installed
packages and not just some "core" ones.
---
 customize/customize_run.ml | 2 +-
 generator/customize.ml     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 82c4edd..83e70a6 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
 <at>  <at>  -320,7 +320,7  <at>  <at>  exec >>%s 2>&1
       g#touch path

     | `Update ->
-      message (f_"Updating core packages");
+      message (f_"Updating packages");
       let cmd = guest_update_command () in
       do_run ~display:cmd cmd

diff --git a/generator/customize.ml b/generator/customize.ml
index 55ee252..3d3f978 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
 <at>  <at>  -427,7 +427,7  <at>  <at>  This command performs a L<touch(1)>-like operation on C<FILE>.";
   { op_name = "update";
     op_type = Unit;
     op_discrim = "`Update";
-    op_shortdesc = "Update core packages";
+    op_shortdesc = "Update packages";
(Continue reading)

Pino Toscano | 3 May 14:13 2016
Picon

[PATCH] mllib: add "internal" to the description of --{short, long}-options

The Arg module of OCaml does not support hiding options from the --help
output: hence, mark --short-options and --long-options as internal
options, since we need them only for the bash completion scripts.
---
 mllib/common_utils.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 3d6eb94..db8a298 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
 <at>  <at>  -575,8 +575,8  <at>  <at>  let set_standard_options argspec =
   let set_debug_gc () =
     at_exit (fun () -> Gc.compact()) in
   let argspec = [
-    "--short-options", Arg.Unit display_short_options, " " ^ s_"List short options";
-    "--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
+    "--short-options", Arg.Unit display_short_options, " " ^ s_"List short options (internal)";
+    "--long-options", Arg.Unit display_long_options, " " ^ s_"List long options (internal)";
     "-V",           Arg.Unit print_version_and_exit,
                                                " " ^ s_"Display version and exit";
     "--version",    Arg.Unit print_version_and_exit,
--

-- 
2.5.5
Richard W.M. Jones | 3 May 11:45 2016
Picon
Gravatar

[PATCH 1/2] Revert "php: Fix the tests ... again."

This reverts commit 0d69eab98f0bd5dd2d218ce5adcafdeb13f9d90d.
---
 php/run-php-tests.sh | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/php/run-php-tests.sh b/php/run-php-tests.sh
index 80758bd..e5cfc0d 100755
--- a/php/run-php-tests.sh
+++ b/php/run-php-tests.sh
 <at>  <at>  -28,13 +28,10  <at>  <at>  cd extension
 # won't get passed down to the script.  Furthermore, setting debug or
 # trace isn't very useful anyway because the PHP test script mixes
 # stdout and stderr together and compares this to the expected output,
-# so you'd just get failures for every test.
-#
-# So there is no good way to debug libguestfs failures in PHP tests,
-# but if an individual test fails and you want to find out more, you
-# can comment out the following two 'unset' statements.  The tests
-# will definitely fail if you do this, but you will be able to see the
-# debug output in the '*.out' files.
+# so you'd just get failures for every test.  So there is no good way
+# to debug libguestfs failures in PHP tests, but if an individual test
+# fails locally then you can edit the guestfs_php_*.phpt.in and
+# uncomment the putenv statement, then look at the output.

 unset LIBGUESTFS_DEBUG
 unset LIBGUESTFS_TRACE
 <at>  <at>  -47,8 +44,4  <at>  <at>  printenv | grep -E '^(LIBGUESTFS|LIBVIRT|LIBVIRTD|VIRTLOCKD|LD|MALLOC)_' >> env
 TESTS=$(echo tests/guestfs_*.phpt)
 echo TESTS: $TESTS
(Continue reading)

Matteo Cafasso | 2 May 22:51 2016
Picon

[PATCH v6 0/5] New API: filesystem_walk

v6:

 - added metadata reallocation flag in tsk_flags

   Certain filesystems separate file name structures and metadata ones.
   Therefore, deleted entries with file name structures in an
   unallocated state might point to metadata structures which have been
   reallocated to new files. A flag set to 1 is generally an indication
   that the information gathered from the metadata structure (file size
   and file type) might refer to a different file.

It might make sense to expose the constant values to the user so he/she
can use them for bitwise comparison. Yet I have not found any example
within the code so I preferred to stick to the suggestion to simply
document the values.

Patch ready for review. Code available at:
https://github.com/noxdafox/libguestfs/tree/filesystem_walk

Matteo Cafasso (5):
  generator: Added tsk_dirent struct
  configure: Added libtsk compile-time check
  New API: internal_filesystem_walk
  New API: filesystem_walk
  lib: Added filesystem_walk command tests

 daemon/Makefile.am                |   4 +-
 daemon/tsk.c                      | 249 ++++++++++++++++++++++++++++++++++++++
 docs/guestfs-building.pod         |   4 +
 generator/actions.ml              | 117 ++++++++++++++++++
(Continue reading)

Richard W.M. Jones | 26 Apr 14:16 2016
Picon
Gravatar

v2v: Remove --no-trim, --vmtype options and other fixes.

The first two patches implement the change discussed here:
https://www.redhat.com/archives/libguestfs/2016-April/msg00178.html

The third patch fixes the mapping of inspection data to OVF VmType
which was inherited directly from old virt-v2v and had never been
changed.  It had a number of problems.

The fourth patch is only slightly related to the others.  It adds an
extra slow test to ensure that trimming doesn't regress, fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1264332

Rich.

Gmane