| space, → | next slide |
| ← | previous slide |
| d | debug mode |
| ## <ret> | go to slide # |
| c | table of contents (vi) |
| f | toggle footer |
| r | reload slides |
| z | toggle help (this) |



ganeti-noded |
control hardware resources, runs on all |
ganeti-confd
| |
ganeti-rapi
| |
ganeti-masterd |
allows control of cluster, runs on master |

hvparams)beparams)nicparams)

| /dev/sda1 | /boot | 200M |
| /dev/sda2 | / | 10-20G |
| /dev/sda3 | LVM | rest, named ganeti |
hostname --fqdn requires resolver library
$ apt-get install drbd8-utils
$ echo drbd minor_count=255 usermode_helper=/bin/true >> /etc/modules
$ depmod -a
$ modprobe drbd minor_count=255 usermode_helper=/bin/true
# Kernel Commands
drbd.minor_count=255 drbd.usermode_helper=/bin/true

allow-hotplug eth0
allow-hotplug eth1
allow-hotplug vlan100
allow-hotplug vlan42
auto vlan100
iface vlan100 inet manual
vlan_raw_device eth0
auto vlan42
iface vlan42 inet manual
vlan_raw_device eth0
allow-hotplug br42
allow-hotplug br10
auto br42
iface br42 inet static
address 10.1.0.140
netmask 255.255.254.0
network 10.1.0.0
broadcast 10.1.1.255
gateway 10.1.0.1
dns-nameservers 10.1.0.130
dns-search example.org
bridge_ports vlan42
bridge_stp off
bridge_fd 0
auto br100
iface br100 inet manual
bridge_ports vlan100
bridge_stp off
bridge_fd 0
iface eth1 inet static
address 192.168.16.140
netmask 255.255.255.0
network 192.168.16.0
broadcast 192.168.16.255
$ pvcreate /dev/sda3
$ vgcreate ganeti /dev/sda3
filter = ["r|/dev/cdrom|", "r|/dev/drbd[0-9]+|" ]
$ apt-get install lvm2 ssh bridge-utils \
iproute iputils-arping ndisc6 python \
python-pyopenssl openssl \
python-pyparsing python-simplejson \
python-pyinotify python-pycurl socat
$ apt-get install ghc6 libghc6-json-dev \
libghc6-network-dev \
libghc6-parallel-dev libghc6-curl-dev
$ ./configure --localstatedir=/var \
--sysconfdir=/etc \
--enable-htools
$ make
$ make install
/usr/local/$ cp doc/examples/ganeti.initd /etc/init.d/ganeti
$ update-rc.d ganeti defaults 20 80
ganeti-watcher$ cp doc/examples/ganeti.cron /etc/cron.d/ganeti
/usr/local/sbin or /usr/sbinlib/ganeti/tools directorylib/ganeti/tools directory$ apt-get install dump qemu-kvm kpartx
$ ./configure --prefix=/usr \
--localstatedir=/var \
--sysconfdir=/etc \
--with-os-dir=/srv/ganeti/os
$ make
$ make install
IMAGE_DIRganeti-prod.example.org$ gnt-cluster init \
--master-netdev=br42 \
--vg-name ganeti \
--secondary-ip 192.168.16.140 \
--enabled-hypervisors=kvm \
--nic-parameters link=br100 \
--backend-parameters \
vcpus=2,memory=512M \
--hypervisor-parameters \
kvm:kernel_path=/boot/guest/vmlinuz \
vnc_bind_address=0.0.0.0 \
ganeti-prod.example.org
--master-netdev=br42
--vg-name ganeti
--secondary-ip 192.168.16.140
--enabled-hypervisors=kvm
--nic-parameters link=br100
--backend-parameters vcpus=2,memory=512M
--hypervisor-parameters \
kvm:kernel_path=/boot/guest/vmlinuz-guest, \
vnc_bind_address=0.0.0.0 \
ganeti-prod.example.org
$ gnt-node list
Node DTotal DFree MTotal MNode MFree Pinst Sinst
node1.example.org 223.4G 223.4G 7.8G 300M 7.5G 0 0
node2.example.org 223.4G 223.4G 7.8G 300M 7.5G 0 0
$ /usr/lib/ganeti/tools/burnin -o image -p instance{1..5}
gnt-os list)$ gnt-instance add \
-n TARGET_NODE:SECONDARY_NODE \
-o OS_TYPE \
-t DISK_TEMPLATE -s DISK_SIZE \
INSTANCE_NAME
-B memory=1GB)-B vcpus=4)--nic 0:link=br100)batch-creategnt-instance manpage for others$ gnt-instance remove INSTANCE_NAME
$ gnt-instance startup INSTANCE_NAME
$ gnt-instance shutdown INSTANCE_NAME
$ gnt-instance list
Instance Hypervisor OS Primary_node Status Memory
instance1.example.org kvm image+gentoo-hardened node1.example.org ERROR_down -
instance2.example.org kvm image+centos node2.example.org running 512M
instance3.example.org kvm image+debian-squeeze node1.example.org running 512M
instance4.example.org kvm image+ubuntu-lucid node2.example.org running 512M
$ gnt-instance info instance2
Instance name: instance2.example.org
UUID: 5b5b1c35-23de-45bf-b125-a9a001b2bebb
Serial number: 22
Creation time: 2011-05-24 23:05:44
Modification time: 2011-06-15 21:39:12
State: configured to be up, actual state is up
Nodes:
- primary: node2.example.org
- secondaries:
Operating system: image+centos
Allocated network port: 11013
Hypervisor: kvm
- console connection: vnc to node2.example.org:11013 (display 5113)
- acpi: True
...
Hardware:
- VCPUs: 2
- memory: 512MiB
- NICs:
- nic/0: MAC: aa:00:00:39:4b:b5, IP: None, mode: bridged, link: br113
Disk template: plain
Disks:
- disk/0: lvm, size 9.8G
access mode: rw
logical_id: ganeti/0c3f6913-cc3d-4132-bbbf-af9766a7cde3.disk0
on primary: /dev/ganeti/0c3f6913-cc3d-4132-bbbf-af9766a7cde3.disk0 (252:3)
$ gnt-backup export -n TARGET_NODE INSTANCE_NAME
$ gnt-backup import \
-n TARGET_NODE \
--src-node=NODE \
--src-dir=DIR INSTANCE_NAME
$ gnt-instance add -t plain -n HOME_NODE ... \
--disk 0:adopt=lv_name[,vg=vg_name] \
INSTANCE_NAME
$ gnt-instance console INSTANCE_NAME
^] when done, to exit.$ gnt-instance failover INSTANCE_NAME
$ gnt-instance migrate INSTANCE_NAME
$ # re-create disks on the primary node
gnt-instance replace-disks -p INSTANCE_NAME
$ # re-create disks on the current secondary
gnt-instance replace-disks -s INSTANCE_NAME
$ # change the secondary node, via manual
$ # specification
gnt-instance replace-disks -n NODE INSTANCE_NAME
$ # change the secondary node, via an iallocator
$ # script
gnt-instance replace-disks -I SCRIPT INSTANCE_NAME
$ # automatically fix the primary or secondary node
gnt-instance replace-disks -a INSTANCE_NAME
$ # start with a non-redundant instance
gnt-instance add -t plain ... INSTANCE
$ # later convert it to redundant
gnt-instance stop INSTANCE
gnt-instance modify -t drbd \
-n NEW_SECONDARY INSTANCE
gnt-instance start INSTANCE
$ # and convert it back
gnt-instance stop INSTANCE
gnt-instance modify -t plain INSTANCE
gnt-instance start INSTANCE
$ gnt-node add NEW_NODE
-s REPLICATION_IP parameter$ gnt-node add --readd EXISTING_NODE
-s parameter not required$ gnt-cluster master-failover
$ gnt-node migrate NODE
$ gnt-node evacuate NODE
$ gnt-node remove NODE_NAME
$ gnt-job list
17771 success INSTANCE_QUERY_DATA
17773 success CLUSTER_VERIFY_DISKS
17775 success CLUSTER_REPAIR_DISK_SIZES
17776 error CLUSTER_RENAME(cluster.example.com)
17780 success CLUSTER_REDIST_CONF
17792 success INSTANCE_REBOOT(instance1.example.com)
$ gnt-job info 17776
Job ID: 17776
Status: error
Received: 2009-10-25 23:18:02.180569
Processing start: 2009-10-25 23:18:02.200335 (delta 0.019766s)
Processing end: 2009-10-25 23:18:02.279743 (delta 0.079408s)
Total processing time: 0.099174 seconds
Opcodes:
OP_CLUSTER_RENAME
Status: error
Processing start: 2009-10-25 23:18:02.200335
Processing end: 2009-10-25 23:18:02.252282
Input fields:
name: cluster.example.com
Result:
OpPrereqError
[Neither the name nor the IP address of the cluster has changed]
Execution log:
$ gnt-instance add --submit … instance1
JobID: 17818
$ gnt-job watch 17818
Output from job 17818 follows
-----------------------------
Mon Oct 26 2009 - INFO: Selected nodes for instance instance1 via iallocator dumb: node1, node2
Mon Oct 26 2009 * creating instance disks...
Mon Oct 26 2009 adding instance instance1 to cluster config
Mon Oct 26 2009 - INFO: Waiting for instance instance1 to sync disks.
…
Mon Oct 26 2009 creating os for instance instance1 on node node1
Mon Oct 26 2009 * running the instance OS create scripts...
Mon Oct 26 2009 * starting instance...
hbal : Cluster rebalancerhail : IAllocator scripthspace : Cluster capacity estimatorhbal$ hbal -m ganeti.example.org
Loaded 4 nodes, 63 instances
Initial check done: 0 bad nodes, 0 bad instances.
Initial score: 0.53388595
Trying to minimize the CV...
1. bonsai g1:g2 => g2:g1 0.53220090 a=f
2. connectopensource g3:g1 => g1:g3 0.53114943 a=f
3. amahi g2:g3 => g3:g2 0.53088116 a=f
4. mertan g1:g2 => g2:g1 0.53031862 a=f
5. dspace g3:g1 => g1:g3 0.52958328 a=f
Cluster score improved from 0.53388595 to 0.52958328
Solution length=5
hbal$ hbal -C -m ganeti.example.org
Loaded 4 nodes, 71 instances
Initial check done: 0 bad nodes, 0 bad instances.
Initial score: 2.10591985
Trying to minimize the CV...
1. linuxfund g4:g3 => g4:g2 2.09981699 a=r:g2
Cluster score improved from 2.10591985 to 2.09981699
Solution length=1
Commands to run to reach the above solution:
echo jobset 1, 1 jobs
echo job 1/1
gnt-instance replace-disks -n g2 linuxfund
hspace$ hspace --memory 512 --disk 10240 \
$ -m ganeti.example.org
HTS_INI_INST_CNT=63
HTS_FIN_INST_CNT=101
HTS_ALLOC_INSTANCES=38
HTS_ALLOC_FAIL_REASON=FAILDISK
hail$ gnt-instance add -t drbd -I hail \
$ -s 10G -o image+ubuntu-maverick \
$ --net 0:link=br42 instance1.example.org \
- INFO: Selected nodes for instance instance1.example.org
via iallocator hail: node1.example.org, node2.example.org
* creating instance disks...
adding instance instance1.example.org to cluster config
- INFO: Waiting for instance instance1.example.org to sync disks.
- INFO: - device disk/0: 3.60% done, 1149 estimated seconds remaining
- INFO: - device disk/0: 29.70% done, 144 estimated seconds remaining
- INFO: - device disk/0: 55.50% done, 88 estimated seconds remaining
- INFO: - device disk/0: 81.10% done, 47 estimated seconds remaining
- INFO: Instance instance1.example.org's disks are in sync.
* running the instance OS create scripts...
* starting instance...


$ fab dev deploy
$ fab prod deploy

$ twistd --pidfile=cache.pid gwm_cache












| Lance Albertson | Peter Krenesky |
| lance@osuosl.org | peter@osuosl.org |
| @ramereth | @kreneskyp |
| http://www.lancealbertson.com | http://blogs.osuosl.org/kreneskyp/ |
Presentation made with showoff
http://github.com/ramereth/presentation-ganeti-tutorial