[Pacemaker] again "return code", now in crm_attribute

Andrey Groshev greenx at yandex.ru
Fri Jan 10 07:18:45 UTC 2014



10.01.2014, 10:15, "Andrew Beekhof" <andrew at beekhof.net>:
> On 10 Jan 2014, at 4:38 pm, Andrey Groshev <greenx at yandex.ru> wrote:
>
>>  10.01.2014, 09:06, "Andrew Beekhof" <andrew at beekhof.net>:
>>>  On 10 Jan 2014, at 3:51 pm, Andrey Groshev <greenx at yandex.ru> wrote:
>>>>   10.01.2014, 03:28, "Andrew Beekhof" <andrew at beekhof.net>:
>>>>>   On 9 Jan 2014, at 4:44 pm, Andrey Groshev <greenx at yandex.ru> wrote:
>>>>>>    09.01.2014, 02:39, "Andrew Beekhof" <andrew at beekhof.net>:
>>>>>>>     On 18 Dec 2013, at 11:55 pm, Andrey Groshev <greenx at yandex.ru> wrote:
>>>>>>>>      Hi, Andrew and ALL.
>>>>>>>>
>>>>>>>>      I'm sorry, but I again found an error. :)
>>>>>>>>      Crux of the problem:
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled --query; echo $?
>>>>>>>>      scope=crm_config  name=stonith-enabled value=true
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled --update firstval ; echo $?
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled --query; echo $?
>>>>>>>>      scope=crm_config  name=stonith-enabled value=firstval
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled  --update secondval --lifetime=reboot ; echo $?
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled --query; echo $?
>>>>>>>>      scope=crm_config  name=stonith-enabled value=firstval
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled  --update thirdval --lifetime=forever ; echo $?
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      # crm_attribute --type crm_config --attr-name stonith-enabled --query; echo $?
>>>>>>>>      scope=crm_config  name=stonith-enabled value=firstval
>>>>>>>>      0
>>>>>>>>
>>>>>>>>      Ie if specify the lifetime of an attribute, then a attribure is not updated.
>>>>>>>>
>>>>>>>>      If impossible setup the lifetime of the attribute when it is installing, it must be return an error.
>>>>>>>     Agreed. I'll reproduce and get back to you.
>>>>>>    How, I was able to review code, problem comes when used both options "--type" and options "--lifetime".
>>>>>>    One variant in "case" without break;
>>>>>>    Unfortunately, I did not have time to dive into the logic.
>>>>>   Actually, the logic is correct.  The command:
>>>>>
>>>>>   # crm_attribute --type crm_config --attr-name stonith-enabled  --update secondval --lifetime=reboot ; echo $?
>>>>>
>>>>>   is invalid.  You only get to specify --type OR --lifetime, not both.
>>>>>   By specifying --lifetime, you're creating a node attribute, not a cluster proprerty.
>>>>   With this, I do not argue. I think that should be the exit code is NOT ZERO, ie it's error!
>>>  No, its setting a value, just not where you thought (or where you're looking for it in the next command).
>>>
>>>  Its the same as writing:
>>>
>>>    crm_attribute --type crm_config --type status --attr-name stonith-enabled  --update secondval; echo $?
>>>
>>>  Only the last value for --type wins
>>  Because of this confusion is obtained. Here is an example of the old cluster:
>>  #crm_attribute --type crm_config --attr-name test1  --update val1 --lifetime=reboot ; echo $?
>>  0
>>  # cibadmin -Q|grep test1
>>           <nvpair id="status-test-ins-db2-test1" name="test1" value="val1"/>
>>  Win "--lifetime" ?
>
> Yes.  Because it was specified last.
>
>>  Is not it easier to produce an error when trying to use incompatible options?
>
> They're not incompatible. They're aliases for each other in a different context.

Ok. I understood you . Let's say you're right . :)
In the end , if you change the order of words in the human language, then meaning of a sentence can change. 
But suppose, I have a strange desire, but it may be represented and write.

I say "crm_attribute - attr-name attr1 - update val1 - lifetime = reboot - type crm_config".

I mean, that ...
 "I want to set some attribute to a cluster , and this attribute should disappear if the cluster is restarted. "

If I сhange the order of arguments, the meaning of a sentence is still not change.
But what do you say to that? 100% chance you will say that the sentence is not correct. Why ? Because the "lifetime" is not quite a time of life and can not be used in the context of the properties of the cluster ? Ie You gave me back " 1" and crm_attribute returned "0" :)

>
>>  Then there is this uncertainty and "was meant...", "was meant...", "was meant...".
>>>>>>>>      And if possible then the value should be established.
>>>>>>>>      In general, something is wrong.
>>>>>>>>      Denser unfortunately not yet looked, because I struggle with "STONITH" :)
>>>>>>>>
>>>>>>>>      P.S. Andrew! Late to congratulate you on your new addition to the family.
>>>>>>>>      This fine time - now you will have toys which was not in your childhood.
>>>>>>>>
>>>>>>>>      _______________________________________________
>>>>>>>>      Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>>>>>>      http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>>>>>
>>>>>>>>      Project Home: http://www.clusterlabs.org
>>>>>>>>      Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>>>>>      Bugs: http://bugs.clusterlabs.org
>>>>>>>     ,
>>>>>>>     _______________________________________________
>>>>>>>     Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>>>>>     http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>>>>
>>>>>>>     Project Home: http://www.clusterlabs.org
>>>>>>>     Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>>>>     Bugs: http://bugs.clusterlabs.org
>>>>>>    _______________________________________________
>>>>>>    Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>>>>    http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>>>
>>>>>>    Project Home: http://www.clusterlabs.org
>>>>>>    Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>>>    Bugs: http://bugs.clusterlabs.org
>>>>>   ,
>>>>>   _______________________________________________
>>>>>   Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>>>   http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>>
>>>>>   Project Home: http://www.clusterlabs.org
>>>>>   Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>>   Bugs: http://bugs.clusterlabs.org
>>>>   _______________________________________________
>>>>   Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>>   http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>
>>>>   Project Home: http://www.clusterlabs.org
>>>>   Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>   Bugs: http://bugs.clusterlabs.org
>>>  ,
>>>  _______________________________________________
>>>  Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>>  http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>
>>>  Project Home: http://www.clusterlabs.org
>>>  Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>  Bugs: http://bugs.clusterlabs.org
>>  _______________________________________________
>>  Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>>  http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>
>>  Project Home: http://www.clusterlabs.org
>>  Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>  Bugs: http://bugs.clusterlabs.org
>
> ,
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list