[ClusterLabs Developers] RFC: New stonith agent for pacemaker clusters running on virtual machines which are managed by ganeti

Dejan Muhamedagic dejanmm at fastmail.fm
Tue Oct 11 13:16:16 EDT 2016


Hi,

On Mon, Oct 10, 2016 at 05:00:36PM +0200, Dominik Klein wrote:
> Oh feel free to change that. No reason really.

Well, you author, me just comment :) I just think it would make
the configuration easier.

Some comments:

There's no logging in the plugin, perhaps you could do some.

98     vmstate=$(curl -X GET ${curl_options} ${ganetiapi}/2/instances/${vm} | j q -c .status | cut -d\" -f 2)

What if that call fails? Shouldn't you then do something like:

case "$vmstate" in
running) vm_started=0 ;;
stopped) vm_started=1 ;; # or whatever it returns
*)
	ha_log.sh err "ganeti call failed, vm state unknown!"
	return 2
	;;
esac

In which case it would be prudent to assume that the guest may be
running. Or not? I don't have experience with ganeti.

Similarly, fetching the jobid may fail too; you should probably
check the outcome in poweroff_vm/poweron_vm.

Here and there you could have been more concise, for instance,
instead of:

 99     if [ "${1}" = "started" ]; then
100         if [ "${vmstate}" = "running" ]; then
101             return 0
102         else
103             return 1
104         fi
105     elif [ "${1}" = "stopped" ]; then
106         if [ "${vmstate}" = "running" ]; then
107             return 1
108         else
109             return 0
110         fi
111     else
112         return 1
113     fi

maybe sth like:

local vm_started
[ "${vmstate}" = "running" ]
vm_started=$?
case "$1" in
started) return $vm_started ;;
stopped) return ! $vm_started ;;
*)
	ha_log.sh err "internal error"
	return 1
	;;
esac

Hope I got the logic right :)
and that I didn't miss anything.

Cheers,

Dejan

> Am 10.10.2016 4:56 nachm. schrieb "Dejan Muhamedagic" <dejanmm at fastmail.fm>:
> 
> > Hi Dominik,
> >
> > On Fri, Oct 07, 2016 at 02:50:10PM +0200, Dominik Klein wrote:
> > > Hi there
> > >
> > > I wrote an agent that should be (_is_ in my environment) able to
> > > implement stonith in a pacemaker cluster running on ganeti-powered
> > > virtual machines. It talks to the ganeti api.
> > >
> > > I did not do this with the xvm agent since it would (from what I
> > > understand) require a second control instance on the physical machines
> > > which might interfere with ganeti (expected machine states will likely
> > > be different in a shooting scenario).
> > >
> > > Any feedback is appreciated.
> > >
> > > Example configuration:
> > >
> > > Place the script in /usr/lib/stonith/plugins/external/ganeti and
> > > configure this fencing resource:
> > >
> > > primitive fencing stonith:external/ganeti \
> > > params \
> > > ganeti_api_port=5080 \
> > > ganeti_api_transport=https \
> > > ganeti_auth_password=seeeeCret \
> > > ganeti_auth_user=overlord \
> > > ganeti_cluster=ganeti.example.com \
> > > ganeti_curl_ignore_ssl_errors=true \
> > > op monitor interval=120s
> >
> > Why the "ganeti" prefix for parameters? It is anyway within the
> > ganeti plugin's scope.
> >
> > I'll take a look at the code too.
> >
> > Cheers,
> >
> > Dejan
> >
> > >
> > > Thanks
> > > Dominik
> >
> >
> > > _______________________________________________
> > > Developers mailing list
> > > Developers at clusterlabs.org
> > > http://clusterlabs.org/mailman/listinfo/developers
> >
> >
> > _______________________________________________
> > Developers mailing list
> > Developers at clusterlabs.org
> > http://clusterlabs.org/mailman/listinfo/developers
> >

> _______________________________________________
> Developers mailing list
> Developers at clusterlabs.org
> http://clusterlabs.org/mailman/listinfo/developers





More information about the Developers mailing list