Mailing List Archive

crmsh fails to stop already stopped resource
Hi,

Following fails with the current crmsh (e4b10ee).
# crm resource stop cl-http-lv
# crm resource stop cl-http-lv
ERROR: crm_diff apparently failed to produce the diff (rc=0)
ERROR: Failed to commit updates to cl-http-lv
# echo $?
1


Best,
Vladislav
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Vladislav Bogdanov <bubble@hoster-ok.com> writes:

> Hi,
>
> Following fails with the current crmsh (e4b10ee).
> # crm resource stop cl-http-lv
> # crm resource stop cl-http-lv
> ERROR: crm_diff apparently failed to produce the diff (rc=0)
> ERROR: Failed to commit updates to cl-http-lv
> # echo $?
> 1
>

Hi,

What would you expect to see when stopping an already stopped resource?

Cheers,
Kristoffer

>
> Best,
> Vladislav
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Hi Kristoffer,

13.02.2015 17:20, Kristoffer Grönlund wrote:
> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>
>> Hi,
>>
>> Following fails with the current crmsh (e4b10ee).
>> # crm resource stop cl-http-lv
>> # crm resource stop cl-http-lv
>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>> ERROR: Failed to commit updates to cl-http-lv
>> # echo $?
>> 1
>>
>
> Hi,
>
> What would you expect to see when stopping an already stopped resource?

I'd expect crmsh to behave similar to
crm_resource --resource cl-http-lv --set-parameter target-role --meta --parameter-value Stopped

At least it should not exit with failure ret code.

Best,
Vladislav

>
> Cheers,
> Kristoffer
>
>>
>> Best,
>> Vladislav
>> _______________________________________________
>> Linux-HA mailing list
>> Linux-HA@lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>> See also: http://linux-ha.org/ReportingProblems
>>
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Vladislav Bogdanov <bubble@hoster-ok.com> writes:

> Hi Kristoffer,
>
> 13.02.2015 17:20, Kristoffer Grönlund wrote:
>> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>>
>>> Hi,
>>>
>>> Following fails with the current crmsh (e4b10ee).
>>> # crm resource stop cl-http-lv
>>> # crm resource stop cl-http-lv
>>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>>> ERROR: Failed to commit updates to cl-http-lv
>>> # echo $?
>>> 1
>>>
>>
>> Hi,
>>
>> What would you expect to see when stopping an already stopped resource?
>
> I'd expect crmsh to behave similar to
> crm_resource --resource cl-http-lv --set-parameter target-role --meta --parameter-value Stopped
>
> At least it should not exit with failure ret code.

Yeah, I see what you mean. I have fixed this upstream now.

Thanks!

// Kristoffer


>
> Best,
> Vladislav
>
>>
>> Cheers,
>> Kristoffer
>>
>>>
>>> Best,
>>> Vladislav
>>> _______________________________________________
>>> Linux-HA mailing list
>>> Linux-HA@lists.linux-ha.org
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>>> See also: http://linux-ha.org/ReportingProblems
>>>
>>
>
>

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
13.02.2015 18:04, Kristoffer Grönlund wrote:
> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>
>> Hi Kristoffer,
>>
>> 13.02.2015 17:20, Kristoffer Grönlund wrote:
>>> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>>>
>>>> Hi,
>>>>
>>>> Following fails with the current crmsh (e4b10ee).
>>>> # crm resource stop cl-http-lv
>>>> # crm resource stop cl-http-lv
>>>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>>>> ERROR: Failed to commit updates to cl-http-lv
>>>> # echo $?
>>>> 1
>>>>
>>>
>>> Hi,
>>>
>>> What would you expect to see when stopping an already stopped resource?
>>
>> I'd expect crmsh to behave similar to
>> crm_resource --resource cl-http-lv --set-parameter target-role --meta --parameter-value Stopped
>>
>> At least it should not exit with failure ret code.
>
> Yeah, I see what you mean. I have fixed this upstream now.

Thanks Kristoffer!

>
> Thanks!
>
> // Kristoffer
>
>
>>
>> Best,
>> Vladislav
>>
>>>
>>> Cheers,
>>> Kristoffer
>>>
>>>>
>>>> Best,
>>>> Vladislav
>>>> _______________________________________________
>>>> Linux-HA mailing list
>>>> Linux-HA@lists.linux-ha.org
>>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>>>> See also: http://linux-ha.org/ReportingProblems
>>>>
>>>
>>
>>
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Hi Kristoffer,

may be it is worth to silently (or at least with rc=0) allow deletion of
non-existing or already-deleted configuration statements?

Background for that is that I keep track of the all configuration
statements myself, and, when I delete some resources (together with
accompanying constraints), they may go "out-of-order" to 'crm configure
delete', thus some constraints are automatically deleted when deleting
"lower" resource before the "upper" one. That leads to the whole crm
script to fail.

Best,
Vladislav

13.02.2015 17:03, Vladislav Bogdanov wrote:
> Hi,
>
> Following fails with the current crmsh (e4b10ee).
> # crm resource stop cl-http-lv
> # crm resource stop cl-http-lv
> ERROR: crm_diff apparently failed to produce the diff (rc=0)
> ERROR: Failed to commit updates to cl-http-lv
> # echo $?
> 1
>
>
> Best,
> Vladislav
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Vladislav Bogdanov <bubble@hoster-ok.com> writes:

> Hi Kristoffer,
>
> may be it is worth to silently (or at least with rc=0) allow deletion of
> non-existing or already-deleted configuration statements?
>
> Background for that is that I keep track of the all configuration
> statements myself, and, when I delete some resources (together with
> accompanying constraints), they may go "out-of-order" to 'crm configure
> delete', thus some constraints are automatically deleted when deleting
> "lower" resource before the "upper" one. That leads to the whole crm
> script to fail.

Hmm, I am not sure about doing this by default, since we would want to
show some kind of indication that a resource name may have been
misspelled for example... But I can imagine having a command line flag
for being more flexible in this regard.

I will look at how it works now.

BTW, I suspect that passing the --wait flag to crm while running
commands in this way may help you. Although I am not sure I entirely
understand what it is you are doing :)

Cheers,
Kristoffer

>
> Best,
> Vladislav
>
> 13.02.2015 17:03, Vladislav Bogdanov wrote:
>> Hi,
>>
>> Following fails with the current crmsh (e4b10ee).
>> # crm resource stop cl-http-lv
>> # crm resource stop cl-http-lv
>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>> ERROR: Failed to commit updates to cl-http-lv
>> # echo $?
>> 1
>>
>>
>> Best,
>> Vladislav
>> _______________________________________________
>> Linux-HA mailing list
>> Linux-HA@lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>> See also: http://linux-ha.org/ReportingProblems
>
>

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
16.02.2015 11:15, Kristoffer Grönlund wrote:
> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>
>> Hi Kristoffer,
>>
>> may be it is worth to silently (or at least with rc=0) allow deletion of
>> non-existing or already-deleted configuration statements?
>>
>> Background for that is that I keep track of the all configuration
>> statements myself, and, when I delete some resources (together with
>> accompanying constraints), they may go "out-of-order" to 'crm configure
>> delete', thus some constraints are automatically deleted when deleting
>> "lower" resource before the "upper" one. That leads to the whole crm
>> script to fail.
>
> Hmm, I am not sure about doing this by default, since we would want to
> show some kind of indication that a resource name may have been
> misspelled for example... But I can imagine having a command line flag
> for being more flexible in this regard.

Reuse '-F'?

>
> I will look at how it works now.
>
> BTW, I suspect that passing the --wait flag to crm while running
> commands in this way may help you. Although I am not sure I entirely
> understand what it is you are doing :)

Look:
crm configure
primitive a ...
primitive b ...
colocation b-with-a inf: b a
commit
exit

crm configure
delete a
delete b-with-a <= fails because is already deleted automatically
delete b
commit

Best,
Vladislav

>
> Cheers,
> Kristoffer
>
>>
>> Best,
>> Vladislav
>>
>> 13.02.2015 17:03, Vladislav Bogdanov wrote:
>>> Hi,
>>>
>>> Following fails with the current crmsh (e4b10ee).
>>> # crm resource stop cl-http-lv
>>> # crm resource stop cl-http-lv
>>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>>> ERROR: Failed to commit updates to cl-http-lv
>>> # echo $?
>>> 1
>>>
>>>
>>> Best,
>>> Vladislav
>>> _______________________________________________
>>> Linux-HA mailing list
>>> Linux-HA@lists.linux-ha.org
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>>> See also: http://linux-ha.org/ReportingProblems
>>
>>
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Vladislav Bogdanov <bubble@hoster-ok.com> writes:

> Hi Kristoffer,
>
> may be it is worth to silently (or at least with rc=0) allow deletion of
> non-existing or already-deleted configuration statements?
>
> Background for that is that I keep track of the all configuration
> statements myself, and, when I delete some resources (together with
> accompanying constraints), they may go "out-of-order" to 'crm configure
> delete', thus some constraints are automatically deleted when deleting
> "lower" resource before the "upper" one. That leads to the whole crm
> script to fail.

Actually, I decided that it does make sense to return 0 as the error
code even if the resource to delete doesn't exist, so I pushed a commit
to change this. The error message is still printed, though.

>
> Best,
> Vladislav
>
> 13.02.2015 17:03, Vladislav Bogdanov wrote:
>> Hi,
>>
>> Following fails with the current crmsh (e4b10ee).
>> # crm resource stop cl-http-lv
>> # crm resource stop cl-http-lv
>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>> ERROR: Failed to commit updates to cl-http-lv
>> # echo $?
>> 1
>>
>>
>> Best,
>> Vladislav
>> _______________________________________________
>> Linux-HA mailing list
>> Linux-HA@lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>> See also: http://linux-ha.org/ReportingProblems
>
>

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Hi,

On Mon, Feb 16, 2015 at 11:20:16AM +0300, Vladislav Bogdanov wrote:
> 16.02.2015 11:15, Kristoffer Grönlund wrote:
> >Vladislav Bogdanov <bubble@hoster-ok.com> writes:
> >
> >>Hi Kristoffer,
> >>
> >>may be it is worth to silently (or at least with rc=0) allow deletion of
> >>non-existing or already-deleted configuration statements?
> >>
> >>Background for that is that I keep track of the all configuration
> >>statements myself, and, when I delete some resources (together with
> >>accompanying constraints), they may go "out-of-order" to 'crm configure
> >>delete', thus some constraints are automatically deleted when deleting
> >>"lower" resource before the "upper" one. That leads to the whole crm
> >>script to fail.

crmsh tries hard to preserve the CIB sanity on removing elements.
It would be best that you just put all the elements you want to
delete on one line.

> >Hmm, I am not sure about doing this by default, since we would want to
> >show some kind of indication that a resource name may have been
> >misspelled for example... But I can imagine having a command line flag
> >for being more flexible in this regard.
>
> Reuse '-F'?
>
> >
> >I will look at how it works now.
> >
> >BTW, I suspect that passing the --wait flag to crm while running
> >commands in this way may help you.

The --wait option effectively waits for the PE to settle. It is
normally useful only in resource/node levels and on configure
commit.

> >Although I am not sure I entirely
> >understand what it is you are doing :)
>
> Look:
> crm configure
> primitive a ...
> primitive b ...
> colocation b-with-a inf: b a
> commit
> exit
>
> crm configure
> delete a
> delete b-with-a <= fails because is already deleted automatically

You can also omit removing constraints as they are going to be
removed with the resources they reference.

Cheers,

Dejan

> delete b
> commit
>
> Best,
> Vladislav
>
> >
> >Cheers,
> >Kristoffer
> >
> >>
> >>Best,
> >>Vladislav
> >>
> >>13.02.2015 17:03, Vladislav Bogdanov wrote:
> >>>Hi,
> >>>
> >>>Following fails with the current crmsh (e4b10ee).
> >>># crm resource stop cl-http-lv
> >>># crm resource stop cl-http-lv
> >>>ERROR: crm_diff apparently failed to produce the diff (rc=0)
> >>>ERROR: Failed to commit updates to cl-http-lv
> >>># echo $?
> >>>1
> >>>
> >>>
> >>>Best,
> >>>Vladislav
> >>>_______________________________________________
> >>>Linux-HA mailing list
> >>>Linux-HA@lists.linux-ha.org
> >>>http://lists.linux-ha.org/mailman/listinfo/linux-ha
> >>>See also: http://linux-ha.org/ReportingProblems
> >>
> >>
> >
>
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
On 2015-02-16T09:20:22, Kristoffer Grönlund <kgronlund@suse.com> wrote:

> Actually, I decided that it does make sense to return 0 as the error
> code even if the resource to delete doesn't exist, so I pushed a commit
> to change this. The error message is still printed, though.

I'm not sure I agree, for once.

Idempotency is for resource agent operations, not necessarily all
operations everywhere. Especially because crmsh doesn't know whether the
object doesn't exist because it was deleted, or because it was
misspelled.

Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will
give an error code.

Now a caller of crmsh has to *parse the output* to know whether the
delete command succeeded or not, which is rather non-trivial.

If the caller doesn't care whether the command succeeded or not, it
should be the caller that ignores the error code.

Or if you want to get real fancy, return different exit codes for
"referenced object does not exist", or "generic syntax error".

> >> Following fails with the current crmsh (e4b10ee).
> >> # crm resource stop cl-http-lv
> >> # crm resource stop cl-http-lv
> >> ERROR: crm_diff apparently failed to produce the diff (rc=0)
> >> ERROR: Failed to commit updates to cl-http-lv
> >> # echo $?
> >> 1

And, yeah, well, this shouldn't happen. Here idempotency applies ;-)



Regards,
Lars

--
Architect Storage/HA
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Lars Marowsky-Bree <lmb@suse.com> writes:

> On 2015-02-16T09:20:22, Kristoffer Grönlund <kgronlund@suse.com> wrote:
>
>> Actually, I decided that it does make sense to return 0 as the error
>> code even if the resource to delete doesn't exist, so I pushed a commit
>> to change this. The error message is still printed, though.
>
> I'm not sure I agree, for once.
>
> Idempotency is for resource agent operations, not necessarily all
> operations everywhere. Especially because crmsh doesn't know whether the
> object doesn't exist because it was deleted, or because it was
> misspelled.
>
> Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will
> give an error code.
>
> Now a caller of crmsh has to *parse the output* to know whether the
> delete command succeeded or not, which is rather non-trivial.
>
> If the caller doesn't care whether the command succeeded or not, it
> should be the caller that ignores the error code.
>
> Or if you want to get real fancy, return different exit codes for
> "referenced object does not exist", or "generic syntax error".

I suppose the point of argument is the definition of success here. If
asked to remove something and that something does not exist, is that
success?

But, maybe you are right! Doing all of the removes at once would also
solve this use case, with the added benefit of performing the remove
with a single CIB modification.

If Dejan also votes to revert this change, I will do so.

As a sidenote, I find the automatic removal of related constraints
somewhat strange... To continue the filesystem analogy, it is as if soft
links would be deleted when the file they point to is removed. ;)

>
>> >> Following fails with the current crmsh (e4b10ee).
>> >> # crm resource stop cl-http-lv
>> >> # crm resource stop cl-http-lv
>> >> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>> >> ERROR: Failed to commit updates to cl-http-lv
>> >> # echo $?
>> >> 1
>
> And, yeah, well, this shouldn't happen. Here idempotency applies ;-)
>
>
>
> Regards,
> Lars
>
> --
> Architect Storage/HA
> SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
> "Experience is the name everyone gives to their mistakes." -- Oscar Wilde
>
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Hi Dejan,

16.02.2015 13:47, Dejan Muhamedagic wrote:
> Hi,
>
> On Mon, Feb 16, 2015 at 11:20:16AM +0300, Vladislav Bogdanov wrote:
>> 16.02.2015 11:15, Kristoffer Grönlund wrote:
>>> Vladislav Bogdanov <bubble@hoster-ok.com> writes:
>>>
>>>> Hi Kristoffer,
>>>>
>>>> may be it is worth to silently (or at least with rc=0) allow deletion of
>>>> non-existing or already-deleted configuration statements?
>>>>
>>>> Background for that is that I keep track of the all configuration
>>>> statements myself, and, when I delete some resources (together with
>>>> accompanying constraints), they may go "out-of-order" to 'crm configure
>>>> delete', thus some constraints are automatically deleted when deleting
>>>> "lower" resource before the "upper" one. That leads to the whole crm
>>>> script to fail.
>
> crmsh tries hard to preserve the CIB sanity on removing elements.
> It would be best that you just put all the elements you want to
> delete on one line.

That's a really good idea, I'll look into this.

>
>>> Hmm, I am not sure about doing this by default, since we would want to
>>> show some kind of indication that a resource name may have been
>>> misspelled for example... But I can imagine having a command line flag
>>> for being more flexible in this regard.
>>
>> Reuse '-F'?
>>
>>>
>>> I will look at how it works now.
>>>
>>> BTW, I suspect that passing the --wait flag to crm while running
>>> commands in this way may help you.
>
> The --wait option effectively waits for the PE to settle. It is
> normally useful only in resource/node levels and on configure
> commit.
>
>>> Although I am not sure I entirely
>>> understand what it is you are doing :)
>>
>> Look:
>> crm configure
>> primitive a ...
>> primitive b ...
>> colocation b-with-a inf: b a
>> commit
>> exit
>>
>> crm configure
>> delete a
>> delete b-with-a <= fails because is already deleted automatically
>
> You can also omit removing constraints as they are going to be
> removed with the resources they reference.

Unless the same function is used to remove just constraints too (like in
my case - I compare old and new definition of an object with constraints
and remove stale ones).

Anyways, thanks for pointer to multi-object deletes!

Best,
Vladislav

>
> Cheers,
>
> Dejan
>
>> delete b
>> commit
>>
>> Best,
>> Vladislav
>>
>>>
>>> Cheers,
>>> Kristoffer
>>>
>>>>
>>>> Best,
>>>> Vladislav
>>>>
>>>> 13.02.2015 17:03, Vladislav Bogdanov wrote:
>>>>> Hi,
>>>>>
>>>>> Following fails with the current crmsh (e4b10ee).
>>>>> # crm resource stop cl-http-lv
>>>>> # crm resource stop cl-http-lv
>>>>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>>>>> ERROR: Failed to commit updates to cl-http-lv
>>>>> # echo $?
>>>>> 1
>>>>>
>>>>>
>>>>> Best,
>>>>> Vladislav
>>>>> _______________________________________________
>>>>> Linux-HA mailing list
>>>>> Linux-HA@lists.linux-ha.org
>>>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>>>>> See also: http://linux-ha.org/ReportingProblems
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Linux-HA mailing list
>> Linux-HA@lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>> See also: http://linux-ha.org/ReportingProblems
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
16.02.2015 14:34, Lars Marowsky-Bree wrote:
> On 2015-02-16T09:20:22, Kristoffer Grönlund <kgronlund@suse.com> wrote:
>
>> Actually, I decided that it does make sense to return 0 as the error
>> code even if the resource to delete doesn't exist, so I pushed a commit
>> to change this. The error message is still printed, though.
>
> I'm not sure I agree, for once.
>
> Idempotency is for resource agent operations, not necessarily all
> operations everywhere. Especially because crmsh doesn't know whether the
> object doesn't exist because it was deleted, or because it was
> misspelled.
>
> Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will
> give an error code.

btw with '-f' it wont. ;) And it would be enough for me if 'crm -F'
behave the same.

Best,
Vladislav

>
> Now a caller of crmsh has to *parse the output* to know whether the
> delete command succeeded or not, which is rather non-trivial.
>
> If the caller doesn't care whether the command succeeded or not, it
> should be the caller that ignores the error code.
>
> Or if you want to get real fancy, return different exit codes for
> "referenced object does not exist", or "generic syntax error".
>
>>>> Following fails with the current crmsh (e4b10ee).
>>>> # crm resource stop cl-http-lv
>>>> # crm resource stop cl-http-lv
>>>> ERROR: crm_diff apparently failed to produce the diff (rc=0)
>>>> ERROR: Failed to commit updates to cl-http-lv
>>>> # echo $?
>>>> 1
>
> And, yeah, well, this shouldn't happen. Here idempotency applies ;-)
>
>
>
> Regards,
> Lars
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
On Mon, Feb 16, 2015 at 01:12:55PM +0100, Kristoffer Grönlund wrote:
> Lars Marowsky-Bree <lmb@suse.com> writes:
>
> > On 2015-02-16T09:20:22, Kristoffer Grönlund <kgronlund@suse.com> wrote:
> >
> >> Actually, I decided that it does make sense to return 0 as the error
> >> code even if the resource to delete doesn't exist, so I pushed a commit
> >> to change this. The error message is still printed, though.
> >
> > I'm not sure I agree, for once.
> >
> > Idempotency is for resource agent operations, not necessarily all
> > operations everywhere. Especially because crmsh doesn't know whether the
> > object doesn't exist because it was deleted, or because it was
> > misspelled.

That's a good point.

> > Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will
> > give an error code.

I guess you meant that it won't.

> > Now a caller of crmsh has to *parse the output* to know whether the
> > delete command succeeded or not, which is rather non-trivial.
> >
> > If the caller doesn't care whether the command succeeded or not, it
> > should be the caller that ignores the error code.
> >
> > Or if you want to get real fancy, return different exit codes for
> > "referenced object does not exist", or "generic syntax error".
>
> I suppose the point of argument is the definition of success here. If
> asked to remove something and that something does not exist, is that
> success?

That sounds like a philosophical question :)

> But, maybe you are right! Doing all of the removes at once would also
> solve this use case, with the added benefit of performing the remove
> with a single CIB modification.
>
> If Dejan also votes to revert this change, I will do so.

Must say that I somehow missed the change. The most useful thing
to do seems be to exit with 0 in case --force (or crm -F) is in
effect (perhaps to suppress the error message too), just like "rm
-f", which Lars brought up. Otherwise to keep the existing
behaviour (error code, error message).

> As a sidenote, I find the automatic removal of related constraints
> somewhat strange...

What good could there be from a constraint if the referenced
resource left the stage? I may have found the idea strange too,
but then ended up with an illegal CIB, which was not the best way
forward either. To the best of my knowledge, crm_verify doesn't
allow constraints pointing to nowhere.

> To continue the filesystem analogy, it is as if soft
> links would be deleted when the file they point to is removed. ;)
>
> >
> >> >> Following fails with the current crmsh (e4b10ee).
> >> >> # crm resource stop cl-http-lv
> >> >> # crm resource stop cl-http-lv
> >> >> ERROR: crm_diff apparently failed to produce the diff (rc=0)
> >> >> ERROR: Failed to commit updates to cl-http-lv
> >> >> # echo $?
> >> >> 1
> >
> > And, yeah, well, this shouldn't happen. Here idempotency applies ;-)

It's not intentional really. This is a bug when interpreting the
result of a crm_diff(1) invocation. But I think that Kristoffer
already fixed it.

Thanks,

Dejan

> >
> >
> > Regards,
> > Lars
> >
> > --
> > Architect Storage/HA
> > SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
> > "Experience is the name everyone gives to their mistakes." -- Oscar Wilde
> >
> > _______________________________________________
> > Linux-HA mailing list
> > Linux-HA@lists.linux-ha.org
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha
> > See also: http://linux-ha.org/ReportingProblems
> >
>
> --
> // Kristoffer Grönlund
> // kgronlund@suse.com
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
Dejan Muhamedagic <dejanmm@fastmail.fm> writes:

>>
>> If Dejan also votes to revert this change, I will do so.
>
> Must say that I somehow missed the change. The most useful thing
> to do seems be to exit with 0 in case --force (or crm -F) is in
> effect (perhaps to suppress the error message too), just like "rm
> -f", which Lars brought up. Otherwise to keep the existing
> behaviour (error code, error message).

Fixed. :)

>
>> As a sidenote, I find the automatic removal of related constraints
>> somewhat strange...
>
> What good could there be from a constraint if the referenced
> resource left the stage? I may have found the idea strange too,
> but then ended up with an illegal CIB, which was not the best way
> forward either. To the best of my knowledge, crm_verify doesn't
> allow constraints pointing to nowhere.
>

It really is only a problem of expected behavior, especially when
editing. I might choose to modify a primitive by removing and recreating
it, expecting the constraints to still be there. Or I want to remove a
primitive and rewrite constraints applied to it to apply to a different
resource instead, and be surprised when those constraints
disappear. But, the current functionality makes sense in light of how
the CIB works.

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: crmsh fails to stop already stopped resource [ In reply to ]
On Mon, Feb 16, 2015 at 03:25:58PM +0100, Kristoffer Grönlund wrote:
> Dejan Muhamedagic <dejanmm@fastmail.fm> writes:
>
> >>
> >> If Dejan also votes to revert this change, I will do so.
> >
> > Must say that I somehow missed the change. The most useful thing
> > to do seems be to exit with 0 in case --force (or crm -F) is in
> > effect (perhaps to suppress the error message too), just like "rm
> > -f", which Lars brought up. Otherwise to keep the existing
> > behaviour (error code, error message).
>
> Fixed. :)
>
> >
> >> As a sidenote, I find the automatic removal of related constraints
> >> somewhat strange...
> >
> > What good could there be from a constraint if the referenced
> > resource left the stage? I may have found the idea strange too,
> > but then ended up with an illegal CIB, which was not the best way
> > forward either. To the best of my knowledge, crm_verify doesn't
> > allow constraints pointing to nowhere.
> >
>
> It really is only a problem of expected behavior, especially when
> editing. I might choose to modify a primitive by removing and recreating
> it, expecting the constraints to still be there. Or I want to remove a
> primitive and rewrite constraints applied to it to apply to a different
> resource instead, and be surprised when those constraints
> disappear.

Yes, I see your point and it could just as well be that crmsh is
really overzealous in this case. Perhaps the removal should be
deferred until the commit?

Or is it that with certain strictness setting CIB verification is
run after every configuration change (i.e. before commit)?

Cheers,

Dejan

> But, the current functionality makes sense in light of how
> the CIB works.
>
> --
> // Kristoffer Grönlund
> // kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems