Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: HA-WG-Technical
Re: Two git patchs for resource-agents
 

Index | Next | Previous | View Flat


dejan at suse

Nov 8, 2011, 9:07 AM


Views: 2230
Permalink
Re: Two git patchs for resource-agents [In reply to]

Hi John,

On Tue, Nov 01, 2011 at 04:46:04AM -0600, John Shi wrote:
>
> Hi Dejan,
> I think we can close these two issues, if we want to improve, or someone has good idea,
> we can open a new issue.
>
> Regards,
> John

I'll quote here the VirtualDomain part:

> From 7fffa2d22efb1610a4ca2424b6bc9455f1f5cce8 Mon Sep 17 00:00:00 2001
> From: John Shi <jshi [at] suse>
> Date: Fri, 28 Oct 2011 21:56:51 +0800
> Subject: [PATCH] Low: VirtualDomain: Add a functionality that modifies utilization of resource automatically.
>
> ---
> heartbeat/VirtualDomain | 67 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 67 insertions(+), 0 deletions(-)
>
> diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
> index 0786944..d9321d9 100755
> --- a/heartbeat/VirtualDomain
> +++ b/heartbeat/VirtualDomain
> @@ -19,9 +19,15 @@
> # Defaults
> OCF_RESKEY_force_stop_default=0
> OCF_RESKEY_hypervisor_default="$(virsh --quiet uri)"
> +OCF_RESKEY_dynamic_utilization_default="true"
> +OCF_RESKEY_set_utilization_cpu_default="true"
> +OCF_RESKEY_set_utilization_memory_default="true"
>
> : ${OCF_RESKEY_force_stop=${OCF_RESKEY_force_stop_default}}
> : ${OCF_RESKEY_hypervisor=${OCF_RESKEY_hypervisor_default}}
> +: ${OCF_RESKEY_dynamic_utilization=${OCF_RESKEY_dynamic_utilization_default}}
> +: ${OCF_RESKEY_set_utilization_cpu=${OCF_RESKEY_set_utilization_cpu_default}}
> +: ${OCF_RESKEY_set_utilization_memory=${OCF_RESKEY_set_utilization_memory_default}}
> #######################################################################
>
> ## I'd very much suggest to make this RA use bash,
> @@ -117,6 +123,28 @@ Be sure to set the timeout of these operations to accommodate this delay.
> <content type="string" default="" />
> </parameter>
>
> +<parameter name="dynamic_utilization" unique="0" required="0">
> +<longdesc lang="en">
> +If set, the utilization parameter of resource will be reset if there are
> +difference between resource parameters and system parameters when agent monitor.
> +Otherwise, the resource parameters will be set once when agent start.

This doesn't match the code. A probe is not equal start.
Though I guess that you already discussed that, what happens if
on probe prerequisites are not started (e.g. storage)? Shouldn't
this really be in start when the chance that other dependencies
are satisfied.

The description is not precise. "resource parameters will be
set" should probably read "utilization parameters ...". Also,
"will be reset" doesn't explain well what is going to happen.

> +</longdesc>
> +<shortdesc lang="en">Set utilization of resource when agent monitor</shortdesc>

So, "modify utilization on monitor" actually happens if
dynamic_utilization is set to false. Why is setting utilization
on start only "dynamic", but setting it on every monitor isn't?

> +<content type="boolean" default="true" />
> +</parameter>
> +
> +<parameter name="set_utilization_cpu" unique="0" required="0">
> +<longdesc lang="en">Enable setting cpu of utilization.</longdesc>
> +<shortdesc lang="en">Enable setting cpu of utilization</shortdesc>
> +<content type="boolean" default="true" />
> +</parameter>
> +
> +<parameter name="set_utilization_memory" unique="0" required="0">
> +<longdesc lang="en">Enable setting memory of utilization.</longdesc>
> +<shortdesc lang="en">Enable setting memory of utilization</shortdesc>
> +<content type="boolean" default="true" />
> +</parameter>
> +
> </parameters>

These two parameters are useful only when dynamic_utilization is
set to false. You should also mention which particular
attributes are set ("cpu" and "hv_memory"). And to what value.

> <actions>
> @@ -133,6 +161,33 @@ Be sure to set the timeout of these operations to accommodate this delay.
> EOF
> }
>
> +set_utilization() {
> + local dom_cpu dom_mem
> + local uti_cpu uti_mem
> +
> + read dom_cpu dom_mem <<EOF
> +$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} |
> +awk '/CPU\(s\)/{cpu=$2} /Max memory/{mem=$3} END{printf("%d %d\n", cpu, mem/1024)}')
> +EOF
> + uti_cpu=$(crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g cpu 2>/dev/null)
> + uti_mem=$(crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g hv_memory 2>/dev/null)
> +
> + if [ "$OCF_RESKEY_set_utilization_cpu" = "true" -o "$OCF_RESKEY_set_utilization_cpu" = "1" ]; then

Please use ocf_is_true. Ditto for similar stuff below.

> + if [ "$dom_cpu" != "$uti_cpu" ]; then
> + if ! crm_resource -r $OCF_RESOURCE_INSTANCE -z -p cpu -v $dom_cpu; then
> + ocf_log warn "Failed to set cpu of utilization by crm_resource."
> + fi
> + fi
> + fi
> + if [ "$OCF_RESKEY_set_utilization_memory" = "true" -o "$OCF_RESKEY_set_utilization_memory" = "1" ]; then
> + if [ "$dom_mem" != "$uti_mem" ]; then
> + if ! crm_resource -r $OCF_RESOURCE_INSTANCE -z -p hv_memory -v $dom_mem; then
> + ocf_log warn "Failed to set hv_memory of utilization by crm_resource."
> + fi
> + fi
> + fi
> +}
> +
> # Set options to be passed to virsh:
> VIRSH_OPTIONS="--connect=${OCF_RESKEY_hypervisor} --quiet"
>
> @@ -236,6 +291,11 @@ VirtualDomain_Start() {
> while ! VirtualDomain_Monitor; do
> sleep 1
> done
> +
> + if [ "$OCF_RESKEY_dynamic_utilization" = "false" -o "$OCF_RESKEY_dynamic_utilization" = "0" ]; then
> + set_utilization
> + fi
> +
> return $OCF_SUCCESS
> }
>
> @@ -404,6 +464,13 @@ VirtualDomain_Monitor() {
> fi
> done
> fi
> +
> + if [ "$OCF_RESKEY_dynamic_utilization" = "true" -o "$OCF_RESKEY_dynamic_utilization" = "1" ]; then
> + if ocf_is_probe; then
> + set_utilization
> + fi
> + fi
> +
> return ${rc}
> }

Cheers,

Dejan
_______________________________________________
ha-wg-technical mailing list
ha-wg-technical [at] lists
https://lists.linuxfoundation.org/mailman/listinfo/ha-wg-technical

Subject User Time
Two git patchs for resource-agents jshi at novell Jul 11, 2011, 4:01 AM
    Re: Two git patchs for resource-agents lmb at suse Jul 12, 2011, 4:51 AM
        Re: Two git patchs for resource-agents andrew at beekhof Jul 12, 2011, 10:00 PM
    Re: Two git patchs for resource-agents xwhu at novell Jul 13, 2011, 3:09 AM
    Re: Two git patchs for resource-agents lmb at suse Jul 13, 2011, 3:16 AM
    Re: Two git patchs for resource-agents lmb at suse Jul 13, 2011, 5:37 AM
    Re: Two git patchs for resource-agents jshi at novell Jul 13, 2011, 9:56 PM
    Re: Two git patchs for resource-agents lmb at suse Jul 22, 2011, 4:38 AM
    Re: Two git patchs for resource-agents jshi at novell Aug 12, 2011, 11:56 AM
    Re: Two git patchs for resource-agents jshi at novell Aug 17, 2011, 11:20 PM
    Re: Two git patchs for resource-agents dejan at suse Aug 19, 2011, 5:18 AM
        Re: Two git patchs for resource-agents jshi at suse Oct 28, 2011, 7:21 AM
    Re: Two git patchs for resource-agents dejan at suse Oct 28, 2011, 7:39 AM
        Re: Two git patchs for resource-agents jshi at suse Nov 1, 2011, 3:46 AM
    Re: Two git patchs for resource-agents dejan at suse Nov 6, 2011, 2:09 PM
    Re: Two git patchs for resource-agents dejan at suse Nov 8, 2011, 9:07 AM
    Re: Two git patchs for resource-agents jshi at suse Nov 11, 2011, 5:00 AM
    Re: Two git patchs for resource-agents dejan at suse Nov 15, 2011, 7:04 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.