No subject


Thu Oct 27 00:53:32 UTC 2011


modifies utilization of resource automatically.=0A=0A---=0A heartbeat/Virtu=
alDomain |   48 +++++++++++++++++++++++++++++++++++++++++++++++=0A 1 files =
changed, 48 insertions(+), 0 deletions(-)=0A=0Adiff --git a/heartbeat/Virtu=
alDomain b/heartbeat/VirtualDomain=0Aindex 0786944..bba0d54 100755=0A--- =
a/heartbeat/VirtualDomain=0A+++ b/heartbeat/VirtualDomain=0A@@ -19,9 =
+19,13 @@=0A # Defaults=0A OCF_RESKEY_force_stop_default=3D0=0A OCF_RESKEY_=
hypervisor_default=3D"$(virsh --quiet uri)"=0A+OCF_RESKEY_autoset_utilizati=
on_cpu_default=3D"true"=0A+OCF_RESKEY_autoset_utilization_hv_memory_default=
=3D"true"=0A =0A : ${OCF_RESKEY_force_stop=3D${OCF_RESKEY_force_stop_defaul=
t}}=0A : ${OCF_RESKEY_hypervisor=3D${OCF_RESKEY_hypervisor_default}}=0A+: =
${OCF_RESKEY_autoset_utilization_cpu=3D${OCF_RESKEY_autoset_utilization_cpu=
_default}}=0A+: ${OCF_RESKEY_autoset_utilization_hv_memory=3D${OCF_RESKEY_a=
utoset_utilization_hv_memory_default}}=0A #################################=
######################################=0A =0A ## I'd very much suggest to =
make this RA use bash,=0A@@ -117,6 +121,24 @@ Be sure to set the timeout =
of these operations to accommodate this delay.=0A <content type=3D"string" =
default=3D"" />=0A </parameter>=0A =0A+<parameter name=3D"autoset_utilizati=
on_cpu" unique=3D"0" required=3D"0">=0A+<longdesc lang=3D"en">=0A+If set =
true, the agent will detect the number of cpu cores from OS, and put it =
=0A+into the cpu utilization of the resource when the monitor is =
executed.=0A+</longdesc>=0A+<shortdesc lang=3D"en">Enable auto setting the =
cpu utilization of the resource</shortdesc>=0A+<content type=3D"boolean" =
default=3D"true" />=0A+</parameter>=0A+=0A+<parameter name=3D"autoset_utili=
zation_hv_memory" unique=3D"0" required=3D"0">=0A+<longdesc lang=3D"en">=0A=
+If set true, the agent will detect the number of *Max memory* from virsh, =
and put it =0A+into the hv_memory utilization of the resource when the =
monitor is executed.=0A+</longdesc>=0A+<shortdesc lang=3D"en">Enable auto =
setting the hv_memory utilization of the resource</shortdesc>=0A+<content =
type=3D"boolean" default=3D"true" />=0A+</parameter>=0A+=0A </parameters>=
=0A =0A <actions>=0A@@ -382,6 +404,9 @@ VirtualDomain_Migrate_From() {=0A =
}=0A =0A VirtualDomain_Monitor() {=0A+    local dom_cpu dom_mem=0A+    =
local uti_cpu uti_mem=0A+=0A     # First, check the domain status. If that =
returns anything other=0A     # than $OCF_SUCCESS, something is definitely =
wrong.=0A     VirtualDomain_Status=0A@@ -404,6 +429,29 @@ VirtualDomain_Mon=
itor() {=0A 	    fi=0A 	done=0A     fi=0A+=0A+    if ocf_is_probe; =
then=0A+        if ocf_is_true "$OCF_RESKEY_autoset_utilization_cpu"; =
then=0A+            dom_cpu=3D$(LANG=3DC virsh $VIRSH_OPTIONS dominfo =
${DOMAIN_NAME} | awk '/CPU\(s\)/{print $2}')=0A+            uti_cpu=3D$(crm=
_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g cpu 2>/dev/null)=0A+          =
  if [ "$dom_cpu" !=3D "$uti_cpu" ]; then=0A+                if ! =
crm_resource -r $OCF_RESOURCE_INSTANCE -z -p cpu -v $dom_cpu >/dev/null =
2>&1; then=0A+                    ocf_log warn "Failed to set cpu of =
utilization by crm_resource."=0A+                fi=0A+            fi=0A+  =
      fi=0A+=0A+        if ocf_is_true "$OCF_RESKEY_autoset_utilization_hv_=
memory"; then=0A+            dom_mem=3D$(LANG=3DC virsh $VIRSH_OPTIONS =
dominfo ${DOMAIN_NAME} | awk '/Max memory/{print $3/1024)}')=0A+           =
 uti_mem=3D$(crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g hv_memory =
2>/dev/null)=0A+            if [ "$dom_mem" !=3D "$uti_mem" ]; then=0A+    =
            if ! crm_resource -r $OCF_RESOURCE_INSTANCE -z -p hv_memory -v =
$dom_mem >/dev/null 2>&1; then=0A+                    ocf_log warn "Failed =
to set hv_memory of utilization by crm_resource."=0A+                =
fi=0A+            fi=0A+        fi=0A+    fi=0A+=0A     return ${rc}=0A =
}=0A =0A-- =0A1.6.4.2=0A=0A
--=__PartFDD272CF.0__=--


More information about the ha-wg-technical mailing list