[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [libguestfs] Problem using virt-sysprep with RBD images

Hello Richard,

Haha, ok, here's a good one: I commented that if statement out at line 300, applied your patch (I see you updated the github of this code, perhaps that's the best place to grab the code from), and when I run virt-sysprep, I get the following parameter for my disk drive:

>> qemu-system-x86_64: -drive file=rbd:ibvirt-pool/server-clone-test:mon_host=\:6789\;\:6789\;\:6789:auth_supported=none,cache=writeback,id=hd0,if=none: error opening pool ibvirt-pool

Since "ibvirt-pool" doesn't exist. :)

So this says to me that the function "create_drive_non_file" is consuming that first slash somewhere.  Perhaps "safe_strdup"?  I'm not sure where "safe_strdup" is to confirm, but it looks like other functions use the "safe_stardup" function. 

With that in mind, I didn't want to have to reinvent create_drive_non_file, and without a better understanding of how all the code works together, I came up with a little hack which basically prepends the slash if there isn't one.

  if (exportname[0] != '/') {
//    char name[(sizeof exportname) + 1];
    char name[256];
    snprintf(name, sizeof name, "/%s", exportname);
    exportname = name;

My concern is long rbd-pool/rbd names, hence the commented out line, but that causes the name of the disk to be:

>> qemu-system-x86_64: -drive file=rbd:libvirt:mon_host=\:6789\;\:6789\;\:6789:auth_supported=none,cache=writeback,id=hd0,if=none: could not open disk image rbd:libvirt:mon_host=\:6789\;\:6789\;\:6789:auth_supported=none: Invalid argument

For some reason, the commented out line in the if statement above is truncating the end of the name.  Admittedly, my C skills are a bit rusty, so I'm probably overlooking something obvious.

Any thoughts on this approach?

Jon A

On Wed, Nov 6, 2013 at 12:22 PM, Richard W.M. Jones <rjones redhat com> wrote:
On Wed, Nov 06, 2013 at 11:17:14AM -0700, Jon wrote:
> I tried to comment this out and recompile guestfs, but I get an error:
> make[2]: Entering directory `/root/libguestfs-1.25.6/builder'
> ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I
> ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o
> builder.cmx
> File "builder.ml", line 53, characters 4-14:
> Error: Unbound value List.iteri
> make[2]: *** [builder.cmx] Error 2
> make[2]: Leaving directory `/root/libguestfs-1.25.6/builder'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/root/libguestfs-1.25.6'
> make: *** [all] Error 2

Hmm, this is actually another bug :-(  The attached patch should fix
this one and allow you to compile libguestfs with the older version of
OCaml that didn't have List.iteri.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]