# HG changeset patch
# User Dag Stenstad <[email protected]>
# Date 1272674974 -7200
# Node ID 0cc47d6fac9755c537ee12eff7e4143ec048940b
# Parent  71d4971f6ba844825a7b81cc536124a97d352d5c
Low: RA: VirtualDomain: Add support for specifying parent domain for migration 
uri.

diff -r 71d4971f6ba8 -r 0cc47d6fac97 heartbeat/VirtualDomain
--- a/heartbeat/VirtualDomain   Wed Apr 21 13:16:38 2010 +0900
+++ b/heartbeat/VirtualDomain   Sat May 01 02:49:34 2010 +0200
@@ -83,6 +83,17 @@ use libvirt's default transport to conne
 use libvirt's default transport to connect to the remote hypervisor.
 </longdesc>
 <shortdesc lang="en">Remote hypervisor transport</shortdesc>
+<content type="string" default="" />
+</parameter>
+
+<parameter name="parent_domain" unique="0" required="0">
+<longdesc lang="en">
+Parent domain of the hostname of the destination node. Will
+be appended to the migration string. Should be used if
+migration_transport is set to "ssl", and certificates are
+made out to the FQDN of the node.
+</longdesc>
+<shortdesc lang="en">Remote node parent domain</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -277,6 +288,7 @@ VirtualDomain_Migrate_To() {
     local target_node
     local remoteuri
     local transport_suffix
+    local target_parent_domain
 
     target_node="$OCF_RESKEY_CRM_meta_migrate_target"
 
@@ -286,9 +298,12 @@ VirtualDomain_Migrate_To() {
         # "qemu+tcp://bar:9999/system"
        if [ -n "${OCF_RESKEY_migration_transport}" ]; then
            transport_suffix="+${OCF_RESKEY_migration_transport}"
-       fi
+    fi
+    if [ -n "${OCF_RESKEY_parent_domain}" ]; then
+        target_parent_domain=".${OCF_RESKEY_parent_domain}"
+    fi
         # Scared of that sed expression? So am I. :-)
-       remoteuri=$(echo ${OCF_RESKEY_hypervisor} | sed -e 
"s,\(.*\)://[^/:]*\(:\?[0-9]*\)/\(.*\),\1${transport_suffix}://${target_node}\2/\3,")
+       remoteuri=$(echo ${OCF_RESKEY_hypervisor} | sed -e 
"s,\(.*\)://[^/:]*\(:\?[0-9]*\)/\(.*\),\1${transport_suffix}://${target_node}${target_parent_domain}\2/\3,")
 
        # OK, we know where to connect to. Now do the actual migration.
        ocf_log info "$DOMAIN_NAME: Starting live migration to ${target_node} 
(using remote hypervisor URI ${remoteuri})."
@@ -394,7 +409,7 @@ fi
 
 # Define the domain on startup, and re-define whenever someone deleted
 # the state file, or touched the config.
-if [ ! -e $STATEFILE ] || [ $OCF_RESKEY_config -nt $STATEFILE ]; then
+if [ ! -s $STATEFILE ] || [ $OCF_RESKEY_config -nt $STATEFILE ]; then
     VirtualDomain_Define 
 fi
 # By now, we should definitely be able to read from the state file.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to