libvert qcow2 to ganeti

229 views
Skip to first unread message

Randy Bush

unread,
Mar 18, 2015, 5:51:55 AM3/18/15
to Ganeti Users
i want to move a bunch of ubuntu12.04/kvm/libvert qcow2 guests to
debian/kvm/ganeti2.11 plain. i am sure the author(s) thought that
http://docs.ganeti.org/ganeti/2.11/html/ovfconverter.html was pretty
explicit, but i guess i am to jet whacked to see a simple recipe. a
clue by four would be appreciated. thanks.

randy

Lucas, Sascha

unread,
Mar 18, 2015, 6:14:18 AM3/18/15
to Ganeti Users
Hi Randy,

AFAIK ovfconverter may be broken. However it is very easy to do things on your own:

For every VM do:

1) create "empty" Ganeti instances with --no-install matching your libvirt VMs parameters like number of CPUs, RAM size, number and size of disks, network-bridge etc.

2) activate the Ganeti instances disks (gnt-instance activate-disks <instance-name>): primary node and device names are printed on stdout

3) for every disk of an instance use "qemu-img convert /path/to/libvirt/qcow2-diskX /path/to/Ganeti/deviceX"

4) start the Ganeti instance

The above somehow assumes that you work on a single node, which means that libvirt disk images are on the same node as ganeti's disks. It is also possible to transfer disk images to another node using an ssh pipe:

$ dd if=/path/to/source | ssh nodeX dd of=/path/to/dest

I don't know if "qemu-img convert" can be integrated into this pipe (can write to stdout). If not, you must first convert the qcow2 to raw and then transfer it via ssh pipe.

HTH, Sascha.

Aufsichtsratsvorsitzender: Herbert Vogel
Geschäftsführung: Michael Krüger
Sitz der Gesellschaft: Halle/Saale
Registergericht: Amtsgericht Stendal | Handelsregister-Nr. HRB 208414
UST-ID-Nr. DE 158253683

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Empfänger sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail oder des Inhalts dieser Mail sind nicht gestattet. Diese Kommunikation per E-Mail ist nicht gegen den Zugriff durch Dritte geschützt. Die GISA GmbH haftet ausdrücklich nicht für den Inhalt und die Vollständigkeit von E-Mails und den gegebenenfalls daraus entstehenden Schaden. Sollte trotz der bestehenden Viren-Schutzprogramme durch diese E-Mail ein Virus in Ihr System gelangen, so haftet die GISA GmbH - soweit gesetzlich zulässig - nicht für die hieraus entstehenden Schäden.

Vegard Hansen

unread,
Mar 18, 2015, 6:24:45 AM3/18/15
to gan...@googlegroups.com
Hi,

There are probably better ways but, the way I did it, which went
really smoothly was to configure serial console on each instance, shut
them down, convert qcow2 to raw images using qemu-img. After the
instance was prepared I added an instance to ganeti with the correct
disk, memory size, and kernel_path and "--no-install" which I then
activated the disks on and used dd to transfer the image to the block
device over ssh.

I'm sure you could script it, for me it was just around 10 instnaces,
and took about an hour in total, mostly because of transfers.

--
Med vennlig hilsen
Vegard Hansen

candlerb

unread,
Mar 18, 2015, 7:08:41 AM3/18/15
to gan...@googlegroups.com

I don't know if "qemu-img convert" can be integrated into this pipe (can write to stdout).

It can't, so it's best to do put the source file on the node where you want the instance to be created.

My preferred approach to this is to create a new logical volume by hand, dump the data into that, and then get ganeti to "adopt" that logical volume. Then ganeti will automatically pick up the correct LV size.

There's an example of doing it here:
(this shows source vmdk, but source qcow2 would work the same)

Regards,

Brian.

Phil Regnauld

unread,
Mar 18, 2015, 7:10:57 AM3/18/15
to gan...@googlegroups.com
candlerb (b.candler) writes:
>
> My preferred approach to this is to create a new logical volume by hand,
> dump the data into that, and then get ganeti to "adopt" that logical
> volume. Then ganeti will automatically pick up the correct LV size.

Yes, that avoids embarassing dd over the wrong LV (been there, done that).

Another solution is using an NFS mount, I've done this countless times
with VMDKs.

> There's an example of doing it here:
> https://nsrc.org/workshops/2014/wacren-virtualization/raw-attachment/wiki/Agenda/ex-ganeti-instance-vmdk.htm
> (this shows source vmdk, but source qcow2 would work the same)

Exactly.

Randy Bush

unread,
Mar 27, 2015, 8:25:55 PM3/27/15
to Lucas, Sascha, Ganeti Users
sascha,

> AFAIK ovfconverter may be broken. However it is very easy to do things on your own:
>
> For every VM do:
>
> 1) create "empty" Ganeti instances with --no-install matching your
> libvirt VMs parameters like number of CPUs, RAM size, number and size
> of disks, network-bridge etc.
>
> 2) activate the Ganeti instances disks (gnt-instance activate-disks
> <instance-name>): primary node and device names are printed on stdout
>
> 3) for every disk of an instance use "qemu-img convert
> /path/to/libvirt/qcow2-diskX /path/to/Ganeti/deviceX"
>
> 4) start the Ganeti instance
>
> The above somehow assumes that you work on a single node, which means
> that libvirt disk images are on the same node as ganeti's disks. It is
> also possible to transfer disk images to another node using an ssh
> pipe:
>
> $ dd if=/path/to/source | ssh nodeX dd of=/path/to/dest
>
> I don't know if "qemu-img convert" can be integrated into this pipe
> (can write to stdout). If not, you must first convert the qcow2 to raw
> and then transfer it via ssh pipe.

so this worked excellently, thank you.

do you have a recipe when the libvert source has
a main qcow2 vm
secondary disks, sdb, sdc, ...

rndy
Reply all
Reply to author
Forward
0 new messages