>>> 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
>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