rewrote documentation to provide easier steps
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 25 Jun 2014 13:34:04 +0000 (15:34 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 25 Jun 2014 13:34:04 +0000 (15:34 +0200)
20 files changed:
README
bin/backup [new file with mode: 0755]
bin/daily-block-snapshot [deleted file]
bin/ill [new file with mode: 0755]
bin/node [new file with mode: 0755]
bin/snap [new file with mode: 0755]
bin/snapshots [deleted file]
cron/daily-block-snapshot [new file with mode: 0755]
cron/purge-log [new file with mode: 0755]
defaults.sh [changed from file to symlink]
etc/defaults.sh [new file with mode: 0644]
install/1-enable-ext-template.sh [new file with mode: 0644]
install/2-create-log-directory.sh [new file with mode: 0644]
install/3-lvm-wrappers.sh [new file with mode: 0755]
t/5-install-lvm-swapper.sh [deleted file]
t/drbd.sh [new file with mode: 0755]
t/gnt-backup-export.sh [new file with mode: 0755]
t/gnt-instance-modify.sh [new file with mode: 0755]
t/plain.sh [new file with mode: 0755]
t/zfs.sh [new file with mode: 0755]

diff --git a/README b/README
index 0d1789f..03e41c8 100644 (file)
--- a/README
+++ b/README
@@ -4,76 +4,41 @@ http://docs.ganeti.org/ganeti/master/html/man-ganeti-extstorage-interface.html
 
 INSTALLATION
 
-On node which has zfs storage pool
+On node which will host zfs storage pool
 
   cd /usr/share/ganeti/extstorage/
   git clone https://github.com/ffzg/ganeti-extstorage-zfs zfs
   cd zfs
   vi defaults.sh
 
-You need to specify zfs filesystem under which block devices will be created.
+Run install scripts:
 
-Now ssh into ganeti master node and do following:
+# ls install/
+1-enable-ext-template.sh  2-create-log-directory.sh  3-lvm-wrappers.sh
 
-1. enable new disk template
+Cron helper can be install under /etc/cron.daily
 
-  gnt-cluster modify --enabled-disk-templates plain,drbd,ext \
-       --ipolicy-disk-templates plain,drbd,ext
+# ls cron/
+daily-block-snapshot  purge-log
 
-2. create log directory
+Overview commands are available (try running them to see output):
 
-  mkdir /var/log/ganeti/extstorage
+# ls bin/
+ill  list  node  size  snap
 
-3. try instance creation with something similar to
+Create test instances:
 
-  gnt-instance add -t ext --disk=0:size=10G,provider=zfs \
-       --net 0:mode=bridged,link=br1001 \
-       --net 1:mode=bridged,link=br0060 \
-       --net 2:mode=bridged,link=br0080 \
-       --no-name-check --no-ip-check \
-       -o debootstrap+default \
-       -B maxmem=1G -n arh-hw zfs
+# ls t/*.sh
+t/drbd.sh  t/plain.sh  t/zfs.sh
 
-4. install helper scripts for daily block snapshots
+Review that instaces have been created:
 
-  ln -sf /usr/share/ganeti/extstorage/zfs/bin/daily-block-snapshot /etc/cron.daily/
+# ./bin/ill t-
 
-5. install lvm wrapper scripts to report zfs volumes as lv
+Test ganeti commands after reading them:
 
-  find /usr/share/ganeti/extstorage/zfs/sbin/ -type f | xargs -i ln -v -s -f {} /sbin/
-
-This scripts enable gnt-node commands to work:
-
-root@vmh02:/home/dpavlin# gnt-node list arh-hw
-Node               DTotal DFree MTotal MNode MFree Pinst Sinst
-arh-hw.gnt.ffzg.hr  87.8G 87.2G   7.8G  252M  5.6G     1     0
-
-root@vmh02:/home/dpavlin# gnt-node list-storage arh-hw
-Node               Type   Name     Size  Used   Free Allocatable
-arh-hw.gnt.ffzg.hr lvm-vg arh-hw 190.0G 62.7G 127.3G Y
-arh-hw.gnt.ffzg.hr lvm-vg ffzgvg  87.8G  610M  87.2G Y
-
-
-HELPER SCRIPTS
-
-Helper scripts in bin directory list volumes, show size or snapshots.
-
-
-arh-hw:/usr/share/ganeti/extstorage/zfs# ./bin/list 
-NAME                                                           USED  AVAIL  REFER  MOUNTPOINT
-tmp500g/block                                                  612M  87.2G    30K  /tmp500g/block
-tmp500g/block/af1a90e8-0566-4cbf-bc8c-99fc82b67ce3.ext.disk0   612M  87.2G   610M  -
-
-
-arh-hw:/usr/share/ganeti/extstorage/zfs# ./bin/size 
-NAME                                                          PROPERTY  VALUE    SOURCE
-tmp500g/block/af1a90e8-0566-4cbf-bc8c-99fc82b67ce3.ext.disk0  volsize   11G      local
-
-
-arh-hw:/usr/share/ganeti/extstorage/zfs# ./bin/snapshots 
-NAME                                                                      USED  AVAIL  REFER  MOUNTPOINT
-tmp500g/block@etckeeper                                                      0      -    30K  -
-tmp500g/block/af1a90e8-0566-4cbf-bc8c-99fc82b67ce3.ext.disk0@2014-06-24  2.64M      -   610M  -
+# ls t/gnt-*
+t/gnt-backup-export.sh  t/gnt-instance-modify.sh
 
 
 DRBD disk replication
@@ -90,5 +55,5 @@ KNOWN BUGS for extstorage
 
 KNOWN BUGS for using -t plain on top of zfs
 
-- bin/daily-block-snapshot snapshots are not correctly renamed
+- cron/daily-block-snapshot snapshots are not correctly renamed
 
diff --git a/bin/backup b/bin/backup
new file mode 100755 (executable)
index 0000000..f3894b5
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+ssh `gnt-cluster getmaster` \
+gnt-backup $*
diff --git a/bin/daily-block-snapshot b/bin/daily-block-snapshot
deleted file mode 100755 (executable)
index 50aa8de..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-. /usr/share/ganeti/extstorage/zfs/defaults.sh
-
-zfs list -r -o name -t volume -H $EXTP_ZFS | xargs -i zfs snap {}@`date +%Y-%m-%d`
diff --git a/bin/ill b/bin/ill
new file mode 100755 (executable)
index 0000000..5bb34b7
--- /dev/null
+++ b/bin/ill
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+ssh `gnt-cluster getmaster` \
+gnt-instance list -o name,status,oper_vcpus,oper_ram,disk_usage,pnode,snodes | grep "$*"
diff --git a/bin/node b/bin/node
new file mode 100755 (executable)
index 0000000..09a9d3a
--- /dev/null
+++ b/bin/node
@@ -0,0 +1,2 @@
+ssh `gnt-cluster getmaster` gnt-node list `hostname -s`
+ssh `gnt-cluster getmaster` gnt-node list-storage `hostname -s`
diff --git a/bin/snap b/bin/snap
new file mode 100755 (executable)
index 0000000..3cd9eeb
--- /dev/null
+++ b/bin/snap
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. /usr/share/ganeti/extstorage/zfs/defaults.sh
+
+zfs list -t snapshot -r $EXTP_ZFS -o name,logicalused,used,available,refer
diff --git a/bin/snapshots b/bin/snapshots
deleted file mode 100755 (executable)
index 3cd9eeb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-. /usr/share/ganeti/extstorage/zfs/defaults.sh
-
-zfs list -t snapshot -r $EXTP_ZFS -o name,logicalused,used,available,refer
diff --git a/cron/daily-block-snapshot b/cron/daily-block-snapshot
new file mode 100755 (executable)
index 0000000..50aa8de
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. /usr/share/ganeti/extstorage/zfs/defaults.sh
+
+zfs list -r -o name -t volume -H $EXTP_ZFS | xargs -i zfs snap {}@`date +%Y-%m-%d`
diff --git a/cron/purge-log b/cron/purge-log
new file mode 100755 (executable)
index 0000000..1f9c42d
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rm /var/log/ganeti/extstorage/*
deleted file mode 100644 (file)
index 7d8ab66af545d94afc6bed6361d7c59001df73c1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# debugging options
-#set -x
-#set >&2
-
-# zfs pool and file system (existing) where to create block devices
-test -z "$EXTP_ZFS" && EXTP_ZFS=tmp500g/block
-
-# parameters for zfs create, by default
-# -s   sparse
-# -b 4k        block size sutable for ext4 filesystem which ganeti uses
-# lz4  compression with low cpu operhead which always helps
-test -z "$EXTP_CREATE" && EXTP_CREATE="-s -b 4k -o compression=lz4"
-
-# on zfs destroy remove snapshots of instance disks
-test -z "$EXTP_DESTROY" && EXTP_DESTROY="-r"
-
-# emulate VG configured in cluster for wrapper scripts in sbin
-test -z "$EXTP_VG" && EXTP_VG='ffzgvg'
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..3479877e21641355f4d7f838dfc7bdd4b7dde802
--- /dev/null
@@ -0,0 +1 @@
+etc/defaults.sh
\ No newline at end of file
diff --git a/etc/defaults.sh b/etc/defaults.sh
new file mode 100644 (file)
index 0000000..7d8ab66
--- /dev/null
@@ -0,0 +1,18 @@
+# debugging options
+#set -x
+#set >&2
+
+# zfs pool and file system (existing) where to create block devices
+test -z "$EXTP_ZFS" && EXTP_ZFS=tmp500g/block
+
+# parameters for zfs create, by default
+# -s   sparse
+# -b 4k        block size sutable for ext4 filesystem which ganeti uses
+# lz4  compression with low cpu operhead which always helps
+test -z "$EXTP_CREATE" && EXTP_CREATE="-s -b 4k -o compression=lz4"
+
+# on zfs destroy remove snapshots of instance disks
+test -z "$EXTP_DESTROY" && EXTP_DESTROY="-r"
+
+# emulate VG configured in cluster for wrapper scripts in sbin
+test -z "$EXTP_VG" && EXTP_VG='ffzgvg'
diff --git a/install/1-enable-ext-template.sh b/install/1-enable-ext-template.sh
new file mode 100644 (file)
index 0000000..5e84123
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh -x
+
+gnt-cluster modify \
+       --enabled-disk-templates plain,drbd,ext \
+       --ipolicy-disk-templates plain,drbd,ext
diff --git a/install/2-create-log-directory.sh b/install/2-create-log-directory.sh
new file mode 100644 (file)
index 0000000..392ae94
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh -x
+
+mkdir /var/log/ganeti/extstorage
diff --git a/install/3-lvm-wrappers.sh b/install/3-lvm-wrappers.sh
new file mode 100755 (executable)
index 0000000..a6915b8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh -xe
+
+find /usr/share/ganeti/extstorage/zfs/sbin/ -type f | xargs -i ln -v -s -f {} /sbin/
+
diff --git a/t/5-install-lvm-swapper.sh b/t/5-install-lvm-swapper.sh
deleted file mode 100755 (executable)
index 95db7de..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -xe
-
-find /usr/share/ganeti/extstorage/zfs/sbin/ -type f | xargs -i ln -v -s -f {} /sbin/
-
-pvs --noheadings --nosuffix --units=m --unbuffered '--separator=|' -opv_name,vg_name,pv_free,pv_attr,pv_size,pv_name
diff --git a/t/drbd.sh b/t/drbd.sh
new file mode 100755 (executable)
index 0000000..9288668
--- /dev/null
+++ b/t/drbd.sh
@@ -0,0 +1,7 @@
+ssh `gnt-cluster getmaster` \
+  gnt-instance add -t drbd --disk=0:size=10G \
+       -o debootstrap+default \
+       --no-name-check --no-ip-check \
+       -B maxmem=1G -n arh-hw:box02 t-drbd
+
+
diff --git a/t/gnt-backup-export.sh b/t/gnt-backup-export.sh
new file mode 100755 (executable)
index 0000000..b432c85
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh -xe
+
+./bin/ill t- | awk '{ print $1 }' | xargs -i ssh `gnt-cluster getmaster` gnt-backup export -n arh-hw {}
+./bin/backup list -n arh-hw | grep t-
+
diff --git a/t/gnt-instance-modify.sh b/t/gnt-instance-modify.sh
new file mode 100755 (executable)
index 0000000..0de04c2
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh -xe
+
+gnt-instance stop t-plain
+gnt-instance modify -t drbd -n box02 t-plain
+gnt-instance rename --no-ip-check --no-name-check t-plain t-plain-drbd
+gnt-instance failover t-plain-drbd
+gnt-instance modify -t plain t-plain-drbd
+gnt-instance rename --no-ip-check --no-name-check t-plain-drbd t-plain-remote
+gnt-instance start t-plain-remote
diff --git a/t/plain.sh b/t/plain.sh
new file mode 100755 (executable)
index 0000000..5f005fd
--- /dev/null
@@ -0,0 +1,7 @@
+ssh `gnt-cluster getmaster` \
+  gnt-instance add -t plain --disk=0:size=10G \
+       -o debootstrap+default \
+       --no-name-check --no-ip-check \
+       -B maxmem=1G -n arh-hw t-plain
+
+
diff --git a/t/zfs.sh b/t/zfs.sh
new file mode 100755 (executable)
index 0000000..e1fc405
--- /dev/null
+++ b/t/zfs.sh
@@ -0,0 +1,7 @@
+ssh `gnt-cluster getmaster` \
+  gnt-instance add -t ext --disk=0:size=10G,provider=zfs \
+       -o debootstrap+default \
+       --no-name-check --no-ip-check \
+       -B maxmem=1G -n arh-hw t-zfs
+
+