ln -sf /usr/share/ganeti/extstorage/zfs/bin/daily-block-snapshot /etc/cron.daily/
+5. install lvm wrapper scripts to report zfs volumes as lv
+
+ 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
# 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'
zfs where to create instance zfs volumes
create zfs create -V options
destroy gnt-instance remove also removes snapshots (set empty to disable)
+vg cluster lvm volume group
--- /dev/null
+#!/bin/sh
+
+. /usr/share/ganeti/extstorage/zfs/defaults.sh
+
+/sbin/lvm lvs $*
+
+# lvs --noheadings --units=m --nosuffix '--separator=|' -ovg_name,lv_name,lv_size,lv_attr
+if echo $* | -q grep vg_name,lv_name,lv_size,lv_attr ; then
+
+ zfs get volsize -t volume -r $EXPN_ZFS -H -p -o name,value | sed "s:$EXPN_ZFS::" | awk '{ print " '$EXPN_VG'|"$1"|" $2 / 1024 / 1024 "|-wi-ao--" }'
+
+fi
+
--- /dev/null
+#!/bin/sh
+
+. /usr/share/ganeti/extstorage/zfs/defaults.sh
+
+set -x
+
+/sbin/lvm vgs $*
+
+# gnt-node list-storage
+# vgs --noheadings --units=m --nosuffix --separator '|' --options vg_name,vg_size,vg_free
+if echo $* | grep -q vg_name,vg_size,vg_free ; then
+ zfs list -H -p -o used,available $EXTP_ZFS | awk '{ print " '$EXTP_VG'|" ( $1 + $2 ) / 1024 / 1024 "|" $2 / 1024 / 1024 }'
+
+# gnt-node list
+# vgs --noheadings --nosuffix --units=m --unbuffered '--separator=|' -ovg_name,vg_free,vg_attr,vg_size
+elif echo $* | grep -q vg_name,vg_free,vg_attr,vg_size ; then
+ zfs list -H -p -o available,used $EXTP_ZFS | awk '{ print " '$EXTP_VG'|" $1 / 1024 / 1024 "|wz--n-|" ( $1 + $2 ) / 1024 / 1024 }'
+
+fi