Monthly Archives: November 2011

ganeti notes

Listing instances with detailed info
$ gnt-instance list -o name,status,oper_ram,oper_vcpus,pnode,snodes,network_port

Creating a snapshot using gnt-backup
$ gnt-backup export -n NODE --noshutdown NAME
$ gnt-backup list -n NODE
# backup all non-drbd instances
$ for INSTANCE in $(gnt-instance list -oname,disk_template --separator=:| grep plain | cut -f1 -d:); \
do gnt-backup export -n NODE --noshutdown $INSTANCE; done

Adopting a raw file-based KVM instance from a Samba share
$ mkdir -p /mnt/images/ && mount -t cifs -ouser=guest,password='' //samba.server/images/ /mnt/images/
$ qemu-img info /mnt/images/NAME # to get the SIZE
$ lvcreate -LSIZE vmvg -n
$ time dd if=/mnt/tmp/raw/NAME of=/dev/vmvg/
$ gnt-instance add -t plain -n NODE -o image+default -B memory=2G,vcpus=2 --no-start --disk NAME
$ gnt-instance modify -t drbd -n NODE NAME

Changing disk type from ide to virtio (vice-versa)
$ gnt-instance modify -H disk_type=ide,root_path=/dev/hda1 NAME
$ gnt-instance modify -H disk_type=paravirtual,root_path=/dev/vda1 NAME

Changing an instance’s MAC address
$ gnt-instance modify --net 0:mac=MAC_ADDRESS NAME