<div dir="ltr"><div>I did some more investigation and was able to answer two of my questions: </div><div><br></div><div>First, why did "pcs stonith list" not show my fence_foo agent? pcs runs the meta-data action on the agent to get the description.  Since my fence_foo agent wasn't implemented, this would fail, and pcs would not display it.  If I ran "pcs stonith list --nodesc" then the agent would be shown.<br></div><div><br></div><div>Second, how should I import the fencing.py lib?  I noticed that all the exiting fence_agents did explicitly add the path the the fencing lib, by sys.path.append(PATH).</div><div><br></div><div>My only remaining question:  Is "yum install fence-agents-common.x86_64" the appropriate way to install the fencing.py library?  I suspect there may not be any best practice in this area.</div><div><br></div><div>Thanks,</div><div>Ryan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 9, 2018 at 12:24 PM, Ryan Thomas <span dir="ltr"><<a href="mailto:developmentrjt@gmail.com" target="_blank">developmentrjt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Thanks for the advice and information.</div><span class=""><div><br></div><div>

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>> 1. The documentation encourages the use of the python fencing library. <span> </span></span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>>    How does one install this?</span>>
Fencing library is basically this file (sans the doubled extension):<br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"></div><div><a href="https://github.com/ClusterLabs/fence-agents/blob/v4.2.1/lib/fencing.py.py" rel="noreferrer" style="color:rgb(17,85,204);font-size:small;background-color:rgb(255,255,255)" target="_blank">

<span style="color:rgb(34,34,34);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span>

https://github.com/ClusterLabs<wbr>/fence-agents/blob/v4.2.1/lib/<wbr>fencing.py.py</a><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span>

that shall be assurably in predefined/run-time-mangled</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span>

search path for Python modules (sys.path), so that you can then</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span>

"from fencing import ...".  You can follow the native agents for</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">></span>

how it is to be used.</span>

<br></div><div><br></div></span><div><div>My system did not have a fencing.py installed. However, I found that after running "yum install fence-agents-common.x86_64", fencing.py could be found in /usr/share/fence as you said.  Is "yum install fence-agents-common.x86_64" the appropriate way to install the fencing.py library? It seems like fencing.py being installed was a side-effect, rather than explictly being installed. Also, although the fencing.py did appear, it is not in the python path.  So "import fencing" fails with "ImportError: No module named fencing".</div><div>  I can of course add /usr/share/fence to the python path.</div></div><span class=""><div class="gmail_extra"><br></div><div class="gmail_extra">

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>> 2. How to a “register” the agent so it shows up in the “pcs stonith</span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>>    list” output, and the “stonith_admin –list-installed” output?<span> </span></span><br style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>>    So, I can use my new agent?</span>

<br></div></span><div class="gmail_extra"><span class="">

<div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> Living convention for this is that whatever in /usr/sbin</span><br style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">><span> </span></span>

(symbolically in pacemaker context: RH_STONITH_DIR) named in way</span><br style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">><span> </span></span>

that conforms "fence_*" glob pattern (symbolically RH_STONITH_PREFIX)</span><br style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">><span> </span></span>

will qualify automatically.  Obviously, it shall be marked executable.</span>

<br class="m_-3954468083254373387gmail-Apple-interchange-newline"><br></div></span><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Following your advice, I ran "echo 'import fencing' > /usr/sbin/fence_foo" and "chmod +x /usr/sbin/fence_foo".  After doing this the "stonith_admin --list-installed" did list fence_foo.  However, the "pcs stonith list" 

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">><span> </span></span>

did not, so there must be something more that needs to be done for the fence agent to be found by pcs.</div><br class="m_-3954468083254373387gmail-Apple-interchange-newline">

Thanks,</div><div class="gmail_extra">Ryan</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Aug 9, 2018 at 8:09 AM, Jan Pokorný <span dir="ltr"><<a href="mailto:jpokorny@redhat.com" target="_blank">jpokorny@redhat.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5"><span class="m_-3954468083254373387gmail-">On 09/08/18 07:59 +0200, Ulrich Windl wrote:<br>
>>>> Ryan Thomas <<a href="mailto:developmentrjt@gmail.com" target="_blank">developmentrjt@gmail.com</a>> schrieb am 08.08.2018 um 23:26 in<br>
> Nachricht<br>
> <CAE_QAjkDx15bR=<a href="mailto:eb12jCxLX9e0BaGex%2BzjsTztWQnOugwsKK3w@mail.gmail.com" target="_blank">eb12jCxLX9e0Ba<wbr>Gex+zjsTztWQnOugwsKK3w@mail.gm<wbr>ail.com</a>>:<br>
>> I’m attempting to implement a fencing agent.<br>
>> <br>
>> The ClusterLabs/fence-agent github repo has some helpful information<br>
>> including fence-agents/doc/FenceAgentAPI<wbr>.md, but I haven’t found the<br>
>> answers to a few basic questions.<br>
> <br>
> Personally I think a specification should not recommend any library to use,<br>
> but state in simple and precise words what the thing (=fencing agent)<br>
> is expected to do.<br>
<br>
</span>+1 for a complete decoupling of API specification and referential<br>
library, it's pretty possible there are still some undocumented bits<br>
relied upon while only hardwired into the fencing library.  Note that<br>
pacemaker adds a thin configuration surface and decision logic on top<br>
of the base line set forth in the mentioned document.<br>
<br>
Also, mentioning Python below, there are certainly reasons why it can<br>
be more blessed than say shell scripting, though I stay vocal that<br>
transition from compiled fence agents was rather a regress than<br>
progress (not to speak about original Linux HA project going as far as<br>
to have ready-to-use agents preloaded in memory to achieve<br>
unprecedented robustness -- please correct me if I get these gory<br>
details about the past wrong).<br>
<br>
The problem with Python is that even for a trivial proxying of the<br>
operations towards 3rd party tooling (e.g. ipmitool), the costs of<br>
bringing the run-time up alone is unexpectedly I/O intensive (trying<br>
to open plethora files, preinitializing some objects that won't be<br>
used, anyway, etc.), with excessive complexity of the task/memory<br>
footprint proportion, and currently also carrying a risk of being<br>
affected/delayed with user customization of the Python deployment<br>
that gets loaded automatically unless suppressed [1].  That's not<br>
very aligned with the goal of preventing dangerous access to shared<br>
resources in timely and reliable fashion.<br>
<br>
Perhaps a reasonable tradeoff at this point would be to consider<br>
MicroPython, alternative lightweight implementation with a trimmed<br>
standard library: <a href="https://micropython.org/" rel="noreferrer" target="_blank">https://micropython.org/</a>.  As a first step, fencing<br>
library would likely require some touches for compatibility, though.<br>
<br>
> Inspecting the source of SBD I found out that there is too much<br>
> undocumented magic implemented.<br>
<span class="m_-3954468083254373387gmail-"><br>
>> 1. The documentation encourages the use of the python fencing library.  <br>
>>    How does one install this?<br>
<br>
</span>Fencing library is basically this file (sans the doubled extension):<br>
<a href="https://github.com/ClusterLabs/fence-agents/blob/v4.2.1/lib/fencing.py.py" rel="noreferrer" target="_blank">https://github.com/ClusterLabs<wbr>/fence-agents/blob/v4.2.1/lib/<wbr>fencing.py.py</a><br>
that shall be assurably in predefined/run-time-mangled<br>
search path for Python modules (sys.path), so that you can then<br>
"from fencing import ...".  You can follow the native agents for<br>
how it is to be used.<br>
<br>
For instance, EL family of distros will provide that file as<br>
/usr/share/fence/fencing.py by the means of fence-agents-common<br>
package.<br>
<span class="m_-3954468083254373387gmail-"><br>
>> 2. How to a “register” the agent so it shows up in the “pcs stonith<br>
>>    list” output, and the “stonith_admin –list-installed” output? <br>
>>    So, I can use my new agent?<br>
<br>
</span>Living convention for this is that whatever in /usr/sbin<br>
(symbolically in pacemaker context: RH_STONITH_DIR) named in way<br>
that conforms "fence_*" glob pattern (symbolically RH_STONITH_PREFIX)<br>
will qualify automatically.  Obviously, it shall be marked executable.<br>
<br>
<br>
Hope this helps.<br>
<br>
[1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1600893" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/sh<wbr>ow_bug.cgi?id=1600893</a><br>
<span class="m_-3954468083254373387gmail-HOEnZb"><font color="#888888"><br>
-- <br>
Nazdar,<br>
Jan (Poki)<br>
</font></span><br></div></div><span class="">______________________________<wbr>_________________<br>
Users mailing list: <a href="mailto:Users@clusterlabs.org" target="_blank">Users@clusterlabs.org</a><br>
<a href="https://lists.clusterlabs.org/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.clusterlabs.org/<wbr>mailman/listinfo/users</a><br>
<br>
Project Home: <a href="http://www.clusterlabs.org" rel="noreferrer" target="_blank">http://www.clusterlabs.org</a><br>
Getting started: <a href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf" rel="noreferrer" target="_blank">http://www.clusterlabs.org/doc<wbr>/Cluster_from_Scratch.pdf</a><br>
Bugs: <a href="http://bugs.clusterlabs.org" rel="noreferrer" target="_blank">http://bugs.clusterlabs.org</a><br>
<br></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>