[Pacemaker] Extending CTS with other tests

Andrew Beekhof andrew at beekhof.net
Tue Nov 23 10:34:37 EST 2010


On Tue, Nov 23, 2010 at 1:19 PM, Vit Pelcak <vpelcak at suse.cz> wrote:
> Hello.
>
> I have prepared several scripts for automation of HA testing.
>
> I'd like to ask for some help with porting them into CTS, or at least part
> of them. As there is no documentation for CTS and I'm just learning Python,
> I could use some help here and there while trying to figure out how to do
> that.
>
> If I understand it right, CIB.py contains configuration of resources and new
> ones are added like:
>    stonith_sbd_resource_template = """
> <resources>
> <primitive class="stonith" id="sbd_stonith" type="external/sbd">
> <meta_attributes id="sbd_stonith-meta_attributes">
> <nvpair id="sbd_stonith-meta_attributes-target-role" name="target-role"
> value="Started"/>
> </meta_attributes>
> <operations>
> <op id="sbd_stonith-monitor-1" name="monitor" interval="120s"
> prereq="nothing" timeout="300s"/>
> <op id="sbd_stonith-monitor-2" name="start" prereq="nothing"
>  timeout="120s"/>
> <op id="sbd_stonith-monitor-3" name="stop" timeout="120s"/>
> </operations>
> </operations>
> <instance_attributes id="sbd_stonith-instance_attributes">
> <nvpair id="sbd_stonith-instance_attributes-sbd_device" name="sbd_device"
> value="%s"/>
> </instance_attributes>
> </primitive>
> </resources>"""
>
> Could this be replaced just by running crm configure .... ? I think, that is
> would be better (but I can be wrong, of course).

Yes, we do that actually.
The above xml is only for older versions of pacemaker when the shell
didnt exist.

>
> Then I would call something like:
> stonith_resource = self.stonith_sbd_resource_template % (p_value)
>
> Is that right?

yep

>
> In the process of SBD creation, I need to call:
> sbd -d $sbd_disk create
>
> on one of nodes, and
>
> sbd -d $sbd_disk allocate $(hostname)
>
> on every node. How can I do that?

CTS doesn't try to configure an entire cluster from scratch, there are
still some things that are specific to your test environment and this
looks like one of them (not all clusters have shared storage for
example)

There is scope for creating more complex test scenarios though, see
the HAE section of the same file.
In that scenario one can assume shared storage so adding sbd wouldn't
be a problem.

>
> I assume, that CTS can handle formatting of disks for correct fs easily by
> running mkfs or any other commands just as bash would. But how can I make it
> do so on one specific machine while other machines would do something else?

Not sure. It wasn't really designed for this.
Possibly you could just loop through the configured machines and treat
the first as special.




More information about the Pacemaker mailing list