lundi juil. 28, 2008

taking snaphost and creating template of Xen domain

For testing purpose I've used vmware images. One of the advantages was to be able to take snapshots of an image.
And to make these snapshots a template for furture image creation.

When developing on windows platforms all this save you a lot of time.

Now I am using Xen on latest release of Solaris. This great but I was missing snapshots and templates.
Thank to ZFS I am happy again.

The trick is simple : use ZFS volume to create your guests and just use cloning and snapshot feature of ZFS.

In this example I use a file to create the zfs pool, this is not reliable but this is enough as we are testing

1 - Create a file.

#mkfile -n 10g /my-image-file


2 - Create a pool on that file.

#zpool create mypool /my-image-file
#zpool status mypool
pool: mypool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
mypool ONLINE 0 0 0
/my-image-file ONLINE 0 0 0


3 - Create a volume on that new created pool.

#zfs create -V 10g mypool/myhostdisk


4 - Create the guest on this new volume.

virt-install --name=foo --hvm --file-size=10 --ram=1024 --os-type=windows --vnc --cdrom=win.iso --file=/dev/zvol/dsk/mypool/myhostdisk

That's it ! each time you want a snapshot, shutdown the guest and take a snapshot of the volume.
Cloning the snapshot will give templates.

About

Emmanuel Jannetti blog

Search

Archives
« juillet 2008 »
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
30
31
   
       
Today