script may return stdout from command, need to add another # to seperate it

This commit is contained in:
anthony 2011-02-02 16:27:22 -08:00
parent a46155e895
commit b9e32cceb9
4 changed files with 22 additions and 23 deletions

View File

@ -3855,12 +3855,11 @@ public abstract class CitrixResourceBase implements ServerResource {
boolean found = false;
for (PBD pbd : pbds) {
if (host.equals(pbd.getHost(conn))) {
PBD.Record pbdr = pbd.getRecord(conn);
PBD.Record pbdr = pbd.getRecord(conn);
if (host.equals(pbdr.host)) {
if (!pbdr.currentlyAttached) {
pbdPlug(conn, pbd, pbdr.uuid);
}
pbds.remove(pbd);
found = true;
break;
}

View File

@ -242,11 +242,11 @@ public class XenServer56Resource extends CitrixResourceBase {
}
String result = callHostPluginThroughMaster(conn, "vmopspremium", "setup_heartbeat_sr", "host", _host.uuid,
"sr", srUuid);
if (result == null || !result.split("#")[0].equals("0")) {
if (result == null || !result.split("#")[1].equals("0")) {
throw new CloudRuntimeException("Unable to setup heartbeat sr on SR " + srUuid + " due to " + result);
}
result = callHostPluginPremium(conn, "setup_heartbeat_file", "host", _host.uuid, "sr", srUuid);
if (result == null || !result.split("#")[0].equals("0")) {
if (result == null || !result.split("#")[1].equals("0")) {
throw new CloudRuntimeException("Unable to setup heartbeat file entry on SR " + srUuid + " due to "
+ result);
}

View File

@ -10,28 +10,28 @@ usage() {
if [ -z $1 ]; then
usage
echo "1# no uuid of host"
echo "#1# no uuid of host"
exit 0
fi
if [ -z $2 ]; then
usage
echo "2# no uuid of sr"
echo "#2# no uuid of sr"
exit 0
fi
if [ `xe host-list | grep $1 | wc -l` -ne 1 ]; then
echo "3# Unable to find the host uuid: $1"
echo "#3# Unable to find the host uuid: $1"
exit 0
fi
if [ `xe sr-list uuid=$2 | wc -l` -eq 0 ]; then
echo "4# Unable to find SR with uuid: $2"
echo "#4# Unable to find SR with uuid: $2"
exit 0
fi
if [ `xe pbd-list sr-uuid=$2 | grep -B 1 $1 | wc -l` -eq 0 ]; then
echo "5# Unable to find a pbd for the SR: $2"
echo "#5# Unable to find a pbd for the SR: $2"
exit 0
fi
@ -42,7 +42,7 @@ if [ "$srtype" = "nfs" ];then
dir=/var/run/sr-mount/$2
filename=$dir/hb-$1
if [ ! -f "$filename" ]; then
echo "6# heartbeat file $filename doesn't exist"
echo "#6# heartbeat file $filename doesn't exist"
exit 0
fi
else
@ -50,7 +50,7 @@ else
link=$dir/hb-$1
lvchange -ay $link
if [ $? -ne 0 ]; then
echo "7# Unable to make the heartbeat $link active"
echo "#7# Unable to make the heartbeat $link active"
exit 0
fi
fi
@ -67,6 +67,6 @@ else
echo $dir >> $hbfile
fi
echo "0#DONE"
echo "#0#DONE"
exit 0

View File

@ -9,28 +9,28 @@ usage() {
if [ -z $1 ]; then
usage
echo "1#no host uuid"
echo "#1#no host uuid"
exit 0
fi
if [ -z $2 ]; then
usage
echo "2#no sr uuid"
echo "#2#no sr uuid"
exit 0
fi
if [ `xe host-list | grep $1 | wc -l` -ne 1 ]; then
echo "3# Unable to find the host uuid: $1"
echo "#3# Unable to find the host uuid: $1"
exit 0
fi
if [ `xe sr-list uuid=$2 | wc -l` -eq 0 ]; then
echo "4# Unable to find SR with uuid: $2"
echo "#4# Unable to find SR with uuid: $2"
exit 0
fi
if [ `xe pbd-list sr-uuid=$2 | grep -B 1 $1 | wc -l` -eq 0 ]; then
echo "5# Unable to find a pbd for the SR: $2"
echo "#5# Unable to find a pbd for the SR: $2"
exit 0
fi
@ -58,12 +58,12 @@ else
fi
lvcreate VG_XenStorage-$2 -n hb-$1 --size 4M
if [ $? -ne 0 ]; then
echo "6# Unable to create heartbeat volume hb-$1"
echo "#6# Unable to create heartbeat volume hb-$1"
exit 0
fi
lv=`lvscan | grep $link`
if [ -z "$lv" ]; then
echo "7# volume hb-$1 is not created"
echo "#7# volume hb-$1 is not created"
exit 0
fi
fi
@ -71,18 +71,18 @@ else
if [ `echo $lv | awk '{print $1}'` == "inactive" ]; then
lvchange -ay $link
if [ $? -ne 0 ]; then
echo "8# Unable to make $link active"
echo "#8# Unable to make $link active"
exit 0
fi
fi
if [ ! -L $link ]; then
echo "9# Unable to find the soft link $link"
echo "#9# Unable to find the soft link $link"
exit 0
fi
dd if=/dev/zero of=$link bs=1 count=100
fi
echo "0#DONE"
echo "#0#DONE"
exit 0