WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

Re: [Xen-API] XAPI Perl howto

To: Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
Subject: Re: [Xen-API] XAPI Perl howto
From: Sergey Melnik <admin.sa@xxxxxxxxx>
Date: Mon, 27 Jun 2011 16:58:55 +0400
Cc: "xen-api@xxxxxxxxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 27 Jun 2011 06:01:01 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=NfLFwykwbc+e0c/HcflcY3whCD+B/T6RXQx8Kb3Gyb8=; b=FP/SxFVtkZOEuORAVyDAIauGv1pclVZERN1ZNXUQpr9MR8Le0nCGmVZti/GNMv8RYn aeE+bYAOmg0LzhEsYmrv6sb8vIexkAFrV8GWEdAIDA8UqAIoMTqpSTPvmSto/gGO8VZl CpZWd9rblB1YaLmhg6eImqOsG/ceTszdjlqhQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ISyFbu8wak3D1oI7hli5RIfQ6EFAx8EcYARQpTOfCaEZbiWzOT7+fnu2gAyC1gFd2B 1P8TSTrN/hQp9+bAhUYm0ouuRzTEzfY5+E3G6CpBOj9XwngI47eRmBpUn7CEbd4zrn3/ Lvxhb0yR3eaFN/YWjP39vaZhJPz372KHQZ6C0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <81A73678E76EA642801C8F2E4823AD21BC2D12C4EE@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <BANLkTikvi8m8bvmrKe+H8QGOwWe9COyKTQ@xxxxxxxxxxxxxx> <81A73678E76EA642801C8F2E4823AD21BC2D12C4E7@xxxxxxxxxxxxxxxxxxxxxxxxx> <BANLkTikDathyoZczcEypTh+EXny4Qun=gA@xxxxxxxxxxxxxx> <81A73678E76EA642801C8F2E4823AD21BC2D12C4EE@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Yeah, should do it.

Yet I just put this code here, while I'vent writen an article.

use Frontier::Client;
$server = Frontier::Client->new(url => 'http://hostname/');
$session = $server->call('session.login_with_password',
'USER','PASSWD','1.0.0');
$vmuuid = $server->call('VM.get_by_name_label',$$session{"Value"},'VMNAME');
$sruuid = 
$server->call('VM.snapshot',$$session{"Value"},$$vmuuid{'Value'}[0],'SNAPSHOT');
$isatemplate = 
$server->call('VM.set_is_a_template',$$session{"Value"},$$sruuid{'Value'},$server->boolean('0'));

By the way - a am having trouble finding the way to export a vm using Xapi.
Any ideas?

Cheers,
Sergey


On Mon, Jun 27, 2011 at 2:05 PM, Dave Scott <Dave.Scott@xxxxxxxxxxxxx> wrote:
> Hi Sergey,
>
>> Thanks, Dave.
>> It turned out an easy thing to master.
>
> Great!
>
>> How can I add my examples?
>
> Perhaps just add them to the wiki on xen.org?
>
> Cheers,
> Dave
>>
>> Cheers,
>> Sergey.
>>
>> On Fri, Jun 24, 2011 at 1:41 PM, Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
>> wrote:
>> > Hi Sergey,
>> >
>> > You can use raw XMLRPC to control an XCP pool. There aren't any perl
>> examples (maybe you could write some!) but you could probably translate
>> the python ones:
>> >
>> > http://docs.vmd.citrix.com/XenServer/4.0.1/api/client-
>> examples/python/index.html
>> >
>> > The XenAPI documentation is here:
>> >
>> > http://www.xen.org/files/XenCloud/ocamldoc/
>> >
>> > Cheers,
>> > Dave
>> >
>> >> -----Original Message-----
>> >> From: xen-api-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-api-
>> >> bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Sergey Melnik
>> >> Sent: 24 June 2011 08:53
>> >> To: xen-api@xxxxxxxxxxxxxxxxxxx
>> >> Subject: [Xen-API] XAPI Perl howto
>> >>
>> >> Hello, everyone.
>> >> I am writing a small backup management system for company XCP farm,
>> >> and had a small script written in bash & xe to do the thing.
>> >> Now the task is to move from bash to Perl.
>> >> I am not really fond of using exec everytime and looking for other
>> way
>> >> to communicate with XCP Xapi.
>> >> I ve seen python scripts, yet they are mostly for Xend, not for XCP.
>> >>
>> >> Which way should I look? Are there perl bindings for XCP?
>> >>
>> >>
>> >> Thanks,
>> >> Sergey.
>> >>
>> >> _______________________________________________
>> >> xen-api mailing list
>> >> xen-api@xxxxxxxxxxxxxxxxxxx
>> >> http://lists.xensource.com/mailman/listinfo/xen-api
>> >
>

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>