So, in another thread there was a discussion of using cibadmin to mitigate possible concurrency issue of crm shell. I have written a test program to test that theory and unfortunately cibadmin falls down in the face of heavy concurrency also with errors such as:
Signon to CIB failed: connection failed
Init failed, could not perform requested operations
Signon to CIB failed: connection failed
Init failed, could not perform requested operations
Signon to CIB failed: connection failed
Init failed, could not perform requested operations
Effectively my test runs:
for x in $(seq 1 50); do
cibadmin -o resources -C -x resource-$x.xml &
done
My complete test program is attached for review/experimentation if you wish.
Am I doing something wrong or is this a bug? I'm using pacemaker
1.0.10-1.4.el5 for what it's worth.
Cheers,
b.
#!/bin/bash
set -e
trap 'echo "got an error"' ERR
add_resource() {
local num="$1"
local add_constraints=${2:-false}
local use_crm=${3:-false}
cat <<EOF > /tmp/resource-$num.xml
<primitive class="ocf" provider="foo" type="Target" id="resource-$num">
<meta_attributes id="resource-$num-meta_attributes">
<nvpair name="target-role" id="resource-$num-meta_attributes-target-role"
value="Stopped"/>
</meta_attributes>
<operations id="resource-$num-operations">
<op id="resource-$num-monitor-120" interval="120" name="monitor"
timeout="60"/>
<op id="resource-$num-start-0" interval="0" name="start" timeout="300"/>
<op id="resource-$num-stop-0" interval="0" name="stop" timeout="300"/>
</operations>
<instance_attributes id="resource-$num-instance_attributes">
<nvpair id="resource-$num-instance_attributes-target" name="target"
value="resource-$num"/>
</instance_attributes>
</primitive>
EOF
if ! $use_crm; then
cibadmin -o resources -C -x /tmp/resource-$num.xml
if $add_constraints; then
cibadmin -o constraints -C -X "<rsc_location
id=\"resource-$num-primary\" node=\"$(uname -n)\" rsc=\"resource-$num\"
score=\"10\"/>"
fi
else
crm configure primitive resource-$num ocf:foo:Target meta \
target-role="stopped" operations \$id="resource-$num-operations" \
op monitor interval="120" timeout="60" op start interval="0" \
timeout="300" op stop interval="0" timeout="300" params \
target="resource-$num"
fi
}
remove_resource() {
local num="$1"
cibadmin -D -X "<rsc_location id=\"resource-$num-primary\">"
cibadmin -D -X "<primitive id=\"resource-$num\">"
}
CLEAN=${CLEAN:-false}
USE_CRM=${USE_CRM:-false}
ADD_CONSTRAINTS=${ADD_CONSTRAINTS:-false}
CONCURRENT=${CONCURRENT:-false}
# not interested in conncurrent cleaning at this time
if $CLEAN; then
CONCURRENT=false
fi
for x in $(seq 1 50); do
if $CLEAN; then
remove_resource $x $AMP
else
if $CONCURRENT; then
add_resource $x $USE_CRM $ADD_CONSTRAINTS &
else
add_resource $x $USE_CRM $ADD_CONSTRAINTS
fi
fi
done
if $CONCURRENT; then
echo "waiting: $(date)"
wait
echo "done: $(date)"
fi
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Pacemaker mailing list: [email protected] http://oss.clusterlabs.org/mailman/listinfo/pacemaker Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
