Xen::API Perl interface to the Xen RPC-XML API.
use Xen::API; my $x = Xen::API->new; my %vms = $x->list_vms my %templates = $x->list_templates my $vm = $x->create_vm(template=>'my_template',cpu=>4,memory=>'16G',vmname=>'this_vm'); my $vm_records = $x->Xen::API::VM::get_all_records();
Perl interface to the Xen RPC-XML API. Contains some shortcuts for creating, destroying, importing, and exporting VMs. All RPC API commands are available in the Xen::API:: package space. Simply replace the dots with :: and prepend Xen::API:: to the command, and execute it as if it were a perl function. Be sure to pass the Xen object as the first parameter.
Display a password prompt.
Convert suffix notation (k, M, G) to byte count. Useful for writing memory to give to VM.
shortcuts for RPC::XML explicit typecasts
Create a new instance of a Xen class.
New Xen instance.
Create a new VM.
Arguments:
- vmname - The xen name of the VM. - template - The template to base the VM from. - cpu - How many CPUs to assign - memory - How much memory to assign - hostname - The hostname to set. Works for Debian/Ubuntu and RedHat/CentOS only. - sudo - Should sudo be used to edit the hostname config file? - user - SSH user name for editing the hostname config file - password - SSH password for editing the hostname config file - port - SSH port for editing the hostname config file
Returns a ref to the newly created VM.
Gets the IP address of a VM.
Destroys a VM and its associated VDIs.
Import a VM from a xva file.
Export a VM to a xva file.
Set the is_a_template flag for a VM.
List the VMs on this Xen server.
List the templates on this Xen server.
List the physical hosts and related information.
Ben Booth, benwbooth@gmail.com
Copyright (C) 2012 by Ben Booth
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
To install Xen::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Xen::API
CPAN shell
perl -MCPAN -e shell install Xen::API
For more information on module installation, please visit the detailed CPAN module installation guide.