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
Returns a ref to the newly created VM.
script
Run a remote script on a VM guest over SSH.
Arguments: - script - Remote script file to run on the guest via SSH - vmname - Name of the VM where the script should be run - user - SSH user name for running a remote command on the guest - password - SSH password for running a remote command on the guest - port - SSH port for running a remote command on the guest - sudo - Should sudo be used to run a remote command on the guest?
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.
transfer_vm
Transfer a VM from one xen server to another without creating an intermediate 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) 2013 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.