[Linux-HA] Antw: Re: crmsh fails to stop already stopped resource
Lars Marowsky-Bree l...@suse.com schrieb am 16.02.2015 um 12:34 in Nachricht 20150216113433.gb4...@suse.de: On 2015-02-16T09:20:22, Kristoffer Grönlund kgronl...@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. So far I was assuming we are talking about stopping a stopped resource, not stopping a non-existing resource. I thought that crm shell would clearly distinguish between those. The latter should be an error, of course. Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will give an error code. You are wrong: windl@v04:~ rm -f /tmp/foobar windl@v04:~ echo $? 0 Now a caller of crmsh has to *parse the output* to know whether the delete command succeeded or not, which is rather non-trivial. Well ,doesn't crm shell parse the CIB all the time? If so it should be able to find out whether the resource is still there. Anyway now you are talking about deleting a resource while the subject is on stopping a stopped resource. If the caller doesn't care whether the command succeeded or not, it should be the caller that ignores the error code. Who is the caller for you now? I don't quite get is: The caller of crm shell, or the crm shell? Or if you want to get real fancy, return different exit codes for referenced object does not exist, or generic syntax error. I Agree. 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 I'm not happy with the error messages: Whil technically quite correct, they are confusing for the user: If the resource doesn't exist, can't crm shell find out before trying to create/apply a diff? And apparently failed: Did it, or didn't it? crm shell should be able to find out! And, yeah, well, this shouldn't happen. Here idempotency applies ;-) Sometimes 90% of the code are about things that shouldn't happen; if they do, it's good to have that code ;-) Regards, Ulrich ___ 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] Antw: Re: crmsh fails to stop already stopped resource
Kristoffer Grönlundkgronl...@suse.com schrieb am 16.02.2015 um 13:12 in Nachricht 87fva6gim0@krigpad.kri.gs: [...] As a sidenote, I find the automatic removal of related constraints somewhat strange... To continue the filesystem analogy, it is as if soft I object: I think this is a _very_ important feature. Somtimes I'd wish show changed could display a word-diff-like output... links would be deleted when the file they point to is removed. ;) Well It's not quite the same: You can recreate the file through the symbolic link, but you cannot recreate the resource through the constraint. [...] Regards, Ulrich ___ 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: [Linux-HA] Antw: Re: crmsh fails to stop already stopped resource
Hi, On Wed, Feb 18, 2015 at 08:21:10AM +0100, Ulrich Windl wrote: Kristoffer Grönlundkgronl...@suse.com schrieb am 16.02.2015 um 09:15 in Nachricht 87oaougtlw@krigpad.kri.gs: Vladislav Bogdanov bub...@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'd agree: Stopping a stopped resource is different from deleting a resource that does not exist (maybe never existed). Maybe (for scripting) crm shell would benefit from a crm resource exists rsc_name returning a status (yes/no/error). You could use crm resource status for that. It should exit with error only if the resource doesn't exist. Thanks, Dejan ___ 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: [Linux-HA] Antw: Re: crmsh fails to stop already stopped resource
18.02.2015 11:03, Ulrich Windl wrote: Lars Marowsky-Bree l...@suse.com schrieb am 16.02.2015 um 12:34 in Nachricht 20150216113433.gb4...@suse.de: On 2015-02-16T09:20:22, Kristoffer Grönlund kgronl...@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. So far I was assuming we are talking about stopping a stopped resource, not stopping a non-existing resource. I thought that crm shell would clearly distinguish between those. The latter should be an error, of course. That is my fault, I should be starting the new thread, but I thought that issue with deleting non-existent object is really very minor. 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: [Linux-HA] Antw: Re: crmsh fails to stop already stopped resource
Hi, On Wed, Feb 18, 2015 at 09:15:57AM +0100, Ulrich Windl wrote: Dejan Muhamedagic deja...@fastmail.fm schrieb am 16.02.2015 um 16:08 in Nachricht 20150216150805.GC27091@tuttle.linbit: [...] 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? I'm confused: Dosn't it? I thought within the configure context nothing really happens before commit? crmsh keeps a work copy of the CIB in memory. All configure commands affect that one. On commit, the memory CIB is copied to the target CIB, which is typically the live cluster CIB (but it can also be a shadow CIB, which is just a file). What I referred to above was the work copy, i.e. that the hanging constraints removal should happen at the commit time, so that the user has a chance to update them beforehand. Thanks, Dejan [...] Regards, Ulrich ___ 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] Antw: Re: crmsh fails to stop already stopped resource
Kristoffer Grönlundkgronl...@suse.com schrieb am 16.02.2015 um 09:15 in Nachricht 87oaougtlw@krigpad.kri.gs: Vladislav Bogdanov bub...@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'd agree: Stopping a stopped resource is different from deleting a resource that does not exist (maybe never existed). Maybe (for scripting) crm shell would benefit from a crm resource exists rsc_name returning a status (yes/no/error). 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 // kgronl...@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
[Linux-HA] Antw: Re: crmsh fails to stop already stopped resource
Kristoffer Grönlundkgronl...@suse.com schrieb am 13.02.2015 um 15:20 in Nachricht 87wq3lhp0h@krigpad.kri.gs: Vladislav Bogdanov bub...@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? UNIX standard: stopping a stopped resource should be idempotent, so no error, no output. 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 // kgronl...@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