NAME
Xen::API Perl interface to the Xen RPC-XML API.
SYNOPSIS
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();
DESCRIPTION
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.
METHODS
prompt
Display a password prompt.
mem
Convert suffix notation (k, M, G) to byte count. Useful for writing memory to give to VM.
bool true false string Int i4 i8 double datetime nil base64 array struct fault
shortcuts for RPC::XML explicit typecasts
xen
Create a new instance of a Xen class.
new($uri, $user, $password)
New Xen instance.
create_vm
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.
get_ip
Gets the IP address of a VM.
destroy_vm
Destroys a VM and its associated VDIs.
import_vm
Import a VM from a xva file.
export_vm
Export a VM to a xva file.
set_template
Set the is_a_template flag for a VM.
list_vms
List the VMs on this Xen server.
list_templates
List the templates on this Xen server.
list_hosts
List the physical hosts and related information.
AUTHOR
Ben Booth, benwbooth@gmail.com
COPYRIGHT AND LICENSE
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.