Subscribe

'Missing input: volume' was returned when invoke 'volume-size' in clustered sdk api

[ Edited ]

Hi dear,

When i invoke the 'volume-size' api in clustered perl sdk(5.2.2), it always returns 'Missing input: volume'.

 

The script line is below:

 

my $in=NaElement->new("volume-size","volume","$volumename","new-size","$newsize");

$out=$s->invoke_elem($in);

The $out->results_status() is 'failed' and results_reason() is 'Missing input: volume'.

 

I tried to use the real volume name instead of "$volumename" but not fixed, it still return the same result. (in fact i can print the $volumename).

by the way, the $s is a vserver context.

 

Anyone can help? Thanks.

 

 

 

=========Update=========

well, it works when i use the child_add_string as below. I don't know why.  It didn't need to use child_add_string in my 7mode script.

my $in=NaElement->new('volume-size');

$in->child_add_string('volume',"$volumename");

$in->child_add_string("new-size","$newsize");

$out=$s->invoke_elem($in);

Re: 'Missing input: volume' was returned when invoke 'volume-size' in clustered sdk api

I think this may be because you're using NaElement and passing more than one element name/value pair into it.  You can do that when issuing the "invoke" call against an NaServer object, but not an NaElement object.

 

These two should be functionally equivalent (warning, I haven't actually tested this code...):

 

# create the action NaElement
my $in = NaElement->new('volume-size');

# add parameters
$in->child_add_string('volume', $volumename);
$in->child_add_string('new-size', $newsize);

# execute
$out = $s->invoke_elem($in);
# all at once...
$out = $s->invoke('volume-size', 'volume', $volumename, 'new-size', $newsize);

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: 'Missing input: volume' was returned when invoke 'volume-size' in clustered sdk api

Hi Andrew,

Thanks for your reply. 

'You can do that when issuing the "invoke" call against an NaServer object, but not an NaElement object.' Is this only limit in clustered api? If yes, you really answer my question. I asked this question because it works in 7mode api when i run invoke_elem all at one.

 

my 7mode script:

#not using child_add_string and works.

my $in=NaElemt->new("quota-report-iter-start","path","/vol/vol4/home");

#here $s is NaServer object.

$out=$s->invoke_elem($in);  

 

 

Anyway, it work for me by using child_add_string and child_add. Thanks for your answer. I will quote this topic as 'resolve' if no other one reply this topic in one week.

Thank you.