No subject


Thu Oct 27 00:53:32 UTC 2011


modifies utilization of resource automatically=0A=0A---=0A heartbeat/Virtua=
lDomain |   49 +++++++++++++++++++++++++++++++++++++++++++++++=0A 1 files =
changed, 49 insertions(+), 0 deletions(-)=0A=0Adiff --git a/heartbeat/Virtu=
alDomain b/heartbeat/VirtualDomain=0Aindex 0786944..00916c0 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 domainU's vCPUs from virsh, 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@@ -133,6 +155,30 @@ Be sure to set the timeout of =
these operations to accommodate this delay.=0A EOF=0A }=0A =0A+set_util_att=
r() {=0A+    local attr=3D$1 val=3D$2=0A+    local cval outp=0A+=0A+    =
cval=3D$(crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g $attr 2>/dev/null)=
=0A+    if [ "$cval" !=3D "$val" ]; then=0A+       outp=3D`crm_resource -r =
$OCF_RESOURCE_INSTANCE -z -p $attr -v $val 2>&1` ||=0A+           ocf_log =
warn "crm_resource failed to set utilization attribute $attr: $outp"=0A+   =
 fi=0A+}=0A+=0A+update_utilization() {=0A+    local dom_cpu dom_mem=0A+=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+       test -n "$dom_cpu" && set_util_attr cpu =
$dom_cpu=0A+    fi=0A+    if ocf_is_true "$OCF_RESKEY_autoset_utilization_h=
v_memory"; then=0A+       dom_mem=3D$(LANG=3DC virsh $VIRSH_OPTIONS =
dominfo ${DOMAIN_NAME} | awk '/Max memory/{printf("%d", $3/1024)}')=0A+    =
   test -n "$dom_mem" && set_util_attr hv_memory "$dom_mem"=0A+    =
fi=0A+}=0A+=0A # Set options to be passed to virsh:=0A VIRSH_OPTIONS=3D"--c=
onnect=3D${OCF_RESKEY_hypervisor} --quiet"=0A =0A@@ -404,6 +450,9 @@ =
VirtualDomain_Monitor() {=0A 	    fi=0A 	done=0A     fi=0A+=0A+    =
update_utilization=0A+=0A     return ${rc}=0A }=0A =0A-- =0A1.6.4.2=0A=0A
--=__PartDFF051C3.0__=--


More information about the ha-wg-technical mailing list