Skip to content

Instantly share code, notes, and snippets.

Last active July 6, 2018 10:16
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 \ 
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
Delete a VM :

gnt-instance remove

Enable own-kernel for VM :
gnt-instance modify --hypervisor-parameters=kernel_path=\
Change VM Parameters
gnt-instance modify --backend-parameters=vcpus=4
gnt-instance modify -B memory=4096M
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
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

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

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