Mailing List Archive

Patch: stonith plugin external/vcenter HOSTLIST separator
Hi all,

recently I tried to use the STONITH plugin external/vcenter along with
vCenter 5 (I doubt, that the version is significant).
While using the stonith resource for each node separately, I had no
problems, but using it in a clone resulted in failures like that one:

====
Nov 14 08:53:57 shermcl1 external/vcenter(vfencing:0)[23236]: [23257]:
ERROR: [reset shermcl2] Invalid target specified
====
where the cluster consists of virtual machines SHERMCL1, SHERMCL2 and
SHERMCL3, with their unames shermcl1, shermcl2 and shermcl3,
accordingly. shermcl2 should be fenced, but the remaining cluster
members were unable to kill that machine.

The relevant portion of the cluster configuration is here:

====
node shermcl1
node shermcl2
node shermcl3

primitive vfencing stonith:external/vcenter \
params VI_SERVER="virtualcenter.dom.ain"
VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml"
HOSTLIST="shermcl1=SHERMCL1;shermcl2=SHERMCL2;shermcl3=SHERMCL3"
RESETPOWERON="0" \
op monitor interval="3600s"
clone Fencing vfencing

location l-Fencing_shermcl1 Fencing 0: shermcl1
location l-Fencing_shermcl2 Fencing 0: shermcl2
location l-Fencing_shermcl3 Fencing 0: shermcl3
====

The location statements are needed, as the cluster itself is no
symmetric.

All machines are plain openSUSE 12.2 with corosync 1.4.3 and pacemaker
1.1.6.

While running perfectly on the commandline with
====
stonith -t external/vcenter VI_SERVER="virtualcenter.dom.ain" \
VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml" \
HOSTLIST="shermcl1=SHERMCL1;shermcl2=SHERMCL2;shermcl3=SHERMCL3" \
RESETPOWERON="0" -l
====
and showing the names of the three virtual machines, I found, that
called as resource inside the cluster only the first hostname until the
first "=" is visible, perhaps caused by the handover as environment
variable.

Applying the attached trivial patch to use a colon (":") instead of the
equal sign ("=") the command line test
====
stonith -t external/vcenter VI_SERVER="virtualcenter.dom.ain" \
VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml" \
HOSTLIST="shermcl1:SHERMCL1;shermcl2:SHERMCL2;shermcl3:SHERMCL3" \
RESETPOWERON="0" -l
====
as well as fencing inside the cluster with
====
primitive vfencing stonith:external/vcenter \
params VI_SERVER="virtualcenter.dom.ain"
VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml"
HOSTLIST="shermcl1:SHERMCL1;shermcl2:SHERMCL2;shermcl3:SHERMCL3"
RESETPOWERON="0" \
op monitor interval="3600s"
====
succeeds.


So a question around: Is anyone using the external/vcenter with the
cloned resource successfully with the original syntax?
If so, where is my problem?

If not, the attached patch changes the syntax in the above described
way. If there is no objection can it be applied?

Greetings,

Stefan

PS: sorry for the line breaks in the code
--
Stefan Botter listreader@jsj.dyndns.org
Re: Patch: stonith plugin external/vcenter HOSTLIST separator [ In reply to ]
Hi,

On Thu, Nov 15, 2012 at 11:52:48AM +0100, Stefan Botter wrote:
> Hi all,
>
> recently I tried to use the STONITH plugin external/vcenter along with
> vCenter 5 (I doubt, that the version is significant).
> While using the stonith resource for each node separately, I had no
> problems, but using it in a clone resulted in failures like that one:
>
> ====
> Nov 14 08:53:57 shermcl1 external/vcenter(vfencing:0)[23236]: [23257]:
> ERROR: [reset shermcl2] Invalid target specified
> ====
> where the cluster consists of virtual machines SHERMCL1, SHERMCL2 and
> SHERMCL3, with their unames shermcl1, shermcl2 and shermcl3,
> accordingly. shermcl2 should be fenced, but the remaining cluster
> members were unable to kill that machine.
>
> The relevant portion of the cluster configuration is here:
>
> ====
> node shermcl1
> node shermcl2
> node shermcl3
>
> primitive vfencing stonith:external/vcenter \
> params VI_SERVER="virtualcenter.dom.ain"
> VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml"
> HOSTLIST="shermcl1=SHERMCL1;shermcl2=SHERMCL2;shermcl3=SHERMCL3"
> RESETPOWERON="0" \
> op monitor interval="3600s"
> clone Fencing vfencing

It could be that the issue comes from the bug in fence_legacy,
which has been resolved in the meantime. Can you try to edit that
and replace the split command (line 86) with the following (i.e.
just append ", 2"):

($name,$val)=split /\s*=\s*/, $opt, 2;

The file location should be /usr/sbin/fence_legacy.

Can you please see if that helps?

Cheers,

Dejan

> location l-Fencing_shermcl1 Fencing 0: shermcl1
> location l-Fencing_shermcl2 Fencing 0: shermcl2
> location l-Fencing_shermcl3 Fencing 0: shermcl3
> ====
>
> The location statements are needed, as the cluster itself is no
> symmetric.
>
> All machines are plain openSUSE 12.2 with corosync 1.4.3 and pacemaker
> 1.1.6.
>
> While running perfectly on the commandline with
> ====
> stonith -t external/vcenter VI_SERVER="virtualcenter.dom.ain" \
> VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml" \
> HOSTLIST="shermcl1=SHERMCL1;shermcl2=SHERMCL2;shermcl3=SHERMCL3" \
> RESETPOWERON="0" -l
> ====
> and showing the names of the three virtual machines, I found, that
> called as resource inside the cluster only the first hostname until the
> first "=" is visible, perhaps caused by the handover as environment
> variable.
>
> Applying the attached trivial patch to use a colon (":") instead of the
> equal sign ("=") the command line test
> ====
> stonith -t external/vcenter VI_SERVER="virtualcenter.dom.ain" \
> VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml" \
> HOSTLIST="shermcl1:SHERMCL1;shermcl2:SHERMCL2;shermcl3:SHERMCL3" \
> RESETPOWERON="0" -l
> ====
> as well as fencing inside the cluster with
> ====
> primitive vfencing stonith:external/vcenter \
> params VI_SERVER="virtualcenter.dom.ain"
> VI_CREDSTORE="/root/.vmware/credstore/vicredentials.xml"
> HOSTLIST="shermcl1:SHERMCL1;shermcl2:SHERMCL2;shermcl3:SHERMCL3"
> RESETPOWERON="0" \
> op monitor interval="3600s"
> ====
> succeeds.
>
>
> So a question around: Is anyone using the external/vcenter with the
> cloned resource successfully with the original syntax?
> If so, where is my problem?
>
> If not, the attached patch changes the syntax in the above described
> way. If there is no objection can it be applied?
>
> Greetings,
>
> Stefan
>
> PS: sorry for the line breaks in the code
> --
> Stefan Botter listreader@jsj.dyndns.org

> # HG changeset patch
> # User Stefan Botter <jsj@jsj.dyndns.org>
> # Date 1352974761 -3600
> # Node ID 3429be9596a95127e04706c38c5c4d82fb67e206
> # Parent 0809ed6abeb7289f3a8f4229f537df8d509c0854
> - trivial change to use ":" as hostname delimiter in HOSTLIST instead of "="
>
> diff -r 0809ed6abeb7 -r 3429be9596a9 lib/plugins/stonith/external/vcenter
> --- a/lib/plugins/stonith/external/vcenter Mon Oct 22 17:35:17 2012 +0200
> +++ b/lib/plugins/stonith/external/vcenter Thu Nov 15 11:19:21 2012 +0100
> @@ -55,12 +55,12 @@
> <longdesc lang="en">
> The list of hosts that the VMware vCenter STONITH device controls.
> Syntax is:
> - hostname1[=VirtualMachineName1];hostname2[=VirtualMachineName2]
> + hostname1[:VirtualMachineName1];hostname2[:VirtualMachineName2]
>
> -NOTE: omit =VirtualMachineName if hostname and virtual machine names are identical
> +NOTE: omit :VirtualMachineName if hostname and virtual machine names are identical
>
> Example:
> - cluster1=VMCL1;cluster2=VMCL2
> + cluster1:VMCL1;cluster2:VMCL2
> </longdesc>
> </parameter>
> <parameter name="VI_SERVER">
> @@ -128,7 +128,7 @@
> my %host_to_vm = ();
> my %vm_to_host = ();
> foreach my $host (@hostlist) {
> - my @config = split(/=/, $host);
> + my @config = split(/:/, $host);
> my $key = $config[0]; my $value = $config[1];
> if (!defined($value)) { $value = $config[0]; }
> $host_to_vm{$key} = $value;

> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: stonith plugin external/vcenter HOSTLIST separator [ In reply to ]
Hi Dejan,

On Thursday, November 15, 2012 01:10:27 PM Dejan Muhamedagic wrote:
> It could be that the issue comes from the bug in fence_legacy,
> which has been resolved in the meantime. Can you try to edit that
> and replace the split command (line 86) with the following (i.e.
> just append ", 2"):
>
> ($name,$val)=split /\s*=\s*/, $opt, 2;
>
> The file location should be /usr/sbin/fence_legacy.
>
> Can you please see if that helps?

Yes, I can confirm! It works that way.
Okay, thank you, I will try to build my own fixed packages for my in-
house production use.

Greetings,

Stefan
--
Stefan Botter listreader@jsj.dyndns.org
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/