Low: ping: Avoid temp files in fping_check (bsc#987348) - #1117
Conversation
Unfortunately the previous attempt to avoid this issue (commit 7eb958c) didn't work since the problem happens only when the output buffer is flushed but the write fails. Since there is no mechanism in the shell to check if a pipe write is successful, this silently fails. In ping_check, there are no temporary files created. It's possible to avoid the temporaries for fping too, but I had to resort to using python.
|
You didn't want to rewrite the whole thing in python? :-) |
|
Hah, well. Sure! I would definitely prefer if it was all python, yes. That's a bit more work than I have time for right now, though. Plus, I feel like if I'm going to start writing resource agents in python, there should be a common library like for the fence agents etc. Suddenly it's a LOT more work. ;) |
|
I'd say this macaronic programming is rather counter-productive and should be avoided if possible (not to speak about introducing new dependencies; note that Beside that, there are some latent issues in the parsing logic, such as when |
|
(in fact, that python dependency is currently justified with |
|
I see this as a first step toward full pythonization of the agent, which would be ideal (the agent is too complex for a shell script to be readable and maintainable). I do think it would be a good idea to have a python library in resource-agents, but unfortunately that wouldn't help here -- pacemaker agents don't use resource-agents libraries because we don't want to depend on a particular version. I hadn't noticed that the main pacemaker package depends on python; I didn't think it did. Probably -libs-devel should have the dependency instead. In any case, I don't think we need a strict dependency on python for this particular code, because the agent is not required for a cluster, and rpm doesn't have a "recommends"-style optional dependency, which would be appropriate here. I could see one day pythonizing some of the command-line tools and making -cli depend on python, but I wouldn't want to do that unless we were python 3-compatible. |
See lib/pengine/complex.c:handle_rsc_isolation(). It's only used by pacemaker itself, as part of the undocumented resource isolation feature. |
|
On 15/08/16 08:30 -0700, Ken Gaillot wrote:
It's a fair deal if this is a midstep in that direction, supposing http://oss.clusterlabs.org/pipermail/users/2015-May/000403.html Anyway, what is applicable in general incl. this PR and, I think, 1/ python invocation should be accompanied with at least and just for this PR (but the principle should be kept in mind 2/
There's also a danger of a circular dependency, but that's nothing
true, but mentioned change 2/ should be made so as to prevent corner
No longer true: but nothing that could be used instantly, procedurally, technically
Reasonable. Jan (Poki) |
|
Haha, macaronic programming is a great description. I don't disagree with the arguments against mixing in python like this. I'll look at rewriting it in python 2+3 completely. At least that way, the prerequisites will be clear. |
|
On 15/08/16 20:43 +0200, Jan Pokorný wrote:
scratch this out, I guess I had the rpm query wrong Jan (Poki) |
Just merged our first-ever Python coding guidelines: https://github.com/ClusterLabs/pacemaker/blob/master/doc/Pacemaker_Development/en-US/Ch-Python.txt It includes our intended approach to 2+3 compatibility. It's very much a work in progress, so feel free to recommend changes/additions. |
Unfortunately the previous attempt to avoid this issue (commit
7eb958c) didn't work since the problem happens only when the
output buffer is flushed but the write fails. Since there is no
mechanism in the shell to check if a pipe write is successful,
this silently fails.
In ping_check, there are no temporary files created. It's
possible to avoid the temporaries for fping too, but I had to
resort to using python.