Re: [Pacemaker] About the difference in handling of "sequential".

2014-02-18 Thread Kristoffer Grönlund
On Wed, 19 Feb 2014 11:57:29 +1100
Andrew Beekhof  wrote:

> It appears Yan did this on purpose.
> The reason would likely be that this set is for use in a location
> constraint (not ordering or colocation). And in particular, it is
> creating a fake set for resources using the same template - so there
> is no reason to think they should be ordered.
> 
> So: 
> 1. sequential should _always_ default to true
> 2. please report it to me if you find somewhere that does not
> 3. since template_to_set() is creating (copying) a fake set, there is
> no conflict with 1.

Thanks, that's exactly the information I needed. :)

-- 
// Kristoffer Grönlund
// kgronl...@suse.com


signature.asc
Description: PGP signature
___
Pacemaker mailing list: Pacemaker@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


Re: [Pacemaker] About the difference in handling of "sequential".

2014-02-18 Thread Andrew Beekhof

On 19 Feb 2014, at 10:48 am, Kristoffer Grönlund  wrote:

> Hi everyone,
> 
> On Mon, 17 Feb 2014 10:54:29 +0900 (JST)
> renayama19661...@ybb.ne.jp wrote:
> 
>> Hi Andrew,
>> 
>> I found your correction.
>> 
>> https://github.com/beekhof/pacemaker/commit/37ff51a0edba208e6240e812936717fffc941a41
>> 
>> Many Thanks!
>> Hideo Yamauchi.
>> 
>> --- On Wed, 2014/2/12, renayama19661...@ybb.ne.jp
>>  wrote:
>> 
>>> Hi All,
>>> 
>>> There is difference in two between handling of "sequential" of
>>> "resouce_set" of colocation.
>>> 
> 
> I suspect that sequential for resource sets is still broken. I have
> been trying to figure out what the expected value of sequential is if
> not explicitly set on a resource_set. It seems like the answer is "it
> depends".
> 
> In pengine/constraints.c, unpack_order_set, sequential defaults to true
> if not set, via the following logic:
> 
>/* line 1368 */
>const char *sequential_s = crm_element_value(set, "sequential");
>/* line 1384 */
>if (sequential_s == NULL) {
>sequential_s = "1";
>}
>sequential = crm_is_true(sequential_s);
> 
> However, in pengine/constraints.c(450), template_to_set, sequential
> defaults to false:
> 
>/* line 495 */
>/* Set sequential="false" for the resource_set */
>crm_xml_add(*rsc_set, "sequential", XML_BOOLEAN_FALSE);
> 
> Am I reading this wrong, or is this on purpose?

It appears Yan did this on purpose.
The reason would likely be that this set is for use in a location constraint 
(not ordering or colocation).
And in particular, it is creating a fake set for resources using the same 
template - so there is no reason to think they should be ordered.

So: 
1. sequential should _always_ default to true
2. please report it to me if you find somewhere that does not
3. since template_to_set() is creating (copying) a fake set, there is no 
conflict with 1.


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Pacemaker mailing list: Pacemaker@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


Re: [Pacemaker] About the difference in handling of "sequential".

2014-02-18 Thread Kristoffer Grönlund
Hi everyone,

On Mon, 17 Feb 2014 10:54:29 +0900 (JST)
renayama19661...@ybb.ne.jp wrote:

> Hi Andrew,
> 
> I found your correction.
> 
> https://github.com/beekhof/pacemaker/commit/37ff51a0edba208e6240e812936717fffc941a41
> 
> Many Thanks!
> Hideo Yamauchi.
> 
> --- On Wed, 2014/2/12, renayama19661...@ybb.ne.jp
>  wrote:
> 
> > Hi All,
> > 
> > There is difference in two between handling of "sequential" of
> > "resouce_set" of colocation.
> > 

I suspect that sequential for resource sets is still broken. I have
been trying to figure out what the expected value of sequential is if
not explicitly set on a resource_set. It seems like the answer is "it
depends".

In pengine/constraints.c, unpack_order_set, sequential defaults to true
if not set, via the following logic:

/* line 1368 */
const char *sequential_s = crm_element_value(set, "sequential");
/* line 1384 */
if (sequential_s == NULL) {
sequential_s = "1";
}
sequential = crm_is_true(sequential_s);

However, in pengine/constraints.c(450), template_to_set, sequential
defaults to false:

/* line 495 */
/* Set sequential="false" for the resource_set */
crm_xml_add(*rsc_set, "sequential", XML_BOOLEAN_FALSE);

Am I reading this wrong, or is this on purpose?

-- 
// Kristoffer Grönlund
// kgronl...@suse.com

___
Pacemaker mailing list: Pacemaker@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


Re: [Pacemaker] About the difference in handling of "sequential".

2014-02-16 Thread renayama19661014
Hi Andrew,

I found your correction.

https://github.com/beekhof/pacemaker/commit/37ff51a0edba208e6240e812936717fffc941a41

Many Thanks!
Hideo Yamauchi.

--- On Wed, 2014/2/12, renayama19661...@ybb.ne.jp  
wrote:

> Hi All,
> 
> There is difference in two between handling of "sequential" of "resouce_set" 
> of colocation.
> 
> Is either one not a mistake?
> 
> 
> static gboolean
> unpack_colocation_set(xmlNode * set, int score, pe_working_set_t * data_set)
> {
>     xmlNode *xml_rsc = NULL;
>     resource_t *with = NULL;
>     resource_t *resource = NULL;
>     const char *set_id = ID(set);
>     const char *role = crm_element_value(set, "role");
>     const char *sequential = crm_element_value(set, "sequential");
>     int local_score = score;
> 
>     const char *score_s = crm_element_value(set, XML_RULE_ATTR_SCORE);
> 
>     if (score_s) {
>         local_score = char2score(score_s);
>     }
> 
> /* When "sequential" is not set, "sequential" is treat as TRUE. */
> 
>     if (sequential != NULL && crm_is_true(sequential) == FALSE) {
>         return TRUE;
> (snip)
> static gboolean
> colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score,
>                   pe_working_set_t * data_set)
> {
>     xmlNode *xml_rsc = NULL;
>     resource_t *rsc_1 = NULL;
>     resource_t *rsc_2 = NULL;
> 
>     const char *role_1 = crm_element_value(set1, "role");
>     const char *role_2 = crm_element_value(set2, "role");
> 
>     const char *sequential_1 = crm_element_value(set1, "sequential");
>     const char *sequential_2 = crm_element_value(set2, "sequential");
> 
> /* When "sequential" is not set, "sequential" is treat as FALSE. */
> 
>     if (crm_is_true(sequential_1)) {
>         /* get the first one */
>         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = 
> __xml_next(xml_rsc)) {
>             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, 
> TRUE)) {
>                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
>                 break;
>             }
>         }
>     }
> 
>     if (crm_is_true(sequential_2)) {
>         /* get the last one */
> (snip)
> 
> 
> 
> Best Regards,
> Hideo Yamauchi.
> 
> 
> ___
> Pacemaker mailing list: Pacemaker@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@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