Commit 7a836101 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Update to support all new APIs & constants in 0.9.13

parent a996e6e4
Revision history for perl module Sys::Virt
0.9.13 2012-07-02
- Add all new APIs and constants in libvirt 0.9.13
0.9.12 2012-05-21
- Add all new constants in libvirt 0.9.12
......
......@@ -3,7 +3,7 @@ use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
my $libvirtver = "0.9.12";
my $libvirtver = "0.9.13";
my $stat = system "pkg-config --atleast-version=$libvirtver libvirt";
die "cannot run pkg-config to check libvirt version" if $stat == -1;
die "libvirt >= $libvirtver is required\n" unless $stat == 0;
......
......@@ -7,6 +7,6 @@ further details on libvirt consult its website http://libvirt.org/
The only pre-requisite for this module is libvirt itself. For
installation instructions, consult the INSTALL file.
The current minimum required version of libvirt is 0.9.12
The current minimum required version of libvirt is 0.9.13
-- End
......@@ -1762,6 +1762,27 @@ list_defined_domain_names(con, maxnames)
Safefree(names);
void
list_all_domains(con, flags=0)
virConnectPtr con;
unsigned int flags;
PREINIT:
virDomainPtr *doms;
int i, ndom;
SV *domrv;
PPCODE:
if ((ndom = virConnectListAllDomains(con, &doms, flags)) < 0)
_croak_error();
EXTEND(SP, ndom);
for (i = 0 ; i < ndom ; i++) {
domrv = sv_newmortal();
sv_setref_pv(domrv, "Sys::Virt::Domain", doms[i]);
PUSHs(domrv);
}
free(doms);
int
num_of_networks(con)
virConnectPtr con;
......@@ -3841,6 +3862,27 @@ list_snapshot_names(dom, maxnames, flags=0)
Safefree(names);
void
list_all_snapshots(dom, flags=0)
virDomainPtr dom;
unsigned int flags;
PREINIT:
virDomainSnapshotPtr *domsss;
int i, ndomss;
SV *domssrv;
PPCODE:
if ((ndomss = virDomainListAllSnapshots(dom, &domsss, flags)) < 0)
_croak_error();
EXTEND(SP, ndomss);
for (i = 0 ; i < ndomss ; i++) {
domssrv = sv_newmortal();
sv_setref_pv(domssrv, "Sys::Virt::DomainSnapshot", domsss[i]);
PUSHs(domssrv);
}
free(domsss);
int
has_current_snapshot(dom, flags=0)
virDomainPtr dom;
......@@ -5232,6 +5274,28 @@ num_of_child_snapshots(domss, flags=0)
RETVAL
int
is_current(domss, flags=0)
virDomainSnapshotPtr domss;
unsigned int flags;
CODE:
if ((RETVAL = virDomainSnapshotIsCurrent(domss, flags)) < 0)
_croak_error();
OUTPUT:
RETVAL
int
has_metadata(domss, flags=0)
virDomainSnapshotPtr domss;
unsigned int flags;
CODE:
if ((RETVAL = virDomainSnapshotHasMetadata(domss, flags)) < 0)
_croak_error();
OUTPUT:
RETVAL
void
list_child_snapshot_names(domss, maxnames, flags=0)
virDomainSnapshotPtr domss;
......@@ -5255,6 +5319,27 @@ list_child_snapshot_names(domss, maxnames, flags=0)
Safefree(names);
void
list_all_children(domss, flags=0)
virDomainSnapshotPtr domss;
unsigned int flags;
PREINIT:
virDomainSnapshotPtr *domsss;
int i, ndomss;
SV *domssrv;
PPCODE:
if ((ndomss = virDomainSnapshotListAllChildren(domss, &domsss, flags)) < 0)
_croak_error();
EXTEND(SP, ndomss);
for (i = 0 ; i < ndomss ; i++) {
domssrv = sv_newmortal();
sv_setref_pv(domssrv, "Sys::Virt::DomainSnapshot", domsss[i]);
PUSHs(domssrv);
}
free(domsss);
void
DESTROY(domss_rv)
SV *domss_rv;
......@@ -5650,6 +5735,7 @@ BOOT:
REGISTER_CONSTANT(VIR_DUMP_LIVE, DUMP_LIVE);
REGISTER_CONSTANT(VIR_DUMP_BYPASS_CACHE, DUMP_BYPASS_CACHE);
REGISTER_CONSTANT(VIR_DUMP_RESET, DUMP_RESET);
REGISTER_CONSTANT(VIR_DUMP_MEMORY_ONLY, DUMP_MEMORY_ONLY);
REGISTER_CONSTANT(VIR_DOMAIN_SAVE_BYPASS_CACHE, SAVE_BYPASS_CACHE);
REGISTER_CONSTANT(VIR_DOMAIN_SAVE_RUNNING, SAVE_RUNNING);
......@@ -5960,6 +6046,21 @@ BOOT:
REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_COPY_RAW, BLOCK_REBASE_COPY_RAW);
REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_COPY, BLOCK_REBASE_COPY);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_ACTIVE, LIST_ACTIVE);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_AUTOSTART, LIST_AUTOSTART);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT, LIST_HAS_SNAPSHOT);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_INACTIVE, LIST_INACTIVE);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE, LIST_MANAGEDSAVE);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART, LIST_NO_AUTOSTART);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE, LIST_NO_MANAGEDSAVE);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT, LIST_NO_SNAPSHOT);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_OTHER, LIST_OTHER);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_PAUSED, LIST_PAUSED);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_PERSISTENT, LIST_PERSISTENT);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_RUNNING, LIST_RUNNING);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_SHUTOFF, LIST_SHUTOFF);
REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_TRANSIENT, LIST_TRANSIENT);
stash = gv_stashpv( "Sys::Virt::DomainSnapshot", TRUE );
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, DELETE_CHILDREN);
......@@ -5979,6 +6080,9 @@ BOOT:
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS, LIST_DESCENDANTS);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_METADATA, LIST_METADATA);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, LIST_LEAVES);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, LIST_NO_LEAVES);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, LIST_NO_METADATA);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING, REVERT_RUNNING);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, REVERT_PAUSED);
......@@ -6000,6 +6104,8 @@ BOOT:
REGISTER_CONSTANT(VIR_STORAGE_POOL_DELETE_NORMAL, DELETE_NORMAL);
REGISTER_CONSTANT(VIR_STORAGE_POOL_DELETE_ZEROED, DELETE_ZEROED);
REGISTER_CONSTANT(VIR_STORAGE_XML_INACTIVE, XML_INACTIVE);
stash = gv_stashpv( "Sys::Virt::Network", TRUE );
REGISTER_CONSTANT(VIR_NETWORK_XML_INACTIVE, XML_INACTIVE);
......@@ -6013,6 +6119,7 @@ BOOT:
REGISTER_CONSTANT(VIR_STORAGE_VOL_FILE, TYPE_FILE);
REGISTER_CONSTANT(VIR_STORAGE_VOL_BLOCK, TYPE_BLOCK);
REGISTER_CONSTANT(VIR_STORAGE_VOL_DIR, TYPE_DIR);
REGISTER_CONSTANT(VIR_STORAGE_VOL_NETWORK, TYPE_DIR);
REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_NORMAL, DELETE_NORMAL);
REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_ZEROED, DELETE_ZEROED);
......
......@@ -373,8 +373,10 @@ sub create_node_device {
=item my @doms = $vmm->list_domains()
Return a list of all domains currently known to the VMM. The elements
in the returned list are instances of the L<Sys::Virt::Domain> class.
Return a list of all running domains currently known to the VMM. The elements
in the returned list are instances of the L<Sys::Virt::Domain> class. This
method requires O(n) RPC calls, so the C<list_all_domains> method is
recommended as a more efficient alternative.
=cut
......@@ -409,7 +411,8 @@ be used with the C<get_domain_by_id> method.
Return a list of all domains defined, but not currently running, on the
VMM. The elements in the returned list are instances of the
L<Sys::Virt::Domain> class.
L<Sys::Virt::Domain> class. This method requires O(n) RPC calls, so the
C<list_all_domains> method is recommended as a more efficient alternative.
=cut
......@@ -441,6 +444,13 @@ used as the C<maxnames> parameter to C<list_defined_domain_names>.
Return a list of names of all domains defined, but not currently running, on
the VMM. The names can be used with the C<get_domain_by_name> method.
=item my @doms = $vmm->list_all_domains($flags)
Return a list of all domains currently known to the VMM, whether
running or shutoff. The elements in the returned list are instances
of the L<Sys::Virt::Domain> class. The C<$flags> parameter can be
used to filter the list of return domains.
=item my @nets = $vmm->list_networks()
Return a list of all networks currently known to the VMM. The elements
......
......@@ -944,6 +944,8 @@ used with the C<lookup_snapshot_by_name>
Return a list of all snapshots currently known to the domain. The elements
in the returned list are instances of the L<Sys::Virt::DomainSnapshot> class.
This method requires O(n) RPC calls, so the C<list_all_snapshots> method is
recommended as a more efficient alternative.
=cut
......@@ -967,6 +969,14 @@ sub list_snapshots {
}
=item my @snapshots = $dom->list_all_snapshots($flags)
Return a list of all domain snapshots associated with this domain.
The elements in the returned list are instances of the
L<Sys::Virt::DomainSnapshot> class. The C<$flags> parameter can be
used to filter the list of return domain snapshots.
=item my $snapshot = $dom->get_snapshot_by_name($name)
Return the domain snapshot with a name of C<$name>. The returned object is
......@@ -2202,6 +2212,11 @@ Do not use OS I/O cache when writing core dump
Reset the virtual machine after finishing the dump
=item Sys::Virt::Domain::DUMP_MEMORY_ONLY
Only include guest RAM in the dump, not the device
state
=back
=head2 DESTROY CONSTANTS
......@@ -2343,6 +2358,70 @@ Actual balloon limit
=back
=head2 DOMAIN LIST CONSTANTS
The following constants can be used when listing domains
=over 4
=item Sys::Virt::Domain::LIST_ACTIVE
Only list domains that are currently active (running, or paused)
=item Sys::Virt::Domain::LIST_AUTOSTART
Only list domains that are set to automatically start on boot
=item Sys::Virt::Domain::LIST_HAS_SNAPSHOT
Only list domains that have a stored snapshot
=item Sys::Virt::Domain::LIST_INACTIVE
Only list domains that are currently inactive (shutoff, saved)
=item Sys::Virt::Domain::LIST_MANAGEDSAVE
Only list domains that have current managed save state
=item Sys::Virt::Domain::LIST_NO_AUTOSTART
Only list domains that are not set to automatically start on boto
=item Sys::Virt::Domain::LIST_NO_MANAGEDSAVE
Only list domains that do not have any managed save state
=item Sys::Virt::Domain::LIST_NO_SNAPSHOT
Only list domains that do not have a stored snapshot
=item Sys::Virt::Domain::LIST_OTHER
Only list domains that are not running, paused or shutoff
=item Sys::Virt::Domain::LIST_PAUSED
Only list domains that are paused
=item Sys::Virt::Domain::LIST_PERSISTENT
Only list domains which have a persistent config
=item Sys::Virt::Domain::LIST_RUNNING
Only list domains that are currently running
=item Sys::Virt::Domain::LIST_SHUTOFF
Only list domains that are currently shutoff
=item Sys::Virt::Domain::LIST_TRANSIENT
Only list domains that do not have a persistent config
=back
=head1 AUTHORS
Daniel P. Berrange <berrange@redhat.com>
......
......@@ -85,6 +85,15 @@ C<Sys::Virt::DomainSnapshot::REVERT_*> constants.
Return the parent of the snapshot, if any
=item $res = $domss->is_current()
Returns a true value if this is the current snapshot. False otherwise.
=item $res = $domss->has_metadata()
Returns a true value if this snapshot has metadata associated with
it.
=item $count = $domss->num_of_child_snapshots()
Return the number of saved snapshots which are children of this snapshot
......@@ -98,6 +107,8 @@ snapshot . The names can be used with the C<lookup_snapshot_by_name>
Return a list of all snapshots that are children of this snapshot. The elements
in the returned list are instances of the L<Sys::Virt::DomainSnapshot> class.
This method requires O(n) RPC calls, so the C<list_all_children> method is
recommended as a more efficient alternative.
=cut
......@@ -120,6 +131,12 @@ sub list_child_snapshots {
return @snapshots;
}
=item my @snapshots = $dom->list_all_children($flags)
Return a list of all domain snapshots that are children of this
snapshot. The elements in the returned list are instances of the
L<Sys::Virt::DomainSnapshot> class. The C<$flags> parameter can be
used to filter the list of return domain snapshots.
=back
......@@ -206,7 +223,15 @@ snapshot
=item Sys::Virt::DomainSnapshot::LIST_LEAVES
Only list leave nodes in the snapshot tree
Only list leaf nodes in the snapshot tree
=item Sys::Virt::DomainSnapshot::LIST_NO_LEAVES
Only list non-leaf nodes in the snapshot tree
=item Sys::Virt::DomainSnapshot::LIST_NO_METADATA
Only list snapshots without metadata
=back
......
......@@ -344,6 +344,20 @@ Overwrite existing storage pool data
=back
=head2 XML DOCUMENTS
The following constants are useful when requesting
XML for storage pools
=over 4
=item Sys::Virt::StoragePool::XML_INACTIVE
Return XML describing the inactive state of the storage
pool.
=back
=head1 AUTHORS
Daniel P. Berrange <berrange@redhat.com>
......
......@@ -37,7 +37,7 @@ BuildRequires: perl(Test::Pod::Coverage)
BuildRequires: perl(Test::CPAN::Changes)
BuildRequires: perl(XML::XPath)
BuildRequires: perl(Time::HiRes)
BuildRequires: libvirt-devel >= 0.9.12
BuildRequires: libvirt-devel >= 0.9.13
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
%description
......
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More tests => 56;
use Test::More tests => 58;
BEGIN {
use_ok('Sys::Virt');
......@@ -21,6 +21,10 @@ is($nid, 1, "1 active domain");
my @domids = $conn->list_domain_ids($nid);
is_deeply(\@domids, [1], "domain ids");
my @doms = $conn->list_all_domains();
is(int(@doms), 1, "1 active domain");
is($doms[0]->get_id, "1", "domain id matches");
my $dom = $conn->get_domain_by_id($domids[0]);
isa_ok($dom, "Sys::Virt::Domain");
......@@ -45,7 +49,7 @@ isa_ok($dom3, "Sys::Virt::Domain");
is($dom3->get_name, "test", "name");
is($dom3->get_id, "1", "id");
my @doms = $conn->list_domains();
@doms = $conn->list_domains();
is($#doms, 0, "one domain");
isa_ok($doms[0], "Sys::Virt::Domain");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment