From 7562bf29dcbf4baa423b3d304f2fd56bbe39cbf8 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Jul 01 2010 09:19:05 +0000 Subject: - Include three patches for virt-v2v: aug_clear (already included, updated to libguestfs 1.2.9) link_local_addresses (avoid 10.x network clash) use_old_slirp_syntax (workaround for ip=.. syntax for old KVM in RHEL 5) --- diff --git a/libguestfs-1.2.2-aug-clear.patch b/libguestfs-1.2.2-aug-clear.patch deleted file mode 100644 index 7b0094d..0000000 --- a/libguestfs-1.2.2-aug-clear.patch +++ /dev/null @@ -1,70 +0,0 @@ -Backport of the guestfs_aug_clear API from upstream development branch -(commit 66477d07e37ffe66c). - -diff -ur libguestfs-1.2.2.orig/daemon/augeas.c libguestfs-1.2.2/daemon/augeas.c ---- libguestfs-1.2.2.orig/daemon/augeas.c 2010-04-12 19:03:41.000000000 +0100 -+++ libguestfs-1.2.2/daemon/augeas.c 2010-04-14 10:03:10.307680521 +0100 -@@ -210,6 +210,26 @@ - } - - int -+do_aug_clear (const char *path) -+{ -+#ifdef HAVE_AUGEAS -+ int r; -+ -+ NEED_AUG (-1); -+ -+ r = aug_set (aug, path, NULL); -+ if (r == -1) { -+ reply_with_error ("Augeas clear failed"); -+ return -1; -+ } -+ -+ return 0; -+#else -+ NOT_AVAILABLE (-1); -+#endif -+} -+ -+int - do_aug_insert (const char *path, const char *label, int before) - { - #ifdef HAVE_AUGEAS -diff -ur libguestfs-1.2.2.orig/src/generator.ml libguestfs-1.2.2/src/generator.ml ---- libguestfs-1.2.2.orig/src/generator.ml 2010-04-12 19:05:28.000000000 +0100 -+++ libguestfs-1.2.2/src/generator.ml 2010-04-14 10:03:10.312679892 +0100 -@@ -1238,7 +1238,12 @@ - [], (* XXX Augeas code needs tests. *) - "set Augeas path to value", - "\ --Set the value associated with C to C."); -+Set the value associated with C to C. -+ -+In the Augeas API, it is possible to clear a node by setting -+the value to NULL. Due to an oversight in the libguestfs API -+you cannot do that with this call. Instead you must use the -+C call."); - - ("aug_insert", (RErr, [String "augpath"; String "label"; Bool "before"]), 21, [Optional "augeas"], - [], (* XXX Augeas code needs tests. *) -@@ -4400,6 +4405,13 @@ - You will get undefined results for other partition table - types (see C)."); - -+ ("aug_clear", (RErr, [String "augpath"]), 239, [Optional "augeas"], -+ [], (* XXX Augeas code needs tests. *) -+ "clear Augeas path", -+ "\ -+Set the value associated with C to C. This -+is the same as the L C command."); -+ - ] - - let all_functions = non_daemon_functions @ daemon_functions -diff -ur libguestfs-1.2.2.orig/src/MAX_PROC_NR libguestfs-1.2.2/src/MAX_PROC_NR ---- libguestfs-1.2.2.orig/src/MAX_PROC_NR 2010-04-12 19:06:21.000000000 +0100 -+++ libguestfs-1.2.2/src/MAX_PROC_NR 2010-04-14 10:03:43.885055262 +0100 -@@ -1 +1 @@ --236 -+239 diff --git a/libguestfs-1.2.7-link_local_addresses.patch b/libguestfs-1.2.7-link_local_addresses.patch new file mode 100644 index 0000000..cc6c9c2 --- /dev/null +++ b/libguestfs-1.2.7-link_local_addresses.patch @@ -0,0 +1,38 @@ +commit 2481eb976219f8e44d82da1ab79c7c52627185bf +Author: Richard Jones +Date: Tue May 4 16:06:58 2010 +0100 + + Use link-local addresses between appliance and host (RHBZ#588763). + +diff --git a/appliance/init b/appliance/init +index 15dab61..98538de 100755 +--- a/appliance/init ++++ b/appliance/init +@@ -52,8 +52,8 @@ hwclock -u -s + + # Set up the network. + ifconfig lo 127.0.0.1 +-ifconfig eth0 10.0.2.10 +-route add default gw 10.0.2.2 ++ifconfig eth0 169.254.2.10 ++route add default gw 169.254.2.2 + + # Scan for LVM. + modprobe dm_mod ||: +diff --git a/src/guestfs.c b/src/guestfs.c +index d23b9ae..027e08c 100644 +--- a/src/guestfs.c ++++ b/src/guestfs.c +@@ -128,9 +128,9 @@ static int qemu_supports (guestfs_h *g, const char *option); + * typical Linux configurations of libguestfs, guestfwd is not + * actually used any more. + */ +-#define NETWORK "10.0.2.0/8" +-#define ROUTER "10.0.2.2" +-#define GUESTFWD_ADDR "10.0.2.4" ++#define NETWORK "169.254.0.0/16" ++#define ROUTER "169.254.2.2" ++#define GUESTFWD_ADDR "169.254.2.4" + #define GUESTFWD_PORT "6666" + + /* GuestFS handle and connection. */ diff --git a/libguestfs-1.2.7-use_old_slirp_syntax.patch b/libguestfs-1.2.7-use_old_slirp_syntax.patch new file mode 100644 index 0000000..9c5abd3 --- /dev/null +++ b/libguestfs-1.2.7-use_old_slirp_syntax.patch @@ -0,0 +1,26 @@ +commit a9985a761c98c7c980d7b9f80a4737a07ae0d21a +Author: Matthew Booth +Date: Mon May 24 10:47:33 2010 +0100 + + RHEL 5: Use old ip= syntax to set slirp network + +diff --git a/src/guestfs.c b/src/guestfs.c +index 027e08c..2aff72b 100644 +--- a/src/guestfs.c ++++ b/src/guestfs.c +@@ -1208,7 +1208,14 @@ guestfs__launch (guestfs_h *g) + */ + if (null_vmchannel_sock) { + add_cmdline (g, "-net"); +- add_cmdline (g, "user,vlan=0,net=" NETWORK); ++ ++ /* The slirp stack in RHEL 5's qemu-kvm only supports an old, undocumented ++ * option, ip=x.x.x.0, to modify the default network configuration. ++ * Despite being called 'ip', it actually refers to the class C network ++ * from which default IP address will be allocated. It must end in .0, or ++ * it will not work predictably. */ ++ add_cmdline (g, "user,vlan=0,ip=169.254.2.0"); ++ /* add_cmdline (g, "user,vlan=0,net=" NETWORK); */ + + snprintf (buf, sizeof buf, + "guestfs_vmchannel=tcp:" ROUTER ":%d", diff --git a/libguestfs-1.2.9-aug-clear-full.patch b/libguestfs-1.2.9-aug-clear-full.patch new file mode 100644 index 0000000..0e5d093 --- /dev/null +++ b/libguestfs-1.2.9-aug-clear-full.patch @@ -0,0 +1,694 @@ +diff -ur libguestfs-1.2.9.orig/capitests/tests.c libguestfs-1.2.9/capitests/tests.c +--- libguestfs-1.2.9.orig/capitests/tests.c 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/capitests/tests.c 2010-07-01 09:46:34.576550154 +0100 +@@ -164,6 +164,7 @@ + fprintf (stderr, "warning: \"guestfs_lvuuid\" has no tests\n"); + fprintf (stderr, "warning: \"guestfs_vgpvuuids\" has no tests\n"); + fprintf (stderr, "warning: \"guestfs_vglvuuids\" has no tests\n"); ++ fprintf (stderr, "warning: \"guestfs_aug_clear\" has no tests\n"); + } + + static int test_part_get_mbr_id_0_skip (void) +diff -ur libguestfs-1.2.9.orig/daemon/actions.h libguestfs-1.2.9/daemon/actions.h +--- libguestfs-1.2.9.orig/daemon/actions.h 2010-04-12 19:13:30.000000000 +0100 ++++ libguestfs-1.2.9/daemon/actions.h 2010-07-01 09:46:34.580800684 +0100 +@@ -253,3 +253,4 @@ + extern int do_part_get_bootable (const char *device, int partnum); + extern int do_part_get_mbr_id (const char *device, int partnum); + extern int do_part_set_mbr_id (const char *device, int partnum, int idbyte); ++extern int do_aug_clear (const char *augpath); +diff -ur libguestfs-1.2.9.orig/daemon/augeas.c libguestfs-1.2.9/daemon/augeas.c +--- libguestfs-1.2.9.orig/daemon/augeas.c 2010-04-12 19:03:41.000000000 +0100 ++++ libguestfs-1.2.9/daemon/augeas.c 2010-07-01 09:46:34.580800684 +0100 +@@ -210,6 +210,26 @@ + } + + int ++do_aug_clear (const char *path) ++{ ++#ifdef HAVE_AUGEAS ++ int r; ++ ++ NEED_AUG (-1); ++ ++ r = aug_set (aug, path, NULL); ++ if (r == -1) { ++ reply_with_error ("Augeas clear failed"); ++ return -1; ++ } ++ ++ return 0; ++#else ++ NOT_AVAILABLE (-1); ++#endif ++} ++ ++int + do_aug_insert (const char *path, const char *label, int before) + { + #ifdef HAVE_AUGEAS +diff -ur libguestfs-1.2.9.orig/daemon/names.c libguestfs-1.2.9/daemon/names.c +--- libguestfs-1.2.9.orig/daemon/names.c 2010-04-12 19:13:30.000000000 +0100 ++++ libguestfs-1.2.9/daemon/names.c 2010-07-01 09:46:34.581800834 +0100 +@@ -257,4 +257,5 @@ + [234] = "part_get_bootable", + [235] = "part_get_mbr_id", + [236] = "part_set_mbr_id", ++ [239] = "aug_clear", + }; +diff -ur libguestfs-1.2.9.orig/daemon/stubs.c libguestfs-1.2.9/daemon/stubs.c +--- libguestfs-1.2.9.orig/daemon/stubs.c 2010-04-12 19:13:30.000000000 +0100 ++++ libguestfs-1.2.9/daemon/stubs.c 2010-07-01 09:46:34.583800338 +0100 +@@ -6042,6 +6042,29 @@ + xdr_free ((xdrproc_t) xdr_guestfs_part_set_mbr_id_args, (char *) &args); + } + ++static void aug_clear_stub (XDR *xdr_in) ++{ ++ int r; ++ struct guestfs_aug_clear_args args; ++ ++ memset (&args, 0, sizeof args); ++ ++ if (!xdr_guestfs_aug_clear_args (xdr_in, &args)) { ++ reply_with_error ("daemon failed to decode procedure arguments"); ++ return; ++ } ++ char *augpath = args.augpath; ++ ++ r = do_aug_clear (augpath); ++ if (r == -1) ++ /* do_aug_clear has already called reply_with_error */ ++ goto done; ++ ++ reply (NULL, NULL); ++done: ++ xdr_free ((xdrproc_t) xdr_guestfs_aug_clear_args, (char *) &args); ++} ++ + void dispatch_incoming_message (XDR *xdr_in) + { + switch (proc_nr) { +@@ -6738,6 +6761,9 @@ + case GUESTFS_PROC_PART_SET_MBR_ID: + part_set_mbr_id_stub (xdr_in); + break; ++ case GUESTFS_PROC_AUG_CLEAR: ++ aug_clear_stub (xdr_in); ++ break; + default: + reply_with_error ("dispatch_incoming_message: unknown procedure number %d, set LIBGUESTFS_PATH to point to the matching libguestfs appliance directory", proc_nr); + } +diff -ur libguestfs-1.2.9.orig/fish/cmds.c libguestfs-1.2.9/fish/cmds.c +--- libguestfs-1.2.9.orig/fish/cmds.c 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/fish/cmds.c 2010-07-01 09:53:48.071675195 +0100 +@@ -42,6 +42,7 @@ + printf ("%-20s %s\n", "add-drive-ro", _("add a drive in snapshot mode (read-only)")); + printf ("%-20s %s\n", "add-drive-ro-with-if", _("add a drive read-only specifying the QEMU block emulation to use")); + printf ("%-20s %s\n", "add-drive-with-if", _("add a drive specifying the QEMU block emulation to use")); ++ printf ("%-20s %s\n", "aug-clear", _("clear Augeas path")); + printf ("%-20s %s\n", "aug-close", _("close the current Augeas handle")); + printf ("%-20s %s\n", "aug-defnode", _("define an Augeas node")); + printf ("%-20s %s\n", "aug-defvar", _("define an Augeas variable")); +@@ -584,7 +585,7 @@ + } + else + if (STRCASEEQ (cmd, "aug_set") || STRCASEEQ (cmd, "aug-set")) { +- pod2text ("aug-set", _("set Augeas path to value"), "=head1 SYNOPSIS\n\n aug-set augpath val\n\n=head1 DESCRIPTION\n\nSet the value associated with C to C."); ++ pod2text ("aug-set", _("set Augeas path to value"), "=head1 SYNOPSIS\n\n aug-set augpath val\n\n=head1 DESCRIPTION\n\nSet the value associated with C to C.\n\nIn the Augeas API, it is possible to clear a node by setting\nthe value to NULL. Due to an oversight in the libguestfs API\nyou cannot do that with this call. Instead you must use the\nC call."); + return 0; + } + else +@@ -1638,6 +1639,11 @@ + return 0; + } + else ++ if (STRCASEEQ (cmd, "aug_clear") || STRCASEEQ (cmd, "aug-clear")) { ++ pod2text ("aug-clear", _("clear Augeas path"), "=head1 SYNOPSIS\n\n aug-clear augpath\n\n=head1 DESCRIPTION\n\nSet the value associated with C to C. This\nis the same as the L C command."); ++ return 0; ++ } ++ else + return display_builtin_command (cmd); + } + +@@ -7572,6 +7578,20 @@ + return r; + } + ++static int run_aug_clear (const char *cmd, int argc, char *argv[]) ++{ ++ int r; ++ const char *augpath; ++ if (argc != 1) { ++ fprintf (stderr, _("%s should have %d parameter(s)\n"), cmd, 1); ++ fprintf (stderr, _("type 'help %s' for help on %s\n"), cmd, cmd); ++ return -1; ++ } ++ augpath = argv[0]; ++ r = guestfs_aug_clear (g, augpath); ++ return r; ++} ++ + int run_action (const char *cmd, int argc, char *argv[]) + { + if (STRCASEEQ (cmd, "launch") || STRCASEEQ (cmd, "run")) +@@ -8372,6 +8392,9 @@ + if (STRCASEEQ (cmd, "part_set_mbr_id") || STRCASEEQ (cmd, "part-set-mbr-id")) + return run_part_set_mbr_id (cmd, argc, argv); + else ++ if (STRCASEEQ (cmd, "aug_clear") || STRCASEEQ (cmd, "aug-clear")) ++ return run_aug_clear (cmd, argc, argv); ++ else + { + fprintf (stderr, _("%s: unknown command\n"), cmd); + if (command_num == 1) +diff -ur libguestfs-1.2.9.orig/fish/completion.c libguestfs-1.2.9/fish/completion.c +--- libguestfs-1.2.9.orig/fish/completion.c 2010-04-12 19:13:30.000000000 +0100 ++++ libguestfs-1.2.9/fish/completion.c 2010-07-01 09:46:34.589582308 +0100 +@@ -319,6 +319,7 @@ + "part-get-bootable", + "part-get-mbr-id", + "part-set-mbr-id", ++ "aug-clear", + NULL + }; + +diff -ur libguestfs-1.2.9.orig/fish/guestfish-actions.pod libguestfs-1.2.9/fish/guestfish-actions.pod +--- libguestfs-1.2.9.orig/fish/guestfish-actions.pod 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/fish/guestfish-actions.pod 2010-07-01 09:53:57.563550555 +0100 +@@ -98,6 +98,13 @@ + This is the same as C but it allows you + to specify the QEMU interface emulation to use at run time. + ++=head2 aug-clear ++ ++ aug-clear augpath ++ ++Set the value associated with C to C. This ++is the same as the L C command. ++ + =head2 aug-close + + aug-close +@@ -257,6 +264,11 @@ + + Set the value associated with C to C. + ++In the Augeas API, it is possible to clear a node by setting ++the value to NULL. Due to an oversight in the libguestfs API ++you cannot do that with this call. Instead you must use the ++C call. ++ + =head2 available + + available 'groups ...' +diff -ur libguestfs-1.2.9.orig/haskell/Guestfs.hs libguestfs-1.2.9/haskell/Guestfs.hs +--- libguestfs-1.2.9.orig/haskell/Guestfs.hs 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/haskell/Guestfs.hs 2010-07-01 09:46:34.591800303 +0100 +@@ -191,7 +191,8 @@ + copy_size, + part_del, + part_get_mbr_id, +- part_set_mbr_id ++ part_set_mbr_id, ++ aug_clear + ) where + + -- Unfortunately some symbols duplicate ones already present +@@ -2252,3 +2253,15 @@ + fail err + else return () + ++foreign import ccall unsafe "guestfs_aug_clear" c_aug_clear ++ :: GuestfsP -> CString -> IO (CInt) ++ ++aug_clear :: GuestfsH -> String -> IO () ++aug_clear h augpath = do ++ r <- withCString augpath $ \augpath -> withForeignPtr h (\p -> c_aug_clear p augpath) ++ if (r == -1) ++ then do ++ err <- last_error h ++ fail err ++ else return () ++ +diff -ur libguestfs-1.2.9.orig/java/com/redhat/et/libguestfs/GuestFS.java libguestfs-1.2.9/java/com/redhat/et/libguestfs/GuestFS.java +--- libguestfs-1.2.9.orig/java/com/redhat/et/libguestfs/GuestFS.java 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/java/com/redhat/et/libguestfs/GuestFS.java 2010-07-01 09:54:49.198925171 +0100 +@@ -1658,6 +1658,11 @@ + *

+ * Set the value associated with "path" to "value". + *

++ * In the Augeas API, it is possible to clear a node by ++ * setting the value to NULL. Due to an oversight in the ++ * libguestfs API you cannot do that with this call. ++ * Instead you must use the "g.aug_clear" call. ++ *

+ * @throws LibGuestFSException + */ + public void aug_set (String augpath, String val) +@@ -6610,4 +6615,22 @@ + private native void _part_set_mbr_id (long g, String device, int partnum, int idbyte) + throws LibGuestFSException; + ++ /** ++ * clear Augeas path ++ *

++ * Set the value associated with "path" to "NULL". This is ++ * the same as the augtool(1) "clear" command. ++ *

++ * @throws LibGuestFSException ++ */ ++ public void aug_clear (String augpath) ++ throws LibGuestFSException ++ { ++ if (g == 0) ++ throw new LibGuestFSException ("aug_clear: handle is closed"); ++ _aug_clear (g, augpath); ++ } ++ private native void _aug_clear (long g, String augpath) ++ throws LibGuestFSException; ++ + } +diff -ur libguestfs-1.2.9.orig/java/com_redhat_et_libguestfs_GuestFS.c libguestfs-1.2.9/java/com_redhat_et_libguestfs_GuestFS.c +--- libguestfs-1.2.9.orig/java/com_redhat_et_libguestfs_GuestFS.c 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/java/com_redhat_et_libguestfs_GuestFS.c 2010-07-01 09:46:34.595613939 +0100 +@@ -6784,3 +6784,20 @@ + } + } + ++JNIEXPORT void JNICALL ++Java_com_redhat_et_libguestfs_GuestFS__1aug_1clear ++ (JNIEnv *env, jobject obj, jlong jg, jstring jaugpath) ++{ ++ guestfs_h *g = (guestfs_h *) (long) jg; ++ int r; ++ const char *augpath; ++ ++ augpath = (*env)->GetStringUTFChars (env, jaugpath, NULL); ++ r = guestfs_aug_clear (g, augpath); ++ (*env)->ReleaseStringUTFChars (env, jaugpath, augpath); ++ if (r == -1) { ++ throw_exception (env, guestfs_last_error (g)); ++ return ; ++ } ++} ++ +diff -ur libguestfs-1.2.9.orig/ocaml/guestfs_c_actions.c libguestfs-1.2.9/ocaml/guestfs_c_actions.c +--- libguestfs-1.2.9.orig/ocaml/guestfs_c_actions.c 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/ocaml/guestfs_c_actions.c 2010-07-01 09:46:34.597800688 +0100 +@@ -676,6 +676,36 @@ + } + + /* Automatically generated wrapper for function ++ * val aug_clear : t -> string -> unit ++ */ ++ ++/* Emit prototype to appease gcc's -Wmissing-prototypes. */ ++CAMLprim value ocaml_guestfs_aug_clear (value gv, value augpathv); ++ ++CAMLprim value ++ocaml_guestfs_aug_clear (value gv, value augpathv) ++{ ++ CAMLparam2 (gv, augpathv); ++ CAMLlocal1 (rv); ++ ++ guestfs_h *g = Guestfs_val (gv); ++ if (g == NULL) ++ ocaml_guestfs_raise_closed ("aug_clear"); ++ ++ const char *augpath = String_val (augpathv); ++ int r; ++ ++ caml_enter_blocking_section (); ++ r = guestfs_aug_clear (g, augpath); ++ caml_leave_blocking_section (); ++ if (r == -1) ++ ocaml_guestfs_raise_error (g, "aug_clear"); ++ ++ rv = Val_unit; ++ CAMLreturn (rv); ++} ++ ++/* Automatically generated wrapper for function + * val aug_close : t -> unit + */ + +diff -ur libguestfs-1.2.9.orig/ocaml/guestfs.ml libguestfs-1.2.9/ocaml/guestfs.ml +--- libguestfs-1.2.9.orig/ocaml/guestfs.ml 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/ocaml/guestfs.ml 2010-07-01 09:46:34.599800230 +0100 +@@ -163,6 +163,7 @@ + external add_drive_ro : t -> string -> unit = "ocaml_guestfs_add_drive_ro" + external add_drive_ro_with_if : t -> string -> string -> unit = "ocaml_guestfs_add_drive_ro_with_if" + external add_drive_with_if : t -> string -> string -> unit = "ocaml_guestfs_add_drive_with_if" ++external aug_clear : t -> string -> unit = "ocaml_guestfs_aug_clear" + external aug_close : t -> unit = "ocaml_guestfs_aug_close" + external aug_defnode : t -> string -> string -> string -> int_bool = "ocaml_guestfs_aug_defnode" + external aug_defvar : t -> string -> string option -> int = "ocaml_guestfs_aug_defvar" +diff -ur libguestfs-1.2.9.orig/ocaml/guestfs.mli libguestfs-1.2.9/ocaml/guestfs.mli +--- libguestfs-1.2.9.orig/ocaml/guestfs.mli 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/ocaml/guestfs.mli 2010-07-01 09:46:34.600800871 +0100 +@@ -186,6 +186,9 @@ + val add_drive_with_if : t -> string -> string -> unit + (** add a drive specifying the QEMU block emulation to use *) + ++val aug_clear : t -> string -> unit ++(** clear Augeas path *) ++ + val aug_close : t -> unit + (** close the current Augeas handle *) + +diff -ur libguestfs-1.2.9.orig/perl/Guestfs.xs libguestfs-1.2.9/perl/Guestfs.xs +--- libguestfs-1.2.9.orig/perl/Guestfs.xs 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/perl/Guestfs.xs 2010-07-01 09:46:34.601801899 +0100 +@@ -4382,3 +4382,14 @@ + if (r == -1) + croak ("%s", guestfs_last_error (g)); + ++void ++aug_clear (g, augpath) ++ guestfs_h *g; ++ char *augpath; ++PREINIT: ++ int r; ++ PPCODE: ++ r = guestfs_aug_clear (g, augpath); ++ if (r == -1) ++ croak ("%s", guestfs_last_error (g)); ++ +diff -ur libguestfs-1.2.9.orig/perl/lib/Sys/Guestfs.pm libguestfs-1.2.9/perl/lib/Sys/Guestfs.pm +--- libguestfs-1.2.9.orig/perl/lib/Sys/Guestfs.pm 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/perl/lib/Sys/Guestfs.pm 2010-07-01 09:55:51.509675781 +0100 +@@ -186,6 +186,11 @@ + This is the same as C<$h-Eadd_drive> but it allows you + to specify the QEMU interface emulation to use at run time. + ++=item $h->aug_clear ($augpath); ++ ++Set the value associated with C to C. This ++is the same as the L C command. ++ + =item $h->aug_close (); + + Close the current Augeas handle and free up any resources +@@ -319,6 +324,11 @@ + + Set the value associated with C to C. + ++In the Augeas API, it is possible to clear a node by setting ++the value to NULL. Due to an oversight in the libguestfs API ++you cannot do that with this call. Instead you must use the ++C<$h-Eaug_clear> call. ++ + =item $h->available (\@groups); + + This command is used to check the availability of some +diff -ur libguestfs-1.2.9.orig/python/guestfs.py libguestfs-1.2.9/python/guestfs.py +--- libguestfs-1.2.9.orig/python/guestfs.py 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/python/guestfs.py 2010-07-01 09:56:06.709674864 +0100 +@@ -860,6 +860,11 @@ + + def aug_set (self, augpath, val): + u"""Set the value associated with "path" to "value". ++ ++ In the Augeas API, it is possible to clear a node by ++ setting the value to NULL. Due to an oversight in the ++ libguestfs API you cannot do that with this call. ++ Instead you must use the "g.aug_clear" call. + """ + return libguestfsmod.aug_set (self._o, augpath, val) + +@@ -3377,3 +3382,9 @@ + """ + return libguestfsmod.part_set_mbr_id (self._o, device, partnum, idbyte) + ++ def aug_clear (self, augpath): ++ u"""Set the value associated with "path" to "NULL". This is ++ the same as the augtool(1) "clear" command. ++ """ ++ return libguestfsmod.aug_clear (self._o, augpath) ++ +diff -ur libguestfs-1.2.9.orig/python/guestfs-py.c libguestfs-1.2.9/python/guestfs-py.c +--- libguestfs-1.2.9.orig/python/guestfs-py.c 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/python/guestfs-py.c 2010-07-01 09:46:34.607553793 +0100 +@@ -7870,6 +7870,31 @@ + return py_r; + } + ++static PyObject * ++py_guestfs_aug_clear (PyObject *self, PyObject *args) ++{ ++ PyObject *py_g; ++ guestfs_h *g; ++ PyObject *py_r; ++ int r; ++ const char *augpath; ++ ++ if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_aug_clear", ++ &py_g, &augpath)) ++ return NULL; ++ g = get_handle (py_g); ++ ++ r = guestfs_aug_clear (g, augpath); ++ if (r == -1) { ++ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g)); ++ return NULL; ++ } ++ ++ Py_INCREF (Py_None); ++ py_r = Py_None; ++ return py_r; ++} ++ + static PyMethodDef methods[] = { + { (char *) "create", py_guestfs_create, METH_VARARGS, NULL }, + { (char *) "close", py_guestfs_close, METH_VARARGS, NULL }, +@@ -8161,6 +8186,7 @@ + { (char *) "part_get_bootable", py_guestfs_part_get_bootable, METH_VARARGS, NULL }, + { (char *) "part_get_mbr_id", py_guestfs_part_get_mbr_id, METH_VARARGS, NULL }, + { (char *) "part_set_mbr_id", py_guestfs_part_set_mbr_id, METH_VARARGS, NULL }, ++ { (char *) "aug_clear", py_guestfs_aug_clear, METH_VARARGS, NULL }, + { NULL, NULL, 0, NULL } + }; + +diff -ur libguestfs-1.2.9.orig/ruby/ext/guestfs/_guestfs.c libguestfs-1.2.9/ruby/ext/guestfs/_guestfs.c +--- libguestfs-1.2.9.orig/ruby/ext/guestfs/_guestfs.c 2010-05-24 14:06:11.000000000 +0100 ++++ libguestfs-1.2.9/ruby/ext/guestfs/_guestfs.c 2010-07-01 09:46:34.609800607 +0100 +@@ -7393,6 +7393,28 @@ + return Qnil; + } + ++static VALUE ruby_guestfs_aug_clear (VALUE gv, VALUE augpathv) ++{ ++ guestfs_h *g; ++ Data_Get_Struct (gv, guestfs_h, g); ++ if (!g) ++ rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_clear"); ++ ++ Check_Type (augpathv, T_STRING); ++ const char *augpath = StringValueCStr (augpathv); ++ if (!augpath) ++ rb_raise (rb_eTypeError, "expected string for parameter %s of %s", ++ "augpath", "aug_clear"); ++ ++ int r; ++ ++ r = guestfs_aug_clear (g, augpath); ++ if (r == -1) ++ rb_raise (e_Error, "%s", guestfs_last_error (g)); ++ ++ return Qnil; ++} ++ + /* Initialize the module. */ + void Init__guestfs () + { +@@ -7979,4 +8001,6 @@ + ruby_guestfs_part_get_mbr_id, 2); + rb_define_method (c_guestfs, "part_set_mbr_id", + ruby_guestfs_part_set_mbr_id, 3); ++ rb_define_method (c_guestfs, "aug_clear", ++ ruby_guestfs_aug_clear, 1); + } +diff -ur libguestfs-1.2.9.orig/src/generator.ml libguestfs-1.2.9/src/generator.ml +--- libguestfs-1.2.9.orig/src/generator.ml 2010-06-02 19:48:45.000000000 +0100 ++++ libguestfs-1.2.9/src/generator.ml 2010-07-01 09:53:51.489675473 +0100 +@@ -1250,7 +1250,12 @@ + [], (* XXX Augeas code needs tests. *) + "set Augeas path to value", + "\ +-Set the value associated with C to C."); ++Set the value associated with C to C. ++ ++In the Augeas API, it is possible to clear a node by setting ++the value to NULL. Due to an oversight in the libguestfs API ++you cannot do that with this call. Instead you must use the ++C call."); + + ("aug_insert", (RErr, [String "augpath"; String "label"; Bool "before"]), 21, [Optional "augeas"], + [], (* XXX Augeas code needs tests. *) +@@ -4497,6 +4502,13 @@ + You will get undefined results for other partition table + types (see C)."); + ++ ("aug_clear", (RErr, [String "augpath"]), 239, [Optional "augeas"], ++ [], (* XXX Augeas code needs tests. *) ++ "clear Augeas path", ++ "\ ++Set the value associated with C to C. This ++is the same as the L C command."); ++ + ] + + let all_functions = non_daemon_functions @ daemon_functions +diff -ur libguestfs-1.2.9.orig/src/guestfs-actions.c libguestfs-1.2.9/src/guestfs-actions.c +--- libguestfs-1.2.9.orig/src/guestfs-actions.c 2010-05-24 14:06:10.000000000 +0100 ++++ libguestfs-1.2.9/src/guestfs-actions.c 2010-07-01 09:46:34.616800354 +0100 +@@ -13696,6 +13696,58 @@ + return 0; + } + ++int guestfs_aug_clear (guestfs_h *g, ++ const char *augpath) ++{ ++ struct guestfs_aug_clear_args args; ++ guestfs_message_header hdr; ++ guestfs_message_error err; ++ int serial; ++ int r; ++ ++ if (guestfs__get_trace (g)) { ++ printf ("aug_clear"); ++ printf (" \"%s\"", augpath); ++ putchar ('\n'); ++ } ++ ++ if (check_state (g, "guestfs_aug_clear") == -1) return -1; ++ guestfs___set_busy (g); ++ ++ args.augpath = (char *) augpath; ++ serial = guestfs___send (g, GUESTFS_PROC_AUG_CLEAR, ++ (xdrproc_t) xdr_guestfs_aug_clear_args, (char *) &args); ++ if (serial == -1) { ++ guestfs___end_busy (g); ++ return -1; ++ } ++ ++ memset (&hdr, 0, sizeof hdr); ++ memset (&err, 0, sizeof err); ++ ++ r = guestfs___recv (g, "aug_clear", &hdr, &err, ++ NULL, NULL); ++ if (r == -1) { ++ guestfs___end_busy (g); ++ return -1; ++ } ++ ++ if (check_reply_header (g, &hdr, GUESTFS_PROC_AUG_CLEAR, serial) == -1) { ++ guestfs___end_busy (g); ++ return -1; ++ } ++ ++ if (hdr.status == GUESTFS_STATUS_ERROR) { ++ error (g, "%s: %s", "aug_clear", err.error_message); ++ free (err.error_message); ++ guestfs___end_busy (g); ++ return -1; ++ } ++ ++ guestfs___end_busy (g); ++ return 0; ++} ++ + /* Structure-freeing functions. These rely on the fact that the + * structure format is identical to the XDR format. See note in + * generator.ml. +diff -ur libguestfs-1.2.9.orig/src/guestfs-actions.h libguestfs-1.2.9/src/guestfs-actions.h +--- libguestfs-1.2.9.orig/src/guestfs-actions.h 2010-04-20 08:48:32.000000000 +0100 ++++ libguestfs-1.2.9/src/guestfs-actions.h 2010-07-01 09:46:34.617800534 +0100 +@@ -308,3 +308,4 @@ + extern int guestfs_part_get_bootable (guestfs_h *g, const char *device, int partnum); + extern int guestfs_part_get_mbr_id (guestfs_h *g, const char *device, int partnum); + extern int guestfs_part_set_mbr_id (guestfs_h *g, const char *device, int partnum, int idbyte); ++extern int guestfs_aug_clear (guestfs_h *g, const char *augpath); +diff -ur libguestfs-1.2.9.orig/src/guestfs-actions.pod libguestfs-1.2.9/src/guestfs-actions.pod +--- libguestfs-1.2.9.orig/src/guestfs-actions.pod 2010-06-02 19:53:56.000000000 +0100 ++++ libguestfs-1.2.9/src/guestfs-actions.pod 2010-07-01 09:56:39.077925599 +0100 +@@ -115,6 +115,16 @@ + + This function returns 0 on success or -1 on error. + ++=head2 guestfs_aug_clear ++ ++ int guestfs_aug_clear (guestfs_h *g, ++ const char *augpath); ++ ++Set the value associated with C to C. This ++is the same as the L C command. ++ ++This function returns 0 on success or -1 on error. ++ + =head2 guestfs_aug_close + + int guestfs_aug_close (guestfs_h *g); +@@ -323,6 +333,11 @@ + + Set the value associated with C to C. + ++In the Augeas API, it is possible to clear a node by setting ++the value to NULL. Due to an oversight in the libguestfs API ++you cannot do that with this call. Instead you must use the ++C call. ++ + This function returns 0 on success or -1 on error. + + =head2 guestfs_available +diff -ur libguestfs-1.2.9.orig/src/guestfs-availability.pod libguestfs-1.2.9/src/guestfs-availability.pod +--- libguestfs-1.2.9.orig/src/guestfs-availability.pod 2010-03-16 19:47:56.000000000 +0000 ++++ libguestfs-1.2.9/src/guestfs-availability.pod 2010-07-01 09:46:34.619800320 +0100 +@@ -3,6 +3,7 @@ + =item B + + The following functions: ++L + L + L + L +diff -ur libguestfs-1.2.9.orig/src/guestfs_protocol.x libguestfs-1.2.9/src/guestfs_protocol.x +--- libguestfs-1.2.9.orig/src/guestfs_protocol.x 2010-04-12 19:13:29.000000000 +0100 ++++ libguestfs-1.2.9/src/guestfs_protocol.x 2010-07-01 09:46:34.620800417 +0100 +@@ -1567,6 +1567,10 @@ + int idbyte; + }; + ++struct guestfs_aug_clear_args { ++ string augpath<>; ++}; ++ + enum guestfs_procedure { + GUESTFS_PROC_MOUNT = 1, + GUESTFS_PROC_SYNC = 2, +@@ -1799,6 +1803,7 @@ + GUESTFS_PROC_PART_GET_BOOTABLE = 234, + GUESTFS_PROC_PART_GET_MBR_ID = 235, + GUESTFS_PROC_PART_SET_MBR_ID = 236, ++ GUESTFS_PROC_AUG_CLEAR = 239, + GUESTFS_PROC_NR_PROCS + }; + +diff -ur libguestfs-1.2.9.orig/src/libguestfs.syms libguestfs-1.2.9/src/libguestfs.syms +--- libguestfs-1.2.9.orig/src/libguestfs.syms 2010-04-12 19:13:30.000000000 +0100 ++++ libguestfs-1.2.9/src/libguestfs.syms 2010-07-01 09:46:34.621654059 +0100 +@@ -26,6 +26,7 @@ + guestfs_add_drive_ro; + guestfs_add_drive_ro_with_if; + guestfs_add_drive_with_if; ++ guestfs_aug_clear; + guestfs_aug_close; + guestfs_aug_defnode; + guestfs_aug_defvar; +diff -ur libguestfs-1.2.9.orig/src/MAX_PROC_NR libguestfs-1.2.9/src/MAX_PROC_NR +--- libguestfs-1.2.9.orig/src/MAX_PROC_NR 2010-04-12 19:06:21.000000000 +0100 ++++ libguestfs-1.2.9/src/MAX_PROC_NR 2010-07-01 09:46:34.621654059 +0100 +@@ -1 +1 @@ +-236 ++239 diff --git a/libguestfs.spec b/libguestfs.spec index 9ef9a25..363dd26 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -42,7 +42,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.2.9 -Release: 1%{?dist}.1 +Release: 1%{?dist}.2 License: LGPLv2+ Group: Development/Libraries URL: http://libguestfs.org/ @@ -57,7 +57,12 @@ ExclusiveArch: %{ix86} x86_64 Patch0: libguestfs-1.0.79-no-fuse-test.patch # Backport the new API aug_clear from upstream development branch. -Patch1: libguestfs-1.2.2-aug-clear.patch +Patch1: libguestfs-1.2.9-aug-clear-full.patch + +# Use link-local addresses to avoid 10.x network clash. We also +# need a patch to use ip=.. syntax for the old KVM in RHEL 5. +Patch2: libguestfs-1.2.7-link_local_addresses.patch +Patch3: libguestfs-1.2.7-use_old_slirp_syntax.patch # Basic build requirements: BuildRequires: /usr/bin/pod2man @@ -394,6 +399,8 @@ Requires: jpackage-utils %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 mkdir -p daemon/m4 @@ -689,6 +696,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Jul 1 2010 Richard W.M. Jones - 1:1.2.9-1.el5.2 +- Include three patches for virt-v2v: + * aug_clear (already included, updated to libguestfs 1.2.9) + * link_local_addresses (avoid 10.x network clash) + * use_old_slirp_syntax (workaround for ip=.. syntax for old KVM in RHEL 5) + * Thu Jun 3 2010 Richard W.M. Jones - 1:1.2.9-1.el5.1 - Don't skip parted tests, these should now pass.