From mboxrd@z Thu Jan 1 00:00:00 1970 From: lhh@sourceware.org Date: 16 Oct 2006 20:59:53 -0000 Subject: [Cluster-devel] cluster/rgmanager/src/resources xenvm.sh Message-ID: <20061016205953.23594.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: lhh at sourceware.org 2006-10-16 20:59:53 Modified files: rgmanager/src/resources: xenvm.sh Log message: Updated xenvm resource agent Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/xenvm.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4 --- cluster/rgmanager/src/resources/xenvm.sh 2006/07/19 18:43:32 1.3 +++ cluster/rgmanager/src/resources/xenvm.sh 2006/10/16 20:59:53 1.4 @@ -102,9 +102,9 @@ - + - Root disk for the Xen VM (as presented to the VM) + Boot loader that can start the Xen VM from physical image Boot loader that can start the Xen VM from physical image @@ -112,6 +112,18 @@ + + + Path specification 'xm create' will search for the specified + VM configuration file + + + Path to Xen configuration files + + + + + root disk for the Xen VM. (physical, on the host) @@ -168,7 +180,7 @@ - + @@ -196,28 +208,6 @@ } -# -# Find a list of possible IP addresses to try. -# -xen_host_ips() -{ - declare xen_ips=$(ip -f inet -o addr list | grep 'xen-br[0-9]\+[^:]' | awk '{print $4}') - declare tmp1="" - declare i - - for i in $xen_ips; do - i=${i/\/*/} - if [ -z "$tmp1" ]; then - tmp1="$i" - else - tmp1="$i,$tmp1" - fi - done - - echo $tmp1 -} - - build_xen_cmdline() { # @@ -228,7 +218,6 @@ declare cmdline="restart=\"never\"" declare varp val temp - # # Transliterate the OCF_RESKEY_* to something the xm # command can recognize. @@ -261,12 +250,21 @@ ;; rootdisk_virtual) ;; + name) # Do nothing with name; add it later + ;; + path) + cmdline="$cmdline --path=\"$val\"" + ;; *) cmdline="$cmdline $varp=\"$val\"" ;; esac done + if [ -n "$OCF_RESKEY_name" ]; then + cmdline="$OCF_RESKEY_name $cmdline" + fi + echo $cmdline } @@ -282,13 +280,9 @@ # declare cmdline - if [ -f "/etc/xen/xmdefconfig" ]; then - cmdline="`build_xen_cmdline`" - else - cmdline="`build_xen_cmdline` /dev/null" - fi + cmdline="`build_xen_cmdline`" - echo $cmdline + echo "# Xen Command Line: $cmdline" eval xm create $cmdline return $? @@ -301,7 +295,7 @@ # stop() { - declare -i timeout=120 + declare -i timeout=60 declare -i ret=1 declare st @@ -309,7 +303,7 @@ echo xm $op $OCF_RESKEY_name ... xm $op $OCF_RESKEY_name - timeout=120 + timeout=60 while [ $timeout -gt 0 ]; do sleep 5 ((timeout -= 5)) @@ -362,45 +356,11 @@ verify_all() { declare errors=0 - declare tmp1, tmp2 - - if [ -z "$OCF_RESKEY_kernel" ]; then - echo "Required parameter OCF_RESKEY_kernel is not present" - ((errors++)) - elif ! [ -f "$OCF_RESKEY_kernel" ]; then - echo "$OCF_RESKEY_kernel (OCF_RESKEY_kernel) is not valid" - ((errors++)) - fi - - tmp1=`echo $OCF_RESKEY_swapdisk | cut -f1 -d,` - tmp2=`echo $OCF_RESKEY_swapdisk | cut -f2 -d,` - - if [ -z "$tmp2" ]; then - echo "Swapdisk option malformed" - ((errors++)) - fi - - if ! [ -b "$tmp1" ]; then - echo "Specified swapdisk device $tmp1 is not a block device" - ((errors++)) - fi - if [ -z "$OCF_RESKEY_rootdisk" ]; then - echo "Required parameter OCF_RESKEY_rootdisk is not present" + if [ -n "$OCF_RESKEY_bootloader" ] && \ + ! [ -x "$OCF_RESKEY_bootloader" ]; then + echo "$OCF_RESKEY_bootloader is not executable" ((errors++)) - else - tmp1=`echo $OCF_RESKEY_rootdisk | cut -f1 -d,` - tmp2=`echo $OCF_RESKEY_rootdisk | cut -f2 -d,` - - if [ -z "$tmp2" ]; then - echo "Rootdisk option malformed" - ((errors++)) - fi - - if ! [ -b "$tmp1" ]; then - echo "Specified rootdisk device $tmp1 is not a block device" - ((errors++)) - fi fi }