Mailing List Archive

答复: AutoSetting (was Re: Two git patchs for resource-agents)
>>> Florian Haas 11年07月11日 下午 19:58 >>>

>Hello,
>
>On 2011-07-11 13:01, John Shi wrote:
>> 2. Create a new agent: AutoSetting, it detects system parameters, such
>> as cpu, memory, and put them into
>> utilization of node, it runs on every node as clone resource. please
>> see fate 310115.
>> I implemented 3 ocf parameters:
>> - dynamic
>> - utilization_cpu
>> - utilization_memory
>
>The AutoSetting patch I am not so sure of, to be honest. As with
>VirtualDomain, I believe we could use a more generic solution here.
>
>Here's my suggestion: Think of a resource agent named, say "attribute",
>with the following configuration parameters:
>
>- name (required)
>- value (optional)
>- value_hook (optional)
>
>"name" would be the name of a transitional node attribute that the agent
>manages.
>
>"value" would be a static value assigned to the attribute (just for
>completeness' sake). For example, the agent might be cloned, and might
>set the attribute "foo" to "bar" on all nodes where a clone instance
>runs. You obviously realize that this is a contrived example, but it may
>be useful nonetheless.
>
>"value_hook" could call out to a script that is expected to output a
>value, which is then applied to the attribute. This script would be
>called during the recurring monitor operation, so the attribute is
>continuously updated with current values.
>
>The agent would set the attribute on resource (instance) start, and
>remove it on resource (instance) stop.
>
>Just in case the idea of calling out to an arbitrary script from a
>resource agent makes you cringe: it's also conceivable that this
>"agent" would merely be a collection of functions that a real agent,
>potentially with a hard-coded value_hook, can source.
>
>Your thoughts on this would be much appreciated.
>
>Cheers,
>Florian





Hello,

Thanks a lot for Florian's suggestion.
Agreed, I try to design a new model according Florian's suggestion,
and hope we can discuss it further.

------------------------------------------------

The resource agent named "NodeUtilization", means that this agent is only
setting utilization of node, and "node" means including all of nodes,
so it's also a clone resource.

------------------------------------------------

How to implement "name" "value" model, I think we could have 3 ways:

1. One resource, one setting. Means only a pair of name and value can be
set through a resource instance. If you want to set many names, you have to
create many resource.

Example:

OCF_RESKEY_name=cpu OCF_RESKEY_value=8 ./NodeUtilization start


2. Make a script to agent, the agent can parse this script and set those names.

Example:

OCF_RESKEY_cfg='
cpu=8
memory=8192
myparm=abc
' ./NodeUtilization start


3. The agent detects how many parameters were given by users.

Example:
OCF_RESKEY_name0=cpu OCF_RESKEY_value0=8 \
OCF_RESKEY_name1=memory OCF_RESKEY_value1=8192 \
OCF_RESKEY_name2=myparm OCF_RESKEY_value2=abc [...] ./NodeUtilization start

------------------------------------------------

"value" would be a static value or value_hook, we can simulate the syntax of shell: ret=`command`.

Example:

The value is a static value, "/path/to/hook_file" is just a string:
OCF_RESKEY_name=myparm OCF_RESKEY_value=/path/to/hook_file ./NodeUtilization start


The value is surrounded by a pair of '%', it talks to the agent, hey, this is not a normal string, you
should execute this hook file, and get the stdout of execution, that is a value:
OCF_RESKEY_name=myparm OCF_RESKEY_value=%/path/to/hook_file% ./NodeUtilization start

------------------------------------------------

Any suggestions? Thanks!


Cheers,
John Shi
Re: 答复: AutoSetting (was Re: Two git patchs for resource-agents) [ In reply to ]
On 2011-07-12T04:24:13, John Shi <jshi@novell.com> wrote:

> The resource agent named "NodeUtilization", means that this agent is only
> setting utilization of node, and "node" means including all of nodes,
> so it's also a clone resource.

"NodeUtilization" is a good name, though I still would consider merging
it into SysInfo or SystemHealth. Just food for thought.

> How to implement "name" "value" model, I think we could have 3 ways:
>
> 1. One resource, one setting. Means only a pair of name and value can be
> set through a resource instance. If you want to set many names, you have to
> create many resource.

No, this doesn't work at all. That makes the configuration way too
complex. Consider that it must work easily for the 80%+ use cases; which
are: set memory, set CPU capacities.

None of these alternatives work.

Static setting of the values obviously doesn't work either ;-) The idea
is that these are auto-set.

And if we want to add future params in the future, that's fine - we
should just start with always populating cpu/memory (possibly with a few
tunables (cpu_algorithm, memory_reserve) to define _how_ these are
computed, but that's it).


> "value" would be a static value or value_hook, we can simulate the syntax of shell: ret=`command`.

> The value is surrounded by a pair of '%', it talks to the agent, hey, this is not a normal string, you
> should execute this hook file, and get the stdout of execution, that is a value:
> OCF_RESKEY_name=myparm OCF_RESKEY_value=%/path/to/hook_file% ./NodeUtilization start

Most definitely not. A hook would reference a function in the library -
say, drop all hooks into /var/lib/foo/bar/.../hooks/ - and call the file
from there.

But I would like to reiterate that we don't need that. It's, for once, a
case of premature flexibility. We should always set CPU and memory,
because that's what matters to VMs today. We can add flexibility cleanly
later.


If a hook is to be called - which _we do not need_
for the 80%+ functionality that we want to achieve here - it will be an
explicit file reference, not tagged with



Regards,
Lars

--
Architect Storage/HA, OPS Engineering, Novell, Inc.
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

_______________________________________________
ha-wg-technical mailing list
ha-wg-technical@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/ha-wg-technical