diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
index a9ad2374e6..ce7779366a 100755
--- a/heartbeat/VirtualDomain
+++ b/heartbeat/VirtualDomain
@@ -169,6 +169,21 @@ Be sure to set the timeout of these operations to accommodate this delay.
+
+
+To additionally start services within the virtual domain, add this
+parameter with a list of scripts to start. Each executed script gets
+one argument with Domain Name, specified in the libvirt configuration
+file for this virtual domain.
+
+Note: when start scripts are used, the start operation will complete
+only when all start scripts have completed successfully.
+Be sure to set the timeout of these operations to accommodate this delay.
+
+space-separated list of start scripts
+
+
+
If set true, the agent will detect the number of domainU's vCPUs from virsh, and put it
@@ -463,6 +478,21 @@ VirtualDomain_start() {
return $OCF_SUCCESS
fi
+ # If we have start scripts defined, run them one after another.
+ for script in ${OCF_RESKEY_start_scripts}; do
+ script_output="$($script $DOMAIN_NAME 2>&1)"
+ script_rc=$?
+ if [ ${script_rc} -ne ${OCF_SUCCESS} ]; then
+ # A start script returned a non-success exit
+ # code. Stop iterating over the list of scripts, log a
+ # warning message, and propagate $OCF_ERR_GENERIC.
+ ocf_exit_reason "Start command \"${script}\" for domain ${DOMAIN_NAME} returned ${script_rc} with output: ${script_output}"
+ return $OCF_ERR_GENERIC
+ else
+ ocf_log info "Start command \"${script}\" for domain ${DOMAIN_NAME} completed successfully with output: ${script_output}"
+ fi
+ done
+
snapshotimage="$OCF_RESKEY_snapshot/${DOMAIN_NAME}.state"
if [ -n "$OCF_RESKEY_snapshot" -a -f "$snapshotimage" ]; then
virsh restore $snapshotimage
diff --git a/heartbeat/iscsi b/heartbeat/iscsi
index ef0236e471..81cd78eba3 100755
--- a/heartbeat/iscsi
+++ b/heartbeat/iscsi
@@ -268,14 +268,16 @@ open_iscsi_add() {
}
open_iscsi_get_session_id() {
local target="$1"
+ local portal="$2"
$iscsiadm -m session 2>/dev/null |
grep -E "$target($|[[:space:]])" |
+ grep -E "] $portal" |
awk '{print $2}' | tr -d '[]'
}
open_iscsi_remove() {
local target="$1"
local session_id
- session_id=`open_iscsi_get_session_id "$target"`
+ session_id=`open_iscsi_get_session_id "$target" "$OCF_RESKEY_portal"`
if [ "$session_id" ]; then
$iscsiadm -m session -r $session_id -u
else
@@ -296,7 +298,7 @@ open_iscsi_monitor() {
local recov
recov=${2:-$OCF_RESKEY_try_recovery}
- session_id=`open_iscsi_get_session_id "$target"`
+ session_id=`open_iscsi_get_session_id "$target" "$OCF_RESKEY_portal"`
prev_state=""
if [ -z "$session_id" ]; then
if $iscsiadm -m node -p $OCF_RESKEY_portal -T $target >/dev/null 2>&1; then