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

Richard W.M. Jones rjones at redhat.com
Wed Nov 6 21:37:01 UTC 2013


On Wed, Nov 06, 2013 at 02:25:54PM -0700, Jon wrote:
> 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=192.168.0.40\:6789\;192.168.0.35\:6789\;192.168.0.2\: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.

Unfortunately this code is rather intricate (and intricately broken),
but the problem is likely to be here:

 src/drives.c:
    /* Skip the mandatory leading '/' character on exportname. */
    return safe_asprintf (g, "rbd:%s:mon_host=%s%s%s%s",
                          &src->u.exportname[1],
                          mon_host,
                          username ? username : "",
                          auth,
                          secret ? secret : "");

The problem that this code is trying (and failing) to deal with is
that when you use the URL on the guestfish command line, the URL is
something like "rbd://example.com/foo/bar" and the path part of this
has to start with a "/" character.  There is simply no way to specify
a URL without this.

However this assumption should *not* have made its way into the
libguestfs library, since other paths into this code, such as from
libvirt XML, have no such restrictions.

So it's currently somewhat broken.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)




More information about the Libguestfs mailing list