[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] perl Xen API How to



Mike,
        I tried encoding value as Boolean using XMLRPC::PurePerl it didn't work.
For second part I tried passing int($min) instead of $min but still didn't work.

Regards,
Rawat

-----Original Message-----
From: Mike McClurg [mailto:mike.mcclurg@xxxxxxxxxx] 
Sent: Friday, November 09, 2012 5:30 PM
To: Rawat, Vishwanath
Cc: xen-api@xxxxxxxxxxxxx
Subject: Re: [Xen-API] perl Xen API How to

On 09/11/12 11:38, Rawat, Vishwanath wrote:
> Hi,
> 
>                 I am writing some perl scripts which will perform some 
> action on Xen server. I am using RPC::XML for that.
> 

<snip>

> $xen->simple_request("VM.start", $session, $vm_ref, $start_paused, 
> $force);
> 
>         Error displayed upon execution of above code is
> 
>        $VAR1 = [
> 
>            'FIELD_TYPE_ERROR',
> 
>            'start_paused'
> 
>         ];
> 
>   start_paused option is of type Boolean so I tried all different 
> combination like True, TRUE, true, Yes, ON. Nothing seems to be working.
> Can someone let me know what is the correct way of passing Boolean 
> value to simple_request method.
> 

This looks like a Perl XMLRPC problem to me. See here:

http://search.cpan.org/~rdietrich/xmlrpc-pureperl-0.03/lib/XMLRPC/PurePerl.pm#DATATYPES:

You can use that to explicitly encode a value as a boolean. I'm not much of a 
Perl expert, so I don't know if that library is compatible with yours, but I 
guess that link should get you moving in the right direction.

For your question below, those values are supposed to be integers. I'm not sure 
why you'd be getting a field error there; maybe Perl is treating 'min' as a 
string? (Everything in Perl is a string, right? ;) )

You probably know this already, but make sure you have the XenAPI reference at 
hand when working with the API:
http://docs.vmd.citrix.com/XenServer/6.1.0/1.0/en_gb/api/

Mike

>  
> 
> 2.       I was trying to set dynamic memory range of a VM. Code is
> 
> $min = 1024*1024*1024; # (also tried 1g,1GiB)
> 
> $max = 2*1024*1024*1024;  #(also tried 2g,2GiB)
> 
> $vm_ref = <vm_opaque_ref>;
> 
>       $xen->simple_request("VM.set_memory_dynamic_range", $session, 
> $vm_ref, $min, $max);
> 
>   Getting same error as above
> 
> $VAR1 = [
> 
>            'FIELD_TYPE_ERROR',
> 
>            'min'
> 
>         ];
> 
> Would like to know what is the correct way of passing these type of values.
> 
>  
> 
> 3.       Was trying to create network on a given Xen server.
> 
> $network_name = "some_network_xenbr";
> 
> $xen->simple_request("network.create", $session, $network_name);
> 
>   Getting the following error
> 
> $VAR1 = [
> 
>           'XMLRPC_UNMARSHAL_FAILURE',
> 
>           'unbox: Element=string should contain \'struct\'',
> 
>           '<string>name-label=NACL_Test_Xenbr1352382351</string>'
> 
>         ];
> 
> $network_name should be of type "network record", which I don't know 
> what it means. Can someone help me with this.
> 
>  
> 
> Thanks a lot in advance.
> 
>  
> 
> Regards,
> 
> Rawat
> 
>  
> 
>  
> 


_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.