Pino Toscano | 3 Jul 15:46 2015
Picon

[PATCH v5] New tool: virt-dib

virt-dib is a new tool to run the elements of diskimage-builder using
libguestfs.
---
 .gitignore               |   5 +
 Makefile.am              |   3 +-
 appliance/packagelist.in |  12 +
 configure.ac             |   1 +
 dib/Makefile.am          | 144 ++++++++
 dib/cmdline.ml           | 242 +++++++++++++
 dib/dib.ml               | 920 +++++++++++++++++++++++++++++++++++++++++++++++
 dib/elements.ml          | 187 ++++++++++
 dib/utils.ml             | 131 +++++++
 dib/virt-dib.pod         | 628 ++++++++++++++++++++++++++++++++
 po-docs/podfiles         |   1 +
 po/POTFILES-ml           |   4 +
 run.in                   |   1 +
 src/guestfs.pod          |   4 +
 14 files changed, 2282 insertions(+), 1 deletion(-)
 create mode 100644 dib/Makefile.am
 create mode 100644 dib/cmdline.ml
 create mode 100644 dib/dib.ml
 create mode 100644 dib/elements.ml
 create mode 100644 dib/utils.ml
 create mode 100644 dib/virt-dib.pod

diff --git a/.gitignore b/.gitignore
index 6089122..4645aa4 100644
--- a/.gitignore
+++ b/.gitignore
 <at>  <at>  -118,6 +118,10  <at>  <at>  Makefile.in
(Continue reading)

Richard W.M. Jones | 2 Jul 17:08 2015
Picon

[PATCH v2] Fix various -Wformat problems.

Updating gnulib has caused -Wformat-signedness to be enabled.  This
has revealed many problems in C format strings.  The fixes here fall
into the following main categories:

 - Using %d with an unsigned parameter.

 - %x and %o expect an unsigned argument.

 - uid_t and gid_t are unsigned on Linux.  The safe way to print these
   is to cast them to uintmax_t and then print them using the %ju
   modifier (see http://stackoverflow.com/a/1401581).

 - Using %d to print an enum.  Since enums may be either char or int,
   I fixed this by casting the enum to int.

 - strtol_error & lzma_ret are both unsigned types.
---
 builder/pxzcat-c.c     | 24 ++++++++++++------------
 cat/filesystems.c      |  2 +-
 cat/ls.c               |  5 +++--
 daemon/ext2.c          |  7 ++++++-
 daemon/file.c          |  2 +-
 daemon/guestfsd.c      |  3 ++-
 daemon/parted.c        |  5 +++--
 daemon/proto.c         | 14 ++++++++------
 daemon/umask.c         |  2 +-
 daemon/zero.c          |  2 +-
 diff/diff.c            |  7 ++++---
 fish/alloc.c           |  2 +-
 fish/rc.c              |  8 ++++----
(Continue reading)

Richard W.M. Jones | 2 Jul 17:06 2015
Picon

[PATCH] Fix various -Wformat problems.

Updating gnulib has caused -Wformat-signedness to be enabled.  This
has revealed many problems in C format strings.  The fixes here fall
into the following main categories:

 - Using %d with an unsigned parameter.

 - %x and %o expect an unsigned argument.

 - uid_t and gid_t are unsigned on Linux.  The safe way to print these
   is to cast them to uintmax_t and then print then using the %ju
   modifier (see http://stackoverflow.com/a/1401581).

 - Using %d to print an enum.  Since enums may be either char or int,
   I fixed this by casting the enum to int.

 - strtol_error & lzma_ret are both unsigned types.
---
 builder/pxzcat-c.c     | 24 ++++++++++++------------
 cat/filesystems.c      |  2 +-
 cat/ls.c               |  5 +++--
 daemon/ext2.c          |  7 ++++++-
 daemon/file.c          |  2 +-
 daemon/guestfsd.c      |  3 ++-
 daemon/parted.c        |  5 +++--
 daemon/proto.c         | 14 ++++++++------
 daemon/umask.c         |  2 +-
 daemon/zero.c          |  2 +-
 diff/diff.c            |  7 ++++---
 fish/alloc.c           |  2 +-
 fish/rc.c              |  8 ++++----
(Continue reading)

Chen Hanxiao | 2 Jul 13:52 2015

[PATCH v6] New API: set_uuid_random

Signed-off-by: Chen Hanxiao <chenhanxiao <at> cn.fujitsu.com>
---
v6: rename ext_set_e2uuid_random to ext_set_uuid_random
    improve longdesc  of set_uuid_random
v5: 1. improve testcases
    2. rename set_uuid_random to ext_set_uuid_random
    3. drop swap_set_uuid_random,
       call swap_set_uuid + get_random_uuid

 daemon/btrfs.c                 | 19 +++++++++++++++++++
 daemon/daemon.h                |  3 +++
 daemon/ext2.c                  |  6 ++++++
 daemon/uuids.c                 | 32 ++++++++++++++++++++++++++++++++
 daemon/xfs.c                   |  7 +++++++
 generator/actions.ml           | 19 +++++++++++++++++++
 src/MAX_PROC_NR                |  2 +-
 tests/btrfs/test-btrfs-misc.pl | 14 ++++++++++++++
 8 files changed, 101 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 28a48cf..8fcfd81 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
 <at>  <at>  -872,6 +872,25  <at>  <at>  btrfs_set_uuid (const char *device, const char *uuid)
   return 0;
 }

+int
+btrfs_set_uuid_random (const char *device)
+{
(Continue reading)

Deepti Navale | 2 Jul 06:47 2015
Picon

libguestfs error: need help troubleshooting

Hi,

I'm trying to manually create a rhel7 image using the qemu-img and virt-install commands. I'm re-testing a
procedure I previously wrote with the new grub commands that a customer suggested we add in. This
procedure is available at: http://file.bne.redhat.com/dnavale/docs/review/RH-guides/AG-020715/#sect-create-images

As in the procedure, I'm able to run all steps successfully until step 12. When I run the virt-sysprep
command, I get the following errors:
--------------
➜  RHEL7  sudo virt-sysprep -d rhel7 --format qcow2
[   0.0] Examining the guest ...
Fatal error: exception Guestfs.Error("qemu-img: /tmp/libguestfsStQSH1/overlay1: qemu-img 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")
--------------

Then I updated the qemu-img package and started getting this error:
--------------
➜  RHEL7  sudo virt-sysprep -d rhel7            
[   0.0] Examining the guest ...
Fatal error: exception Guestfs.Error("/usr/bin/supermin 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")
--------------

I'm using the following packages: libguestfs-tools-c-1.26.10-1.fc20.x86_64,
libguestfs-1.26.10-1.fc20.x86_64 on a Fedora20 machine. And I used 'yum install -y
libguestfs-tools-c' command to install the package.

(Continue reading)

Richard W.M. Jones | 1 Jul 19:54 2015
Picon

[PATCH 1/9] v2v: Stable bus and slot numbers for removable drives (RHBZ#1238053).

This patch series adds stable bus and slot numbers for removable
drives (CDs and floppies) when the guest is converted using virt-v2v
or virt-p2v.

Previously we were a bit random about this.  After this patch series,
the bus and slot numbers and preserved if at all possible.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1238053

Rich.
Pino Toscano | 1 Jul 17:49 2015
Picon

[PATCH 1/2] mllib: add and use last_part_of

Collect this small snippet to get the part of a string after the last
occurrency of a character; replace with it the current snippets doing
the same.

Should be just code motion.
---
 customize/password.ml                     |  5 +++--
 mllib/common_utils.ml                     |  7 +++++++
 mllib/common_utils.mli                    |  3 +++
 sysprep/sysprep_operation_user_account.ml |  5 +++--
 v2v/convert_linux.ml                      | 10 +++-------
 v2v/utils.ml                              | 16 ++++++++++------
 6 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/customize/password.ml b/customize/password.ml
index 25ce901..d91c4b5 100644
--- a/customize/password.ml
+++ b/customize/password.ml
 <at>  <at>  -98,8 +98,9  <at>  <at>  let rec set_linux_passwords ?password_crypto (g : Guestfs.guestfs) root password
   List.iter (
     fun userpath ->
       let user =
-        let i = String.rindex userpath '/' in
-        String.sub userpath (i+1) (String.length userpath -i-1) in
+        match last_part_of userpath '/' with
+        | Some x -> x
+        | None -> error "password: missing '/' in %s" userpath in
       try
         (* Each line is: "user:[!!]password:..."
          * !! at the front of the password field means the account is locked.
(Continue reading)

Richard W.M. Jones | 1 Jul 15:54 2015
Picon

[PATCH v2 0/2] utils: Add guestfs_int_drive_index and unit test.

Since v1:

 - Test error cases in the unit test of guestfs_int_drive_index.

Rich.
Richard W.M. Jones | 1 Jul 15:28 2015
Picon

[PATCH 1/2] utils: Add a test of the guestfs_int_drive_name function.

This function didn't have a unit test before.
---
 src/test-utils.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/test-utils.c b/src/test-utils.c
index 8e1491f..c5e2f08 100644
--- a/src/test-utils.c
+++ b/src/test-utils.c
 <at>  <at>  -1,5 +1,5  <at>  <at> 
 /* libguestfs
- * Copyright (C) 2014 Red Hat Inc.
+ * Copyright (C) 2014-2015 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
 <at>  <at>  -162,6 +162,32  <at>  <at>  test_validate_guid (void)
   assert (guestfs_int_validate_guid ("21EC2020-3AEA-1069-A2DD-08002B30309D") == 1);
 }

+/* Test guestfs_int_drive_name. */
+static void
+test_drive_name (void)
+{
+  char s[10];
+
+  guestfs_int_drive_name (0, s);
+  assert (STREQ (s, "a"));
+  guestfs_int_drive_name (25, s);
+  assert (STREQ (s, "z"));
(Continue reading)

Pino Toscano | 1 Jul 15:12 2015
Picon

[PATCH 1/3] mllib: add an optional filter for rm_rf_only_files

This way it is possible to use rm_rf_only_files, but not removing
specific files.
---
 mllib/common_utils.ml  | 8 +++++++-
 mllib/common_utils.mli | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 516cff3..3737b4c 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
 <at>  <at>  -640,13 +640,19  <at>  <at>  let rmdir_on_exit =
  * without removing the actual directory structure.  Also if 'dir' is
  * not a directory or doesn't exist, ignore it.
  *
+ * The optional filter is used to filter out files which will be
+ * removed: files returning true are not removed.
+ *
  * XXX Could be faster with a specific API for doing this.
  *)
-let rm_rf_only_files (g : Guestfs.guestfs) dir =
+let rm_rf_only_files (g : Guestfs.guestfs) ?filter dir =
   if g#is_dir dir then (
     let files = Array.map (Filename.concat dir) (g#find dir) in
     let files = Array.to_list files in
     let files = List.filter g#is_file files in
+    let files = match filter with
+    | None -> files
+    | Some f -> List.filter (fun x -> not (f x)) files in
     List.iter g#rm files
(Continue reading)

Chen Hanxiao | 1 Jul 11:21 2015

[PATCH v5 0/3] uuid: add btrfs uuid change support and set_uuid_random

- Btrfs-progs v4.1 introduced new feature of changing
  uuid of btrfs partition.
  This patch add support of this.

- Introduce set_uuid_random

- uuids.c did a lot of deplicated work for changing uuid
  of fs. Use existing functions.

v5: use NOT_SUPPORTED macro
    improve testcases
v4: introduce get_random_uuid
    improve testcases
    squash internal API patches
v3.1: fix typos
v3: set errno if feature is not available.

Chen Hanxiao (3):
  uuid: add support to change uuid of btrfs partition
  uuid: use newly introduced swap_set_uuid
  New API: set_uuid_random

 daemon/btrfs.c                 | 77 ++++++++++++++++++++++++++++++++++++++++++
 daemon/daemon.h                |  8 +++++
 daemon/ext2.c                  |  6 ++++
 daemon/swap.c                  | 16 +++++++++
 daemon/uuids.c                 | 56 ++++++++++++++++++------------
 daemon/xfs.c                   |  7 ++++
 generator/actions.ml           | 16 +++++++++
 src/MAX_PROC_NR                |  2 +-
(Continue reading)


Gmane