Import Xen image

93 views
Skip to first unread message

al.o

unread,
Dec 11, 2007, 4:24:13 AM12/11/07
to ganeti
Hi,

i'm testing ganeti 1.2 beta on two node in order to make a production
environment with ganeti 1.2.
Everything works fine... wonderfull... amazing :)

I'm a newbie of xen, ganeti & drbd... In my test environment i use
drbd 0.7, and i usually don't love to use backports. What feature adds
using drbd 0.8? Could i migrate from 0.7 to 0.8 without data loss or
corruption?

I would like to know :
1. is possible to import (or "convert") a xen virtual machine in a
ganeti instance. If so, how?
2. there is a way to do the opposite (i mean convert an istance to a
single Xen VM)?
3. is possible to take a snapshot of an instance of the test env and
restore it in the production env (i think there is another post about
it.. if so forgive me... i'm searching :)

I've got a ton of question... but in the meanwhile, probably, the
right way is take a look to the code... in order to better understand
ganeti.

thanks,
Al.o

Leonardo Rodrigues de Mello

unread,
Dec 11, 2007, 6:18:31 AM12/11/07
to gan...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Alessandro,

The drbd issue is the following:
I dont know if ganeti store the drbd8 metadata inside the backend
device if it does it, then you cant migrate from drbd7 to drbd8
without dataloss.
"Make sure you don't direct DRBD to write its meta data to a place
where you already have existing data you still need. Also, if you are
using internal meta data on an existing block device with a file
system on it, make sure you shrink that file system first!"
www.drbd.org

I imagine that the simple way to do this migration is to use
gnt-backup export, then configure drbd8 and do gnt-backup import, but
this will require that the instance be offline.

Maybe ganeti developers can say something more about this issue.

That said, lets anwser some questions:

1. The correct word is not convert, but import, because ganeti use xen
as backend, and every ganeti instance is one xen instance. The
diference is the configuration file, that in xen instance is stored in
filesystem and in ganeti is stored on configuration database. Ganeti
has import and export instance feature. When you export one instance
by default it will create one directory with the name of the instance
under the directory /srv/ganeti/export.

What i had done to import one xen image is to:
If the xen image use lvm:
First create one lvm snapshot:
#lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1
Then dump the snapshot filesystem sending it to the ganeti machine.
prior to that you must configure ssh login without password using
ssh-keys (man ssh-keygen)
#dump -0 -q -f - /dev/vg_xen01/snap | gzip | ssh -q
-oStrictHostKeyChecking=yes -oBatchMode=yes -oEscapeChar=none
GANETISERVERADDRESS 'cat > /srv/ganeti/export/virtualmachine.img'
Then on ganeti server create one basic virtual machine then export it
(gnt-backup export).
Lets assume this example machine will be called vm12.labcluster it
will create the directory
with the instance name vm12.labcluster
(/srv/ganeti/export/vm12.labcluster) with the following files:
nodo404:/srv/ganeti/export/vm12.labcluster# ls
022e7c9e-224a-4287-ae6b-4884d922ead1.sda.snap config.ini
Now what you must do to import is rename your virtual machine dump
file to the name of the snap in the instance export dir:
#mv /srv/ganeti/export/virtualmachine.img \
/srv/ganeti/export/vm12.labcluster/022e7c9e-224a-4287-ae6b-4884d922ead1.sda.snap

After that just import this instance (gnt-backup import), you can
change all instance parameters like for example disk size, swap,
memory, etc.

2. Yes, export the instance using gnt-backup export, copy the file to
the xen dom0, create the config file, then restore it at the xen dom0
using the command restore (see man restore).

3. Yes, if you are using ganeti in the two environments that would be
simple, just two commands: gnt-backup export and gnt-backup import.

Best Regards.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHXnNzLsy/JSmhVFURAszKAKCbKoQGd5uRWb0yOpSMs/ULsIhQbwCfa4m8
mfl+ctBu+lQ3cVn0DaQF+/E=
=HzUN
-----END PGP SIGNATURE-----

2007/12/11, al.o <alessandro....@gmail.com>:


--
Leonardo Rodrigues de Mello
jabber: l...@lmello.eu.org

Michael Hanselmann

unread,
Dec 11, 2007, 10:26:26 AM12/11/07
to gan...@googlegroups.com
On Tue, Dec 11, 2007 at 09:18:31AM -0200, Leonardo Rodrigues de Mello wrote:
> I dont know if ganeti store the drbd8 metadata inside the backend
> device if it does it, then you cant migrate from drbd7 to drbd8
> without dataloss.

We use two different LV's to store metadata and the real data. This
means you'll be able to upgrade to DBRD 8 without data loss.

Greets,
Michael

--
System administrator, Google

Iustin Pop

unread,
Dec 13, 2007, 7:51:17 AM12/13/07
to gan...@googlegroups.com
On Tue, Dec 11, 2007 at 01:24:13AM -0800, al.o wrote:
>
> Hi,
>
> i'm testing ganeti 1.2 beta on two node in order to make a production
> environment with ganeti 1.2.
> Everything works fine... wonderfull... amazing :)
Thanks for the nice words! And sorry for the late reply...

> I'm a newbie of xen, ganeti & drbd... In my test environment i use
> drbd 0.7, and i usually don't love to use backports. What feature adds
> using drbd 0.8? Could i migrate from 0.7 to 0.8 without data loss or
> corruption?

DRBD 8 adds some features like faster disk replace and such (in case of
disk failure) but the real issue is that Ganeti 1.3 will only feature
DRBD 8 as DRBD 0.7 doesn't support live failover.

As for migration, there is no automated script that does it; we will
look into it in the future - for sure you will not need to recreate the
instance if you will migrate from 1.2+drbd7 -> 1.3+drbd8

> I would like to know :
> 1. is possible to import (or "convert") a xen virtual machine in a
> ganeti instance. If so, how?

You have write some shell code, or create a dump of the xen virtual
machine which then you can 'gnt-backup import' into ganeti


> 2. there is a way to do the opposite (i mean convert an istance to a
> single Xen VM)?

You can just copy the data off Ganeti's LVM volumes and create a xen
config file, and then you're set.

> 3. is possible to take a snapshot of an instance of the test env and
> restore it in the production env (i think there is another post about
> it.. if so forgive me... i'm searching :)

You can using gnt-backup export and import.

thanks,
iustin

Reply all
Reply to author
Forward
0 new messages