So this moved me past the initial error - Thanks. My initial mistake was $cmd->invoke($cmd) where $cmd was an NaElement, should have been invoke_elem ! I won't do that again.
Now I get a good return code, but the outcome is not as expected with your code or mine. When I try to add a volume to the template the object that is actualy added is "Global", obj-id 1.
volume is a valid object type for the template, and the equivalent dfm cli command does the right thing (adds the volume).
./dfm perf template attach 3 13002
Template Id: 3
Template Name: test_template
Template Status: Enabled
Template Description: test_template
Threshold Information:
Threshold Id: 7
Threshold Event Name: test_threshold
Thershold Interval: 300 seconds
Counter Information:
Counter Name: nfs_write_ops:volume
Counter Tyoe: upper
Counter Unit: per_sec
Counter Value: 1000
Applied objects:
lnn30oznp1:/lnn30f1v2 (13002)
However, using the sample code the output is the same other than:
Applied objects:
Global
The sprintf output shows the command to be:
Calling:
<perf-threshold-template-attach-objects>
<template-name-or-id>3</template-name-or-id>
<new-objects>
<object-info>
<object-id>
<obj-id>13002</obj-id.
</object-id>
<object-type?volume</object-type>
</object-info>
</new-objects>
</perf-threshold-tempalte-attach-objects>
Received:\n<results status="passed"></results>
and running it again tries to add Global again:
Error:\n<result reason="1 (1) is already attatched." status="failed" errno"13115"></results>
Any ideas?