Tuesday 9 December 2014

Ganeti Xen VM - Creating and Growing Disk

Installing a Ganeti VM

(1) root@node03 /srv/ganeti/os/centos
#  /usr/local/projects/deploy/ganeti/bin/mk-gnt-instance-hail.sh  -h fsxz.isys -m 4096 -c 2 -d 66 -o centos+5
Tue Dec  9 15:54:28 2014  - INFO: Selected nodes for instance fsxz.isys via iallocator hail: node05.gnt6.fog.priv, node04.gnt6.fog.priv
Tue Dec  9 15:54:30 2014 * creating instance disks...
Tue Dec  9 15:54:40 2014 adding instance fsxz.isys to cluster config
Tue Dec  9 15:54:42 2014 * checking mirrors status
Tue Dec  9 15:54:43 2014  - INFO: - device disk/0:  0.70% done, 18m 48s remaining (estimated)
Tue Dec  9 15:54:43 2014  - INFO: - device disk/1:  1.90% done, 1m 53s remaining (estimated)
Tue Dec  9 15:54:43 2014 * pausing disk sync to install instance OS
Tue Dec  9 15:54:44 2014 * running the instance OS create scripts...

Growing Disks

Growing a VM disk involves 2 stages:
Grow the block device
Resize the file system

Ganeti can grow the block device for you using the gnt-instance grow-disk command:

$ gnt-instance grow-disk test.mydomain.com 0 100G
The instance will not see the new disk size until it's rebooted.

# Reboot the instance $ sudo gnt-instance reboot test.mydomain.com Resize the file system After the VM is rebooted, log in to it (ssh) and resize the partion

sudo resize2fs /dev/xvdX
A Script to generate a MAC address from the IP address:
#!/bin/bash

echo -n 'Virtual MAC 02:00'
printf ':%02X' ${1//./ }
echo