Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Manage a Ganeti Cluster
Add a VM in plain disk:
gnt-instance add plain --disk 0:size=20G --disk 1:size=200M \
-B memory=2G,vcpus=2 -o debootstrap+jessie --no-ip-check \ 
--no-name-check vm.domain.com
Add a VM in DRBD (fully-sharred between two servers) :
gnt-instance add drbd --disk 0:size=20G --disk 1:size=200M \
-B memory=2G,vcpus=2 -o debootstrap+jessie --no-ip-check \
--no-name-check -n server1.server2 vm.domain.com
Delete a VM :

gnt-instance remove vm.domain.com

Enable own-kernel for VM :
gnt-instance modify --hypervisor-parameters=kernel_path=\
/usr/lib/grub-xen/grub-x86_64-xen.bin vm.domain.com
Change VM Parameters
gnt-instance modify --backend-parameters=vcpus=4 vm.domain.com
gnt-instance modify -B memory=4096M vm.domain.com
Extend a VM's disk
gnt-instance grow-disk <vm> <disk-number> <size-to-grow>
gnt-instance reboot <vm>
# Run this on the VM :
fdisk /dev/xvda (in my case)
p # List and note starting partition number
d # Delete the partition
n # New partition with same number and starting number
w # Write
reboot
pvresize /dev/xvda1
lvextend -L+<size-in-giga> /dev/vg<vm>/<lv-to-extend>
resize2fs /dev/vg<vm>/<lv-to-extend>
Migrate a Drbd VM without shutdown :

gnt-instance migrate vm.domain.com

Add a node to the Cluster

gnt-node add server2

Migrate all VM from a node (DRBD)

gnt-node failover server2

Migrate the secondary disk to another node (DRBD)

gnt-instance replace-disks -n server3 vm.domain.com

Mark a node offline

gnt-node modify -C no -O yes server2

Check Cluster's health

gnt-cluster verify gnt-cluster verify-disks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.