The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
AUTHORS 01
Changes 0124
HACKING 6193
MANIFEST 09
META.yml 11
MYMETA.json 22
MYMETA.yml 1111
Makefile.PL 22
README 11
Virt.xs 1561145
examples/dhcp-leases.pl 013
examples/dom-fsinfo.pl 021
examples/dom-ifinfo.pl 021
examples/dom-stats.pl 029
examples/events.pl 010
examples/fs-freeze.pl 018
examples/iothreadinfo.pl 033
examples/node-alloc.pl 021
examples/node-devlist.pl 011
examples/node-info.pl 025
examples/vcpuinfo.pl 64
lib/Sys/Virt/Domain.pm 11711
lib/Sys/Virt/Error.pm 032
lib/Sys/Virt/Network.pm 088
lib/Sys/Virt/NodeDevice.pm 23
lib/Sys/Virt/StoragePool.pm 07
lib/Sys/Virt/StorageVol.pm 08
lib/Sys/Virt.pm 6157
perl-Sys-Virt.spec 11
t/030-api-coverage.t 09
t/100-connect.t 15
31 files changed (This is a version diff) 2062716
@@ -12,5 +12,6 @@ Patches contributed by:
    Stepan Kasal      <skasal-at-redhat-dot-com>
    Ludwig Nussel     <ludwig-dot-nussel-at-suse-dot-de>
    Zhe Peng          <zpeng-at-redhat-dot-com>
+   Osier Yang        <jyang-at-redhat-dot-com>
 
 -- End
@@ -1,5 +1,129 @@
 Revision history for perl module Sys::Virt
 
+1.2.16 2015-06-01
+
+ - Add support for virDomainSetUserPassword
+
+1.2.15 2015-05-05
+
+ - Add support for VIR_DOMAIN_EVENT_ID_DEVICE_ADDED
+   event callback & constants.
+ - Add JOB_DOWNTIME_NET constant
+ - Add JOB_TIME_ELAPSED_NET constant
+ - Add virDomainAddIOThread and virDomainDelIOThread API bindings
+
+1.2.14 2015-04-09
+
+ - Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE constant
+ - Add VIR_DOMAIN_CONTROL_ERROR_* constants
+ - Add virDomainGetIOThreads and virDomainPinIOThread API bindings
+ - Update the vcpuinfo.pl example to use unpack
+ - Add VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN constant
+ - Add virDomainInterfaceAddress function & constants
+ - Add VIR_DOMAIN_PAUSED_STARTING_UP constant
+ - Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
+ - Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
+ - Add VIR_FROM_THREAD constant
+
+1.2.13 2015-03-05
+
+ - Add VIR_STORAGE_VOL_CREATE_REFLINK constant
+
+1.2.12 2015-01-27
+
+ - Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING constant
+ - Add virDomainDefineXMLFlags API binding
+ - Add VIR_DOMAIN_DEFINE_VALIDATE, VIR_DOMAIN_START_VALIDATE
+   and VIR_ERR_INVALID_SCHEMA constants
+
+1.2.11 2014-12-15
+
+ - Add virDomainGetFSInfo API binding
+ - Add missed VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES constant
+ - Add new VIR_DOMAIN_TUNABLE_BLKDEV* constants
+ - Add new VIR_DOMAIN_BLOCK_IOTUNE* constants
+ - Add support for VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LIFECYCLE
+   event callbacks & constants
+ - Fix docs for Sys::Virt::Domain::get_time method
+ - Demo agent lifecycle events in example program
+
+1.2.9 2014-10-02
+
+ - Add VIR_DOMAIN_*_BANDWIDTH_BYTES constants
+ - Add VIR_DOMAIN_BLOCK_REBASE_COPY_DEV constant
+ - Add VIR_DOMAIN_JOB_STATS_COMPLETED constant
+ - Add VIR_DOMAIN_UNDEFINE_NVRAM constant
+ - Add VIR_FROM_POLKIT constant
+ - Add more VIR_DOMAIN_STATS_* constants
+ - Add more VIR_DOMAIN_JOB_* constants
+ - Add virConnectDomainEventTunable event callback & constants
+ - Add virNodeAllocPages API & constants
+ - Add VIR_MIGRATE_RDMA_PIN_ALL constant
+
+1.2.8 2014-09-05
+
+ - Add virConnectGetDomainCapabilities API
+ - Add VIR_DOMAIN_BLOCK_REBASE_RELATIVE and
+   VIR_DOMAIN_BLOCK_COMMIT_RELATIVE constants
+ - Add VIR_CONNECT_LIST_STORAGE_POOLS_ZFS constant
+ - Add virDomainOpenGraphicsFD API
+ - Add virDomainBlockCopy and related constants
+ - Add virConnectGetAllDomainStats API & constants
+
+1.2.6 2014-07-02
+
+ - Add VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT and
+   VIR_DOMAIN_BLOCK_COMMIT_ACTIVE constants
+ - Add VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 constant
+ - Add virNodeGetFreePages method
+ - Add VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE
+   and VIR_ERR_CPU_INCOMPATIBLE constants
+ - Add virNetworkGetDHCPLeases and constants
+
+1.2.5 2014-06-02
+
+ - Add VIR_DOMAIN_{REBOOT,SHUTDOWN}_PARAVIRT constants
+ - Add virDomainFSFreeze/virDomainFSThaw APIs
+ - Add virDomainSetTime/virDomainGetTime APIs
+
+1.2.4 2014-05-06
+
+ - Add VIR_FROM_FIREWALL error constant
+
+1.2.3 2014-04-07
+
+ - Add VIR_FROM_CRYPTO error constant
+ - Add VIR_MIGRATE_AUTO_CONVERGE migration constant
+ - Add virDomainCoreDumpWithFormat and its constants
+
+1.2.2 2014-03-03
+
+ - Add new domain blk I/O constants
+ - Add BHyve error code
+
+1.2.1 2014-01-21
+
+ - Add new network event APIs from libvirt 1.2.1
+ - Add new constants in libvirt 1.2.1
+
+1.2.0 2013-12-02
+
+ - Add all new constants in libvirt 1.2.0
+ - Fix reversed args for virNodeDeviceLookupSCSIHostByWWN
+
+1.1.4 2013-11-05
+
+ - Add all new constants in libvirt 1.1.4
+ - Fix impl of "list_secrets" API (RT #82072)
+
+1.1.3 2013-10-02
+
+ - Add all new APIs in libvirt 1.1.3
+
+1.1.2 2013-09-27
+
+ - Add all new constants in libvirt 1.1.2
+
 1.1.1 2013-07-30
 
  - Add all new constants/apis in libvirt 1.1.1
@@ -1,10 +1,197 @@
    Hacking on libvirt perl
    =======================
 
-After each libvirt release:
+The libvirt Perl release versions are tied directly to the libvirt C
+library release versions. ie Sys::Virt 1.2.10 will require libvirt
+version 1.2.10 or newer in order to build. We do not aim to support
+conditional compilation against versions of libvirt that are older
+than the version of Sys::Virt.
 
- - Look at src/libvirt_public.syms and find any
-   new APIs introduced
- - Look at include/libvirt/virterror.h and find
-   any new VIR_FROM_XXX and VIR_ERR_XXX constants
- - Look for any new constants in libvirt.h.in
\ No newline at end of file
+
+General changes for new APIs
+----------------------------
+
+Additions to the libvirt C API will require changes to a minimum
+of two parts of the Sys::Virt codebase.
+
+ - Virt.xs - this provides the C glue code to access the libvirt C
+   library APIs and constants from the Perl interpretor. As a general
+   rule, every new function and header file constant/enum requires an
+   addition to this file.  The exceptions are functions that are only
+   provided for the benefit of language bindings and not intended for
+   use by application code. For example the reference counting APIs
+   don't need exposing to Perl applications
+
+ - lib/ - this directory contains the pure Perl part of the binding.
+   There are separate files for each core libvirt object type
+
+     - lib/Sys/Virt.pm - mapping for virConnectPtr
+     - lib/Sys/Virt/Domain.pm - mapping for virDomainPtr
+     - lib/Sys/Virt/Error.pm - mapping for virErrorPtr
+     - lib/Sys/Virt/Event.pm - mapping for virEventPtr
+     - lib/Sys/Virt/Interface.pm - mapping for virInterfacePtr
+     - lib/Sys/Virt/Network.pm - mapping for virNetworkPtr
+     - lib/Sys/Virt/NodeDevice.pm - mapping for virNodeDevicePtr
+     - lib/Sys/Virt/NWFilter.pm - mapping for virNWFilterPtr
+     - lib/Sys/Virt/Secret.pm - mapping for virSecretPtr
+     - lib/Sys/Virt/StoragePool.pm - mapping for virStoragePoolPtr
+     - lib/Sys/Virt/StorageVol.pm - mapping for virStorageVolPtr
+     - lib/Sys/Virt/Stream.pm - mapping for virStreamPtr
+
+   There is rarely a need to write Perl code in the .pm modules, as
+   the mapping in the Virt.xs file is usually sufficient. As such
+   the primary purpose of the .pm modules is to hold the POD inline
+   documentation. Every function and constants is required to have
+   full API documentation provided
+
+There are a number of unit tests available in the t/ directory which
+assist in creation of new APIs.
+
+ - t/010-pod-coverage.t - ensures that every Perl method and constant
+   has POD documentation present
+ - t/030-api-coverage.t - ensures that every C library method/constant
+   in the libvirt-api.xml file has corresponding code in the Virt.xs.
+   Certain functions can be blacklisted in t/030-api-coverage.t as not
+   needed mapping to Perl. This only runs if TEST_MAINTAINER=1 is set.
+ - t/*.t - the other files mostly do functional testing against the
+   test:///default API - if the new function has support in the test
+   driver, then suitable additions should be made
+
+If use of the API is not obvious, it is often worth providing a small
+example program in the examples/ directory. These examples are also
+useful when adding APIs to ensure that they are operating correctly,
+if it wasn't possible to unit test them with test:///default.
+
+Every addition / change to the API must be documented in the Changes
+file.
+
+
+New API addition workflow
+-------------------------
+
+When the libvirt C library is changed, the following workflow is an
+effective way to update the Perl binding.
+
+ - Build the libvirt C library
+
+    # cd $HOME/src/libvirt
+    # ./autogen.sh --system
+    # make
+
+ - Configure & build the Sys::Virt module to build against the just
+   built libvirt library
+
+    # cd $HOME/src/libvirt-perl
+    # ../libvirt/run perl Makefile.PL
+    # ../libvirt/run make
+
+ - Run the test suite to identify which new functions/constants need
+   handling
+
+    # ../libvirt/run make test TEST_MAINTAINER=1
+
+ - For each missing item reported in the test suite...
+
+     - Edit Virt.xs to add the C binding
+     - Edit lib/*.pm to add the POD documentation (and occassionally Perl glue code)
+     - Edit Changes to document the addition
+     - Run the test suite (without maintainer mode) to verify POD docs
+         # ../libvirt/run make test
+     - Optionally add to one of the t/*.t test cases
+     - Optionally add demo to examples/
+     - Commit the changes to GIT
+
+
+Understanding Virt.xs glue layer
+--------------------------------
+
+The Perl XS glue (Virt.xs) is a pretty bizarre language, that mostly
+looks like C but is actually run through a Perl specific preprocessor
+to turn it into real C code. Learning and understanding XS code well
+is a really difficult task, but fortunately such knowledge is rarely
+required in order to add new APIs to the Perl Sys::Virt code.
+
+When adding constants just look for the REGISTER_CONSTANT() macro
+at the end of Virt.xs. Make sure that the constant is registered against
+the correct Sys::Virt::XXXX object namespace - look for the adjacent
+'gv_stashpv' calls to see which namespace is currently in effect.
+
+When adding methods, you must again make sure they are put in the
+correct object namespace. For methods, look for the statements
+that look like:
+
+   MODULE = Sys::Virt::NWFilter  PACKAGE = Sys::Virt::NWFilter
+
+these indicate the start of a namespace for the object in question.
+When implementing the binding for a method, if not already familiar
+with XS code, the best technique is to just do cut+paste programming.
+Find an existing libvirt API call that has the same kind of API
+signature as the new API. Then just copy the XS code for that method
+and tweak the parameter names as needed.
+
+Async event callbacks have a little bit of special handling too. The
+callbacks are all implemented as static methods at the very top of
+the Virt.XS file. Look for method names like _domain_event_pmsuspend_callback
+and just copy the code for an existing callback method that has a similar
+set of parameters to the new callback.
+
+Once the callback is implemented look for the domain_event_register_any()
+or network_event_register_any() methods and extend the switch() statement
+so that it maps the event ID constant to your new callback.
+
+
+Making new releases
+-------------------
+
+The Sys::Virt releases are hosted on the Perl project CPAN infrastructure
+rather than libvirt.org
+
+ 1. Build the new release of libvirt as an RPM and install it on the
+    local machine.
+
+ 2. Set the release date in the Changes file and commit the change
+
+ 3. Tag the release with a GPG signed tag using vX.Y.Z syntax for
+    the tag name
+
+     git tag -s -m 'Release 1.2.14' v1.2.14
+
+ 4. Clone the repository or run 'git clean -x -f -d' to ensure a
+    100% pristine state
+
+ 5. Run autobuild.sh to test the full test suite and generate local
+    RPMs. This results in Sys-Virt-1.2.14.tar.gz file being created
+
+ 6. Take the src.rpm file that was just generated by autobuild.sh
+    and run a scratch build against Fedora rawhide
+
+      # cd $HOME/src/fedora/perl-Sys-Virt
+      # fedpkg scratch-build --srpm /path/to/src/rpm/file
+
+ 7. Push the Changes commit and tag to GIT master
+
+      # git push
+      # git push origin v1.2.14
+
+If there is a failure at any step then this must be corrected
+as follows
+
+  a. Delete the signed release tag
+
+       git tag -d v1.2.14
+
+  b. Fix whatever the problem was and update the Changes file
+     if appropriate
+
+  c. Go to release process step 3 again.
+
+
+Assuming the release has now been made, the Sys-Virt-1.2.14.tar.gz
+file should be uploaded to CPAN using https://pause.cpan.org form.
+The upload is currently done by Daniel Berrange (username DANBERR).
+
+Now open the tree for the next release version by editing the files
+lib/Sys/Virt.pm, README, Makefile.PL to update the version number
+listed. Also edit Changes to add a placeholder entry for the new
+release number. Run 'make test' to ensure Changes file is syntax
+valid.
@@ -2,12 +2,21 @@ AUTHORS
 Changes
 examples/auth.pl
 examples/devices.pl
+examples/dhcp-leases.pl
+examples/dom-fsinfo.pl
+examples/dom-ifinfo.pl
+examples/dom-stats.pl
 examples/dump-info.pl
 examples/dump-xml.pl
 examples/emulator-pin.pl
 examples/events.pl
+examples/fs-freeze.pl
 examples/hv-stat.pl
+examples/iothreadinfo.pl
+examples/node-alloc.pl
 examples/node-cpu.pl
+examples/node-devlist.pl
+examples/node-info.pl
 examples/node-ksm.pl
 examples/open-console.pl
 examples/save-restore.pl
@@ -1,7 +1,7 @@
 --- #YAML:1.0
 name:         Sys-Virt
 abstract:     Extension for the libvirt library
-version:      1.1.1
+version:      1.2.16
 author:
   - Daniel P. Berrange <dan@berrange.com>
 license: perl
@@ -4,7 +4,7 @@
       "Daniel Berrange <dan@berrange.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921",
+   "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001",
    "license" : [
       "unknown"
    ],
@@ -42,5 +42,5 @@
       }
    },
    "release_status" : "stable",
-   "version" : "v1.1.1"
+   "version" : "v1.2.16"
 }
@@ -3,25 +3,25 @@ abstract: unknown
 author:
   - 'Daniel Berrange <dan@berrange.com>'
 build_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921'
+generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001'
 license: unknown
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Sys-Virt
 no_index:
   directory:
     - t
     - inc
 requires:
-  Test::CPAN::Changes: 0
-  Test::More: 0
-  Test::Pod: 0
-  Test::Pod::Coverage: 0
-  Time::HiRes: 0
-  XML::XPath: 0
-version: v1.1.1
+  Test::CPAN::Changes: '0'
+  Test::More: '0'
+  Test::Pod: '0'
+  Test::Pod::Coverage: '0'
+  Time::HiRes: '0'
+  XML::XPath: '0'
+version: v1.2.16
@@ -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 = "1.1.1";
+my $libvirtver = "1.2.16";
 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;
@@ -20,7 +20,7 @@ my $gccflags = "-W -Waddress -Wall -Warray-bounds -Wattributes \\
  -Wformat-extra-args -Wformat-security -Wformat-y2k \\
  -Wformat-zero-length -Wformat=2 -Wfree-nonheap-object \\
  -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration \\
- -Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast \\
+ -Wimplicit-int -Winit-self -Wint-to-pointer-cast \\
  -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init \\
  -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmissing-braces \\
  -Wmissing-declarations -Wmissing-field-initializers \\
@@ -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 1.1.1
+The current minimum required version of libvirt is 1.2.16
 
 -- End
@@ -1,7 +1,7 @@
 /* -*- c -*-
  *
- * Copyright (C) 2006 Red Hat
- * Copyright (C) 2006-2007 Daniel P. Berrange
+ * Copyright (C) 2006-2014 Red Hat
+ * Copyright (C) 2006-2014 Daniel P. Berrange
  *
  * This program is free software; You can redistribute it and/or modify
  * it under either:
@@ -158,6 +158,120 @@ _populate_constant_ull(HV *stash, const char *name, unsigned long long val)
 #define REGISTER_CONSTANT_STR(name, key) _populate_constant_str(stash, #key, name)
 #define REGISTER_CONSTANT_ULL(name, key) _populate_constant_ull(stash, #key, name)
 
+static HV *
+vir_typed_param_to_hv(virTypedParameter *params, int nparams)
+{
+    HV *ret = (HV *)sv_2mortal((SV*)newHV());
+    unsigned int i;
+    const char *field;
+    STRLEN val_length;
+
+    for (i = 0 ; i < nparams ; i++) {
+        SV *val = NULL;
+
+        switch (params[i].type) {
+        case VIR_TYPED_PARAM_INT:
+            val = newSViv(params[i].value.i);
+            break;
+
+        case VIR_TYPED_PARAM_UINT:
+            val = newSViv((int)params[i].value.ui);
+            break;
+
+        case VIR_TYPED_PARAM_LLONG:
+            val = virt_newSVll(params[i].value.l);
+            break;
+
+        case VIR_TYPED_PARAM_ULLONG:
+            val = virt_newSVull(params[i].value.ul);
+            break;
+
+        case VIR_TYPED_PARAM_DOUBLE:
+            val = newSVnv(params[i].value.d);
+            break;
+
+        case VIR_TYPED_PARAM_BOOLEAN:
+            val = newSViv(params[i].value.b);
+            break;
+
+        case VIR_TYPED_PARAM_STRING:
+            val_length = strlen(params[i].value.s);
+            val = newSVpv(params[i].value.s, val_length);
+            break;
+
+        }
+
+        field = params[i].field;
+        (void)hv_store(ret, field, strlen(params[i].field), val, 0);
+    }
+
+    return ret;
+}
+
+
+static int
+vir_typed_param_from_hv(HV *newparams, virTypedParameter *params, int nparams)
+{
+    unsigned int i;
+    char * ptr;
+    STRLEN len;
+
+    /* We only want to set parameters which we're actually changing
+     * so here we figure out which elements of 'params' we need to
+     * update, and overwrite the others
+     */
+    for (i = 0 ; i < nparams ;) {
+        if (!hv_exists(newparams, params[i].field, strlen(params[i].field))) {
+            if ((nparams-i) > 1)
+                memmove(params+i, params+i+1, sizeof(*params)*(nparams-(i+1)));
+            nparams--;
+            continue;
+        }
+
+        i++;
+    }
+
+    for (i = 0 ; i < nparams ; i++) {
+        SV **val;
+
+        val = hv_fetch (newparams, params[i].field, strlen(params[i].field), 0);
+
+        switch (params[i].type) {
+        case VIR_TYPED_PARAM_INT:
+            params[i].value.i = SvIV(*val);
+            break;
+
+        case VIR_TYPED_PARAM_UINT:
+            params[i].value.ui = SvIV(*val);
+            break;
+
+        case VIR_TYPED_PARAM_LLONG:
+            params[i].value.l = virt_SvIVll(*val);
+            break;
+
+        case VIR_TYPED_PARAM_ULLONG:
+            params[i].value.ul = virt_SvIVull(*val);
+            break;
+
+        case VIR_TYPED_PARAM_DOUBLE:
+            params[i].value.d = SvNV(*val);
+            break;
+
+        case VIR_TYPED_PARAM_BOOLEAN:
+            params[i].value.b = SvIV(*val);
+            break;
+
+        case VIR_TYPED_PARAM_STRING:
+            ptr = SvPV(*val, len);
+            params[i].value.s = (char *)ptr;
+            break;
+        }
+    }
+
+    return nparams;
+}
+
+
 static int
 _domain_event_lifecycle_callback(virConnectPtr con,
                                  virDomainPtr dom,
@@ -744,6 +858,44 @@ _domain_event_balloonchange_callback(virConnectPtr con,
 
 
 static int
+_domain_event_device_added_callback(virConnectPtr con,
+                                    virDomainPtr dom,
+                                    const char *devAlias,
+                                    void *opaque)
+{
+    AV *data = opaque;
+    SV **self;
+    SV **cb;
+    SV *domref;
+    dSP;
+
+    self = av_fetch(data, 0, 0);
+    cb = av_fetch(data, 1, 0);
+
+    SvREFCNT_inc(*self);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(*self);
+    domref = sv_newmortal();
+    sv_setref_pv(domref, "Sys::Virt::Domain", (void*)dom);
+    virDomainRef(dom);
+    XPUSHs(domref);
+    XPUSHs(sv_2mortal(newSVpv(devAlias, 0)));
+    PUTBACK;
+
+    call_sv(*cb, G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    return 0;
+}
+
+
+static int
 _domain_event_device_removed_callback(virConnectPtr con,
                                       virDomainPtr dom,
                                       const char *devAlias,
@@ -781,6 +933,165 @@ _domain_event_device_removed_callback(virConnectPtr con,
 }
 
 
+static int
+_domain_event_tunable_callback(virConnectPtr con,
+			       virDomainPtr dom,
+			       virTypedParameterPtr params,
+			       size_t nparams,
+			       void *opaque)
+{
+    AV *data = opaque;
+    SV **self;
+    SV **cb;
+    HV *params_hv;
+    SV *domref;
+    dSP;
+
+    self = av_fetch(data, 0, 0);
+    cb = av_fetch(data, 1, 0);
+
+    SvREFCNT_inc(*self);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(*self);
+    domref = sv_newmortal();
+    sv_setref_pv(domref, "Sys::Virt::Domain", (void*)dom);
+    virDomainRef(dom);
+
+    params_hv = vir_typed_param_to_hv(params, nparams);
+
+    XPUSHs(domref);
+    XPUSHs(newRV(( SV*)params_hv));
+    PUTBACK;
+
+    call_sv(*cb, G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    return 0;
+}
+
+
+static int
+_domain_event_agent_lifecycle_callback(virConnectPtr con,
+				       virDomainPtr dom,
+				       int state,
+				       int reason,
+				       void *opaque)
+{
+    AV *data = opaque;
+    SV **self;
+    SV **cb;
+    SV *domref;
+    dSP;
+
+    self = av_fetch(data, 0, 0);
+    cb = av_fetch(data, 1, 0);
+
+    SvREFCNT_inc(*self);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(*self);
+    domref = sv_newmortal();
+    sv_setref_pv(domref, "Sys::Virt::Domain", (void*)dom);
+    virDomainRef(dom);
+    XPUSHs(domref);
+    XPUSHs(sv_2mortal(newSViv(state)));
+    XPUSHs(sv_2mortal(newSViv(reason)));
+    PUTBACK;
+
+    call_sv(*cb, G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    return 0;
+}
+
+
+static int
+_network_event_lifecycle_callback(virConnectPtr con,
+				  virNetworkPtr net,
+				  int event,
+				  int detail,
+				  void *opaque)
+{
+    AV *data = opaque;
+    SV **self;
+    SV **cb;
+    SV *netref;
+    dSP;
+
+    self = av_fetch(data, 0, 0);
+    cb = av_fetch(data, 1, 0);
+
+    SvREFCNT_inc(*self);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(*self);
+    netref = sv_newmortal();
+    sv_setref_pv(netref, "Sys::Virt::Network", (void*)net);
+    virNetworkRef(net);
+    XPUSHs(netref);
+    XPUSHs(sv_2mortal(newSViv(event)));
+    XPUSHs(sv_2mortal(newSViv(detail)));
+    PUTBACK;
+
+    call_sv(*cb, G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    return 0;
+}
+
+
+static int
+_network_event_generic_callback(virConnectPtr con,
+				virNetworkPtr net,
+				void *opaque)
+{
+    AV *data = opaque;
+    SV **self;
+    SV **cb;
+    SV *netref;
+    dSP;
+
+    self = av_fetch(data, 0, 0);
+    cb = av_fetch(data, 1, 0);
+
+    SvREFCNT_inc(*self);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(*self);
+    netref = sv_newmortal();
+    sv_setref_pv(netref, "Sys::Virt::Network", (void*)net);
+    virNetworkRef(net);
+    XPUSHs(netref);
+    PUTBACK;
+
+    call_sv(*cb, G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    return 0;
+}
+
+
 static void
 _domain_event_free(void *opaque)
 {
@@ -790,6 +1101,14 @@ _domain_event_free(void *opaque)
 
 
 static void
+_network_event_free(void *opaque)
+{
+  SV *sv = opaque;
+  SvREFCNT_dec(sv);
+}
+
+
+static void
 _close_callback(virConnectPtr con,
                 int reason,
                 void *opaque)
@@ -1274,120 +1593,6 @@ _stream_recv_all_sink(virStreamPtr st,
 }
 
 
-static HV *
-vir_typed_param_to_hv(virTypedParameter *params, int nparams)
-{
-    HV *ret = (HV *)sv_2mortal((SV*)newHV());
-    unsigned int i;
-    const char *field;
-    STRLEN val_length;
-
-    for (i = 0 ; i < nparams ; i++) {
-        SV *val = NULL;
-
-        switch (params[i].type) {
-        case VIR_TYPED_PARAM_INT:
-            val = newSViv(params[i].value.i);
-            break;
-
-        case VIR_TYPED_PARAM_UINT:
-            val = newSViv((int)params[i].value.ui);
-            break;
-
-        case VIR_TYPED_PARAM_LLONG:
-            val = virt_newSVll(params[i].value.l);
-            break;
-
-        case VIR_TYPED_PARAM_ULLONG:
-            val = virt_newSVull(params[i].value.ul);
-            break;
-
-        case VIR_TYPED_PARAM_DOUBLE:
-            val = newSVnv(params[i].value.d);
-            break;
-
-        case VIR_TYPED_PARAM_BOOLEAN:
-            val = newSViv(params[i].value.b);
-            break;
-
-        case VIR_TYPED_PARAM_STRING:
-            val_length = strlen(params[i].value.s);
-            val = newSVpv(params[i].value.s, val_length);
-            break;
-
-        }
-
-        field = params[i].field;
-        (void)hv_store(ret, field, strlen(params[i].field), val, 0);
-    }
-
-    return ret;
-}
-
-
-static int
-vir_typed_param_from_hv(HV *newparams, virTypedParameter *params, int nparams)
-{
-    unsigned int i;
-    char * ptr;
-    STRLEN len;
-
-    /* We only want to set parameters which we're actually changing
-     * so here we figure out which elements of 'params' we need to
-     * update, and overwrite the others
-     */
-    for (i = 0 ; i < nparams ;) {
-        if (!hv_exists(newparams, params[i].field, strlen(params[i].field))) {
-            if ((nparams-i) > 1)
-                memmove(params+i, params+i+1, sizeof(*params)*(nparams-(i+1)));
-            nparams--;
-            continue;
-        }
-
-        i++;
-    }
-
-    for (i = 0 ; i < nparams ; i++) {
-        SV **val;
-
-        val = hv_fetch (newparams, params[i].field, strlen(params[i].field), 0);
-
-        switch (params[i].type) {
-        case VIR_TYPED_PARAM_INT:
-            params[i].value.i = SvIV(*val);
-            break;
-
-        case VIR_TYPED_PARAM_UINT:
-            params[i].value.ui = SvIV(*val);
-            break;
-
-        case VIR_TYPED_PARAM_LLONG:
-            params[i].value.l = virt_SvIVll(*val);
-            break;
-
-        case VIR_TYPED_PARAM_ULLONG:
-            params[i].value.ul = virt_SvIVull(*val);
-            break;
-
-        case VIR_TYPED_PARAM_DOUBLE:
-            params[i].value.d = SvNV(*val);
-            break;
-
-        case VIR_TYPED_PARAM_BOOLEAN:
-            params[i].value.b = SvIV(*val);
-            break;
-
-        case VIR_TYPED_PARAM_STRING:
-            ptr = SvPV(*val, len);
-            params[i].value.s = (char *)ptr;
-            break;
-        }
-    }
-
-    return nparams;
-}
-
-
 MODULE = Sys::Virt  PACKAGE = Sys::Virt
 
 PROTOTYPES: ENABLE
@@ -1681,10 +1886,11 @@ get_node_cells_free_memory(con, start, end)
       int end;
 PREINIT:
       unsigned long long *mem;
-      int i, num;
+      int i, num, ncells;
  PPCODE:
-      Newx(mem, end-start, unsigned long long);
-      if ((num = virNodeGetCellsFreeMemory(con, mem, start, end)) < 0) {
+      ncells = (end - start) + 1;
+      Newx(mem, ncells, unsigned long long);
+      if ((num = virNodeGetCellsFreeMemory(con, mem, start, ncells)) < 0) {
           Safefree(mem);
           _croak_error();
       }
@@ -1696,6 +1902,98 @@ PREINIT:
       Safefree(mem);
 
 
+void
+get_node_free_pages(con, pagesizes, start, end, flags=0)
+     virConnectPtr con;
+     SV *pagesizes;
+     int start;
+     int end;
+     unsigned int flags;
+PREINIT:
+     AV *pagesizeslist;
+     unsigned int *pages;
+     unsigned int npages;
+     unsigned long long *counts;
+     int ncells;
+     int i, j;
+ PPCODE:
+     ncells = (end - start) + 1;
+     pagesizeslist = (AV *)SvRV(pagesizes);
+     npages = av_len(pagesizeslist) + 1;
+     Newx(pages, npages, unsigned int);
+     for (i = 0; i < npages; i++) {
+         SV **pagesize = av_fetch(pagesizeslist, i, 0);
+	 pages[i] = SvIV(*pagesize);
+     }
+
+     Newx(counts, npages * ncells, unsigned long long);
+
+     if (virNodeGetFreePages(con, npages, pages, start,
+			     ncells, counts, flags) < 0) {
+         Safefree(counts);
+         Safefree(pages);
+         _croak_error();
+     }
+     EXTEND(SP, ncells);
+     for (i = 0; i < ncells; i++) {
+         HV *rec = newHV();
+	 HV *prec = newHV();
+	 (void)hv_store(rec, "cell", 4, newSViv(start + i), 0);
+	 (void)hv_store(rec, "pages", 5, newRV_noinc((SV *)prec), 0);
+
+	 for (j = 0; j < npages; j++) {
+	     (void)hv_store_ent(prec,
+				newSViv(pages[j]),
+				virt_newSVull(counts[(i * npages) + j]),
+				0);
+	 }
+	 PUSHs(newRV_noinc((SV *)rec));
+     }
+     Safefree(counts);
+     Safefree(pages);
+
+void
+node_alloc_pages(con, pages, start, end, flags=0)
+      virConnectPtr con;
+      SV *pages;
+      int start;
+      int end;
+      unsigned int flags;
+PREINIT:
+      AV *pageslist;
+      unsigned int npages;
+      unsigned int *pagesizes;
+      unsigned long long *pagecounts;
+      unsigned int ncells;
+      unsigned int i;
+  PPCODE:
+      ncells = (end - start) + 1;
+      pageslist = (AV *)SvRV(pages);
+      npages = av_len(pageslist) + 1;
+
+      Newx(pagesizes, npages, unsigned int);
+      Newx(pagecounts, npages, unsigned long long);
+      for (i = 0; i < npages; i++) {
+          SV **pageinforv = av_fetch(pageslist, i, 0);
+	  AV *pageinfo = (AV*)SvRV(*pageinforv);
+          SV **pagesize = av_fetch(pageinfo, 0, 0);
+          SV **pagecount = av_fetch(pageinfo, 1, 0);
+
+          pagesizes[i] = SvIV(*pagesize);
+	  pagecounts[i] = virt_SvIVull(*pagecount);
+      }
+
+      if (virNodeAllocPages(con, npages, pagesizes, pagecounts,
+			    start, ncells, flags) < 0) {
+          Safefree(pagesizes);
+          Safefree(pagecounts);
+	  _croak_error();
+      }
+
+      Safefree(pagesizes);
+      Safefree(pagecounts);
+
+
 HV *
 get_node_cpu_stats(con, cpuNum=VIR_NODE_CPU_STATS_ALL_CPUS, flags=0)
       virConnectPtr con;
@@ -1724,6 +2022,8 @@ PREINIT:
               (void)hv_store (RETVAL, "idle", 4, virt_newSVull(params[i].value), 0);
           } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_IOWAIT) == 0) {
               (void)hv_store (RETVAL, "iowait", 6, virt_newSVull(params[i].value), 0);
+          } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_INTR) == 0) {
+              (void)hv_store (RETVAL, "intr", 4, virt_newSVull(params[i].value), 0);
           } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_UTILIZATION) == 0) {
               (void)hv_store (RETVAL, "utilization", 11, virt_newSVull(params[i].value), 0);
           }
@@ -1859,6 +2159,41 @@ PREINIT:
   OUTPUT:
       RETVAL
 
+SV *
+get_domain_capabilities(con, emulatorsv, archsv, machinesv, virttypesv, flags=0)
+      virConnectPtr con;
+      SV *emulatorsv;
+      SV *archsv;
+      SV *machinesv;
+      SV *virttypesv;
+      unsigned int flags;
+PREINIT:
+      char *emulator = NULL;
+      char *arch = NULL;
+      char *machine = NULL;
+      char *virttype = NULL;
+      char *xml;
+   CODE:
+      if (SvOK(emulatorsv))
+	  emulator = SvPV_nolen(emulatorsv);
+      if (SvOK(archsv))
+	  arch = SvPV_nolen(archsv);
+      if (SvOK(machinesv))
+	  machine = SvPV_nolen(machinesv);
+      if (SvOK(virttypesv))
+	  virttype = SvPV_nolen(virttypesv);
+
+      if (!(xml = virConnectGetDomainCapabilities(con,
+						  emulator, arch,
+						  machine, virttype,
+						  flags)))
+          _croak_error();
+
+      RETVAL = newSVpv(xml, 0);
+      free(xml);
+  OUTPUT:
+      RETVAL
+
 
 SV *
 compare_cpu(con, xml, flags=0)
@@ -1907,6 +2242,27 @@ PREINIT:
   OUTPUT:
       RETVAL
 
+void
+get_cpu_model_names(con, arch, flags=0)
+      virConnectPtr con;
+      char *arch;
+      unsigned int flags;
+PREINIT:
+      int nnames;
+      int i;
+      char **names = NULL;
+  PPCODE:
+      if ((nnames = virConnectGetCPUModelNames(con, arch, &names, flags)) < 0)
+          _croak_error();
+
+      EXTEND(SP, nnames);
+      for (i = 0 ; i < nnames ; i++) {
+          PUSHs(sv_2mortal(newSVpv(names[i], 0)));
+          free(names[i]);
+      }
+      free(names);
+
+
 
 int
 get_max_vcpus(con, type)
@@ -2426,12 +2782,72 @@ list_nwfilter_names(con, maxnames)
           Safefree(names);
           _croak_error();
       }
-      EXTEND(SP, nnet);
-      for (i = 0 ; i < nnet ; i++) {
-          PUSHs(sv_2mortal(newSVpv(names[i], 0)));
-          free(names[i]);
+      EXTEND(SP, nnet);
+      for (i = 0 ; i < nnet ; i++) {
+          PUSHs(sv_2mortal(newSVpv(names[i], 0)));
+          free(names[i]);
+      }
+      Safefree(names);
+
+
+void get_all_domain_stats(con, stats, doms_sv=&PL_sv_undef, flags=0)
+      virConnectPtr con;
+      unsigned int stats;
+      SV *doms_sv;
+      unsigned int flags;
+ PREINIT:
+      AV *doms_av;
+      int ndoms;
+      int nstats;
+      int i;
+      virDomainPtr *doms = NULL;
+      virDomainStatsRecordPtr *statsrec = NULL;
+   PPCODE:
+
+      if (SvOK(doms_sv)) {
+	  doms_av = (AV*)SvRV(doms_sv);
+	  ndoms = av_len(doms_av) + 1;
+	  fprintf(stderr, "Len %d\n", ndoms);
+      } else {
+          ndoms = 0;
+      }
+
+      if (ndoms) {
+	  Newx(doms, ndoms + 1, virDomainPtr);
+
+	  for (i = 0 ; i < ndoms ; i++) {
+	      SV **dom = av_fetch(doms_av, i, 0);
+	      doms[i] = (virDomainPtr)SvIV((SV*)SvRV(*dom));
+	  }
+	  doms[ndoms] = NULL;
+
+	  if ((nstats = virDomainListGetStats(doms, stats, &statsrec, flags)) < 0) {
+	    Safefree(doms);
+	    _croak_error();
+	  }
+      } else {
+          doms = NULL;
+
+	  if ((nstats = virConnectGetAllDomainStats(con, stats, &statsrec, flags)) < 0) {
+	    Safefree(doms);
+	    _croak_error();
+	  }
       }
-      Safefree(names);
+
+      EXTEND(SP, nstats);
+      for (i = 0 ; i < nstats ; i++) {
+	HV *rec = newHV();
+	SV *dom = sv_newmortal();
+	HV *data = vir_typed_param_to_hv(statsrec[i]->params,
+					 statsrec[i]->nparams);
+	sv_setref_pv(dom, "Sys::Virt::Domain", statsrec[i]->dom);
+	virDomainRef(statsrec[i]->dom);
+	hv_store(rec, "dom", 3, SvREFCNT_inc(dom), 0);
+	hv_store(rec, "data", 4, newRV((SV*)data), 0);
+	PUSHs(newRV_noinc((SV*)rec));
+      }
+      virDomainStatsRecordListFree(statsrec);
+      Safefree(doms);
 
 
 SV *
@@ -2543,6 +2959,9 @@ PREINIT:
       case VIR_DOMAIN_EVENT_ID_BLOCK_JOB:
           callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_job_callback);
           break;
+      case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2:
+          callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_job_callback);
+          break;
       case VIR_DOMAIN_EVENT_ID_DISK_CHANGE:
           callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_disk_change_callback);
           break;
@@ -2561,9 +2980,18 @@ PREINIT:
       case VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE:
           callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_balloonchange_callback);
           break;
+      case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED:
+          callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_added_callback);
+          break;
       case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED:
           callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_removed_callback);
           break;
+      case VIR_DOMAIN_EVENT_ID_TUNABLE:
+          callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_tunable_callback);
+          break;
+      case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE:
+          callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_agent_lifecycle_callback);
+          break;
       default:
           callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback);
           break;
@@ -2588,6 +3016,53 @@ domain_event_deregister_any(con, callbackID)
       virConnectDomainEventDeregisterAny(con, callbackID);
 
 
+int
+network_event_register_any(conref, netref, eventID, cb)
+      SV* conref;
+      SV* netref;
+      int eventID;
+      SV* cb;
+PREINIT:
+      AV *opaque;
+      virConnectPtr con;
+      virNetworkPtr net;
+      virConnectNetworkEventGenericCallback callback;
+    CODE:
+      con = (virConnectPtr)SvIV((SV*)SvRV(conref));
+      if (SvROK(netref)) {
+          net = (virNetworkPtr)SvIV((SV*)SvRV(netref));
+      } else {
+          net = NULL;
+      }
+
+      switch (eventID) {
+      case VIR_NETWORK_EVENT_ID_LIFECYCLE:
+          callback = VIR_NETWORK_EVENT_CALLBACK(_network_event_lifecycle_callback);
+          break;
+      default:
+          callback = VIR_NETWORK_EVENT_CALLBACK(_network_event_generic_callback);
+          break;
+      }
+
+      opaque = newAV();
+      SvREFCNT_inc(cb);
+      SvREFCNT_inc(conref);
+      av_push(opaque, conref);
+      av_push(opaque, cb);
+      if ((RETVAL = virConnectNetworkEventRegisterAny(con, net, eventID, callback, opaque, _network_event_free)) < 0)
+          _croak_error();
+OUTPUT:
+      RETVAL
+
+
+void
+network_event_deregister_any(con, callbackID)
+      virConnectPtr con;
+      int callbackID;
+ PPCODE:
+      virConnectNetworkEventDeregisterAny(con, callbackID);
+
+
 void
 register_close_callback(conref, cb)
       SV* conref;
@@ -2708,12 +3183,18 @@ _create_with_files(con, xml, fdssv, flags=0)
 
 
 virDomainPtr
-_define_xml(con, xml)
+_define_xml(con, xml, flags=0)
       virConnectPtr con;
       const char *xml;
+      unsigned int flags;
     CODE:
-      if (!(RETVAL = virDomainDefineXML(con, xml)))
-          _croak_error();
+      if (flags) {
+	  if (!(RETVAL = virDomainDefineXMLFlags(con, xml, flags)))
+	      _croak_error();
+      } else {
+	  if (!(RETVAL = virDomainDefineXML(con, xml)))
+	      _croak_error();
+      }
   OUTPUT:
       RETVAL
 
@@ -2971,13 +3452,24 @@ managed_save_remove(dom, flags=0)
 void
 core_dump(dom, to, flags=0)
       virDomainPtr dom;
-      const char *to
+      const char *to;
       unsigned int flags;
     PPCODE:
       if (virDomainCoreDump(dom, to, flags) < 0)
           _croak_error();
 
 
+void
+core_dump_format(dom, to, format, flags=0)
+      virDomainPtr dom;
+      const char *to;
+      unsigned int format;
+      unsigned int flags;
+    PPCODE:
+      if (virDomainCoreDumpWithFormat(dom, to, format, flags) < 0)
+          _croak_error();
+
+
 HV *
 get_info(dom)
       virDomainPtr dom;
@@ -2996,6 +3488,48 @@ get_info(dom)
   OUTPUT:
       RETVAL
 
+AV *
+get_time(dom, flags=0)
+      virDomainPtr dom;
+      unsigned int flags;
+  PREINIT:
+      long long secs;
+      unsigned int nsecs;
+    CODE:
+      if (virDomainGetTime(dom, &secs, &nsecs, flags) < 0)
+          _croak_error();
+
+      RETVAL = (AV *)sv_2mortal((SV*)newAV());
+      (void)av_push(RETVAL, virt_newSVull(secs));
+      (void)av_push(RETVAL, newSViv(nsecs));
+  OUTPUT:
+      RETVAL
+
+
+void
+set_time(dom, secssv, nsecs, flags=0)
+      virDomainPtr dom;
+      SV *secssv;
+      unsigned int nsecs;
+      unsigned int flags;
+  PREINIT:
+      long long secs;
+  PPCODE:
+      secs = virt_SvIVll(secssv);
+
+      if (virDomainSetTime(dom, secs, nsecs, flags) < 0)
+	_croak_error();
+
+
+void
+set_user_password(dom, username, password, flags=0)
+      virDomainPtr dom;
+      const char *username;
+      const char *password;
+      unsigned int flags;
+  PPCODE:
+      if (virDomainSetUserPassword(dom, username, password, flags) < 0)
+	_croak_error();
 
 HV *
 get_control_info(dom, flags=0)
@@ -3073,6 +3607,18 @@ open_graphics(dom, idx, fd, flags=0)
           _croak_error();
 
 
+int
+open_graphics_fd(dom, idx, flags=0)
+      virDomainPtr dom;
+      unsigned int idx;
+      unsigned int flags;
+  CODE:
+      if ((RETVAL = virDomainOpenGraphicsFD(dom, idx, flags)) < 0)
+          _croak_error();
+OUTPUT:
+      RETVAL
+
+
 SV *
 screenshot(dom, st, screen, flags=0)
       virDomainPtr dom;
@@ -3233,6 +3779,42 @@ block_rebase(dom, path, base, bandwidth, flags=0)
 
 
 void
+block_copy(dom, path, destxml, newparams, flags=0)
+      virDomainPtr dom;
+      const char *path;
+      const char *destxml;
+      HV *newparams;
+      unsigned long flags;
+  PREINIT:
+      virTypedParameter *params;
+      int nparams;
+  PPCODE:
+      nparams = 3;
+      Newx(params, nparams, virTypedParameter);
+
+      strncpy(params[0].field, VIR_DOMAIN_BLOCK_COPY_BANDWIDTH,
+              VIR_TYPED_PARAM_FIELD_LENGTH);
+      params[0].type = VIR_TYPED_PARAM_ULLONG;
+
+      strncpy(params[1].field, VIR_DOMAIN_BLOCK_COPY_GRANULARITY,
+              VIR_TYPED_PARAM_FIELD_LENGTH);
+      params[1].type = VIR_TYPED_PARAM_UINT;
+
+      strncpy(params[2].field, VIR_DOMAIN_BLOCK_COPY_BUF_SIZE,
+              VIR_TYPED_PARAM_FIELD_LENGTH);
+      params[2].type = VIR_TYPED_PARAM_UINT;
+
+      nparams = vir_typed_param_from_hv(newparams, params, nparams);
+
+      if (virDomainBlockCopy(dom, path, destxml, params, nparams, flags) < 0) {
+          Safefree(params);
+          _croak_error();
+      }
+
+      Safefree(params);
+
+
+void
 block_commit(dom, path, base, top, bandwidth, flags=0)
       virDomainPtr dom;
       const char *path;
@@ -3765,29 +4347,33 @@ _migrate(dom, destcon, newparams, flags=0)
      virTypedParameter *params;
      int nparams;
     CODE:
-     nparams = 5;
+     nparams = 6;
      Newx(params, nparams, virTypedParameter);
 
-     memcpy(params[0].field, VIR_MIGRATE_PARAM_URI,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[0].field, VIR_MIGRATE_PARAM_URI,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[0].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[1].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[2].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[3].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[4].type = VIR_TYPED_PARAM_ULLONG;
 
+     strncpy(params[5].field, VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[5].type = VIR_TYPED_PARAM_STRING;
+
 
      nparams = vir_typed_param_from_hv(newparams, params, nparams);
 
@@ -3814,29 +4400,33 @@ _migrate_to_uri(dom, desturi, newparams, flags=0)
      virTypedParameter *params;
      int nparams;
   PPCODE:
-     nparams = 5;
+     nparams = 6;
      Newx(params, nparams, virTypedParameter);
 
-     memcpy(params[0].field, VIR_MIGRATE_PARAM_URI,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[0].field, VIR_MIGRATE_PARAM_URI,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[0].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[1].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[2].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[3].type = VIR_TYPED_PARAM_STRING;
 
-     memcpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH,
-            VIR_TYPED_PARAM_FIELD_LENGTH);
+     strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
      params[4].type = VIR_TYPED_PARAM_ULLONG;
 
+     strncpy(params[5].field, VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[5].type = VIR_TYPED_PARAM_STRING;
+
      nparams = vir_typed_param_from_hv(newparams, params, nparams);
 
      /* No need to support virDomainMigrateToURI/virDomainMigrateToURI2, since
@@ -4370,12 +4960,21 @@ get_vcpu_info(dom, flags=0)
 
       maplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo));
       Newx(cpumaps, dominfo.nrVirtCpu * maplen, unsigned char);
-      if (flags && (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
-          Newx(info, dominfo.nrVirtCpu, virVcpuInfo);
+      if (!flags) {
+	  Newx(info, dominfo.nrVirtCpu, virVcpuInfo);
           if ((nvCpus = virDomainGetVcpus(dom, info, dominfo.nrVirtCpu, cpumaps, maplen)) < 0) {
+              virErrorPtr err = virGetLastError();
               Safefree(info);
-              Safefree(cpumaps);
-              _croak_error();
+              info = NULL;
+              if (err && err->code == VIR_ERR_OPERATION_INVALID) {
+                  if ((nvCpus = virDomainGetVcpuPinInfo(dom, dominfo.nrVirtCpu, cpumaps, maplen, flags)) < 0) {
+                      Safefree(cpumaps);
+                      _croak_error();
+                  }
+              } else {
+                  Safefree(cpumaps);
+                  _croak_error();
+              }
           }
       } else {
           info = NULL;
@@ -4393,6 +4992,10 @@ get_vcpu_info(dom, flags=0)
               (void)hv_store(rec, "state", 5, newSViv(info[i].state), 0);
               (void)hv_store(rec, "cpuTime", 7, virt_newSVull(info[i].cpuTime), 0);
               (void)hv_store(rec, "cpu", 3, newSViv(info[i].cpu), 0);
+          } else {
+              (void)hv_store(rec, "state", 5, newSViv(0), 0);
+              (void)hv_store(rec, "cpuTime", 7, virt_newSVull(0), 0);
+              (void)hv_store(rec, "cpu", 3, newSViv(0), 0);
           }
           (void)hv_store(rec, "affinity", 8, newSVpvn((char*)cpumaps + (i *maplen), maplen), 0);
           PUSHs(newRV_noinc((SV *)rec));
@@ -4463,6 +5066,71 @@ get_emulator_pin_info(dom, flags=0)
       RETVAL
 
 
+void
+get_iothread_info(dom, flags=0)
+      virDomainPtr dom;
+      unsigned int flags;
+ PREINIT:
+      virDomainIOThreadInfoPtr *iothrinfo;
+      int niothreads;
+      int i;
+   PPCODE:
+      if ((niothreads = virDomainGetIOThreadInfo(dom, &iothrinfo,
+                                                 flags)) < 0)
+          _croak_error();
+
+      EXTEND(SP, niothreads);
+      for (i = 0 ; i < niothreads ; i++) {
+          HV *rec = newHV();
+          (void)hv_store(rec, "number", 6,
+                         newSViv(iothrinfo[i]->iothread_id), 0);
+          (void)hv_store(rec, "affinity", 8,
+                         newSVpvn((char*)iothrinfo[i]->cpumap,
+                                  iothrinfo[i]->cpumaplen), 0);
+          PUSHs(newRV_noinc((SV *)rec));
+      }
+
+      for (i = 0 ; i < niothreads ; i++) {
+          virDomainIOThreadInfoFree(iothrinfo[i]);
+      }
+      free(iothrinfo);
+
+
+void
+pin_iothread(dom, iothread_id, mask, flags=0)
+     virDomainPtr dom;
+     unsigned int iothread_id;
+     SV *mask;
+     unsigned int flags;
+PREINIT:
+     STRLEN masklen;
+     unsigned char *maps;
+ PPCODE:
+     maps = (unsigned char *)SvPV(mask, masklen);
+     if (virDomainPinIOThread(dom, iothread_id, maps, masklen, flags) < 0)
+         _croak_error();
+
+
+void
+add_iothread(dom, iothread_id, flags=0)
+     virDomainPtr dom;
+     unsigned int iothread_id;
+     unsigned int flags;
+ PPCODE:
+     if (virDomainAddIOThread(dom, iothread_id, flags) < 0)
+         _croak_error();
+
+
+void
+del_iothread(dom, iothread_id, flags=0)
+     virDomainPtr dom;
+     unsigned int iothread_id;
+     unsigned int flags;
+ PPCODE:
+     if (virDomainDelIOThread(dom, iothread_id, flags) < 0)
+         _croak_error();
+
+
 int
 num_of_snapshots(dom, flags=0)
       virDomainPtr dom;
@@ -4555,6 +5223,138 @@ fs_trim(dom, mountPoint, minimumsv, flags=0)
 
 
 void
+fs_freeze(dom, mountPointsSV, flags=0)
+      virDomainPtr dom;
+      SV *mountPointsSV;
+      unsigned int flags;
+PREINIT:
+      AV *mountPointsAV;
+      const char **mountPoints;
+      unsigned int nMountPoints;
+      unsigned int i;
+PPCODE:
+      mountPointsAV = (AV*)SvRV(mountPointsSV);
+      nMountPoints = av_len(mountPointsAV) + 1;
+      if (nMountPoints) {
+          Newx(mountPoints, nMountPoints, const char *);
+          for (i = 0 ; i < nMountPoints ; i++) {
+              SV **mountPoint = av_fetch(mountPointsAV, i, 0);
+              mountPoints[i] = SvPV_nolen(*mountPoint);
+          }
+      } else {
+	  mountPoints = NULL;
+      }
+
+      if (virDomainFSFreeze(dom, mountPoints, nMountPoints, flags) < 0) {
+          Safefree(mountPoints);
+          _croak_error();
+      }
+
+      Safefree(mountPoints);
+
+
+void
+fs_thaw(dom, mountPointsSV, flags=0)
+      virDomainPtr dom;
+      SV *mountPointsSV;
+      unsigned int flags;
+PREINIT:
+      AV *mountPointsAV;
+      const char **mountPoints;
+      unsigned int nMountPoints;
+      unsigned int i;
+PPCODE:
+      mountPointsAV = (AV*)SvRV(mountPointsSV);
+      nMountPoints = av_len(mountPointsAV) + 1;
+      if (nMountPoints) {
+          Newx(mountPoints, nMountPoints, const char *);
+          for (i = 0 ; i < nMountPoints ; i++) {
+              SV **mountPoint = av_fetch(mountPointsAV, i, 0);
+              mountPoints[i] = SvPV_nolen(*mountPoint);
+          }
+      } else {
+	  mountPoints = NULL;
+      }
+      if (virDomainFSThaw(dom, mountPoints, nMountPoints, flags) < 0) {
+          Safefree(mountPoints);
+          _croak_error();
+      }
+
+      Safefree(mountPoints);
+
+void
+get_fs_info(dom, flags=0)
+      virDomainPtr dom;
+      unsigned int flags;
+  PREINIT:
+      virDomainFSInfoPtr *info;
+      int ninfo;
+      size_t i, j;
+   PPCODE:
+
+      if ((ninfo = virDomainGetFSInfo(dom, &info, flags)) < 0)
+	_croak_error();
+
+      EXTEND(SP, ninfo);
+      for (i = 0 ; i < ninfo ; i++) {
+	  HV *hv = newHV();
+	  AV *av = newAV();
+
+	  (void)hv_store(hv, "mountpoint", 10, newSVpv(info[i]->mountpoint, 0), 0);
+	  (void)hv_store(hv, "name", 4, newSVpv(info[i]->name, 0), 0);
+	  (void)hv_store(hv, "fstype", 6, newSVpv(info[i]->fstype, 0), 0);
+
+	  for (j = 0; j < info[i]->ndevAlias; j++)
+	      av_push(av, newSVpv(info[i]->devAlias[j], 0));
+
+	  (void)hv_store(hv, "devalias", 8, newRV_noinc((SV*)av), 0);
+
+	  virDomainFSInfoFree(info[i]);
+
+	  PUSHs(newRV_noinc((SV*)hv));
+      }
+      free(info);
+
+void
+get_interface_addresses(dom, src, flags=0)
+        virDomainPtr dom;
+        unsigned int src;
+        unsigned int flags;
+    PREINIT:
+        virDomainInterfacePtr *info;
+        int ninfo;
+        size_t i, j;
+     PPCODE:
+        if ((ninfo = virDomainInterfaceAddresses(dom, &info, src, flags)) < 0)
+	    _croak_error();
+
+        EXTEND(SP, ninfo);
+        for (i = 0; i < ninfo; i++) {
+	    HV *hv = newHV();
+	    AV *av = newAV();
+
+	    (void)hv_store(hv, "name", 4, newSVpv(info[i]->name, 0), 0);
+	    if (info[i]->hwaddr) {
+	      (void)hv_store(hv, "hwaddr", 6, newSVpv(info[i]->hwaddr, 0), 0);
+	    }
+
+	    for (j = 0; j < info[i]->naddrs; j++) {
+	      HV *subhv = newHV();
+
+	      (void)hv_store(subhv, "type", 4, newSViv(info[i]->addrs[j].type), 0);
+	      (void)hv_store(subhv, "addr", 4, newSVpv(info[i]->addrs[j].addr, 0), 0);
+	      (void)hv_store(subhv, "prefix", 6, newSViv(info[i]->addrs[j].prefix), 0);
+	      av_push(av, newRV_noinc((SV*)subhv));
+	    }
+	    (void)hv_store(hv, "addrs", 5, newRV_noinc((SV*)av), 0);
+
+	    virDomainInterfaceFree(info[i]);
+
+	    PUSHs(newRV_noinc((SV*)hv));
+	}
+        free(info);
+
+void
 send_process_signal(dom, pidsv, signum, flags=0)
       virDomainPtr dom;
       SV *pidsv;
@@ -4798,6 +5598,44 @@ get_autostart(net)
 
 
 void
+get_dhcp_leases(net, macsv=&PL_sv_undef, flags=0)
+      virNetworkPtr net;
+      SV *macsv;
+      unsigned int flags;
+PREINIT:
+      virNetworkDHCPLeasePtr *leases = NULL;
+      int nleases;
+      const char *mac = NULL;
+      int i;
+  PPCODE:
+      if (SvOK(macsv))
+	  mac = SvPV_nolen(macsv);
+
+      if ((nleases = virNetworkGetDHCPLeases(net, mac, &leases, flags)) < 0)
+	  _croak_error();
+
+      EXTEND(SP, nleases);
+      for (i = 0 ; i < nleases ; i++) {
+	  HV *hv = newHV();
+
+	  (void)hv_store(hv, "iface", 5, newSVpv(leases[i]->iface, 0), 0);
+	  (void)hv_store(hv, "expirytime", 10, virt_newSVll(leases[i]->expirytime), 0);
+	  (void)hv_store(hv, "type", 4, newSViv(leases[i]->type), 0);
+	  (void)hv_store(hv, "mac", 3, newSVpv(leases[i]->mac, 0), 0);
+	  (void)hv_store(hv, "iaid", 4, newSVpv(leases[i]->iaid, 0), 0);
+	  (void)hv_store(hv, "ipaddr", 6, newSVpv(leases[i]->ipaddr, 0), 0);
+	  (void)hv_store(hv, "prefix", 6, newSViv(leases[i]->prefix), 0);
+	  (void)hv_store(hv, "hostname", 8, newSVpv(leases[i]->hostname, 0), 0);
+	  (void)hv_store(hv, "clientid", 8, newSVpv(leases[i]->clientid, 0), 0);
+
+	  virNetworkDHCPLeaseFree(leases[i]);
+
+	  PUSHs(newRV_noinc((SV*)hv));
+      }
+      free(leases);
+
+
+void
 destroy(net_rv)
       SV *net_rv;
  PREINIT:
@@ -5390,8 +6228,10 @@ const char *
 get_parent(dev)
       virNodeDevicePtr dev;
     CODE:
-      if (!(RETVAL = virNodeDeviceGetParent(dev)))
-          _croak_error();
+      if (!(RETVAL = virNodeDeviceGetParent(dev))) {
+          if (virGetLastError() != NULL)
+              _croak_error();
+      }
   OUTPUT:
       RETVAL
 
@@ -6439,6 +7279,7 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_IOWAIT, NODE_CPU_STATS_IOWAIT);
       REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_KERNEL, NODE_CPU_STATS_KERNEL);
       REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_USER, NODE_CPU_STATS_USER);
+      REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_INTR, NODE_CPU_STATS_INTR);
       REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_UTILIZATION, NODE_CPU_STATS_UTILIZATION);
 
       REGISTER_CONSTANT(VIR_NODE_MEMORY_STATS_ALL_CELLS, NODE_MEMORY_STATS_ALL_CELLS);
@@ -6459,7 +7300,18 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED, NODE_MEMORY_SHARED_PAGES_UNSHARED);
       REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE, NODE_MEMORY_SHARED_PAGES_VOLATILE);
       REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_FULL_SCANS, NODE_MEMORY_SHARED_FULL_SCANS);
+      REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, NODE_MEMORY_SHARED_MERGE_ACROSS_NODES);
+
+      REGISTER_CONSTANT(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, BASELINE_CPU_EXPAND_FEATURES);
+      REGISTER_CONSTANT(VIR_CONNECT_BASELINE_CPU_MIGRATABLE, BASELINE_CPU_MIGRATABLE);
+
+      REGISTER_CONSTANT(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, COMPARE_CPU_FAIL_INCOMPATIBLE);
+
+      REGISTER_CONSTANT(VIR_IP_ADDR_TYPE_IPV4, IP_ADDR_TYPE_IPV4);
+      REGISTER_CONSTANT(VIR_IP_ADDR_TYPE_IPV6, IP_ADDR_TYPE_IPV6);
 
+      REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_ADD, NODE_ALLOC_PAGES_ADD);
+      REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_SET, NODE_ALLOC_PAGES_SET);
 
       stash = gv_stashpv( "Sys::Virt::Event", TRUE );
 
@@ -6491,11 +7343,15 @@ BOOT:
 
       REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_MANAGED_SAVE, UNDEFINE_MANAGED_SAVE);
       REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA, UNDEFINE_SNAPSHOTS_METADATA);
+      REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_NVRAM, UNDEFINE_NVRAM);
 
       REGISTER_CONSTANT(VIR_DOMAIN_START_PAUSED, START_PAUSED);
       REGISTER_CONSTANT(VIR_DOMAIN_START_AUTODESTROY, START_AUTODESTROY);
       REGISTER_CONSTANT(VIR_DOMAIN_START_BYPASS_CACHE, START_BYPASS_CACHE);
       REGISTER_CONSTANT(VIR_DOMAIN_START_FORCE_BOOT, START_FORCE_BOOT);
+      REGISTER_CONSTANT(VIR_DOMAIN_START_VALIDATE, START_VALIDATE);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_DEFINE_VALIDATE, DEFINE_VALIDATE);
 
       REGISTER_CONSTANT(VIR_DOMAIN_NOSTATE_UNKNOWN, STATE_NOSTATE_UNKNOWN);
 
@@ -6523,6 +7379,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_SHUTTING_DOWN, STATE_PAUSED_SHUTTING_DOWN);
       REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_SNAPSHOT, STATE_PAUSED_SNAPSHOT);
       REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_CRASHED, STATE_PAUSED_CRASHED);
+      REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_STARTING_UP, STATE_PAUSED_STARTING_UP);
 
       REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_UNKNOWN, STATE_SHUTDOWN_UNKNOWN);
       REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_USER, STATE_SHUTDOWN_USER);
@@ -6582,12 +7439,15 @@ BOOT:
       REGISTER_CONSTANT(VIR_MIGRATE_OFFLINE, MIGRATE_OFFLINE);
       REGISTER_CONSTANT(VIR_MIGRATE_COMPRESSED, MIGRATE_COMPRESSED);
       REGISTER_CONSTANT(VIR_MIGRATE_ABORT_ON_ERROR, MIGRATE_ABORT_ON_ERROR);
+      REGISTER_CONSTANT(VIR_MIGRATE_AUTO_CONVERGE, MIGRATE_AUTO_CONVERGE);
+      REGISTER_CONSTANT(VIR_MIGRATE_RDMA_PIN_ALL, MIGRATE_RDMA_PIN_ALL);
 
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_BANDWIDTH, MIGRATE_PARAM_BANDWIDTH);
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DEST_NAME, MIGRATE_PARAM_DEST_NAME);
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DEST_XML, MIGRATE_PARAM_DEST_XML);
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_GRAPHICS_URI, MIGRATE_PARAM_GRAPHICS_URI);
       REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_URI, MIGRATE_PARAM_URI);
+      REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_LISTEN_ADDRESS, MIGRATE_PARAM_LISTEN_ADDRESS);
 
       REGISTER_CONSTANT(VIR_DOMAIN_XML_SECURE, XML_SECURE);
       REGISTER_CONSTANT(VIR_DOMAIN_XML_INACTIVE, XML_INACTIVE);
@@ -6615,6 +7475,23 @@ BOOT:
       REGISTER_CONSTANT(VIR_KEYCODE_SET_WIN32, KEYCODE_SET_WIN32);
       REGISTER_CONSTANT(VIR_KEYCODE_SET_RFB, KEYCODE_SET_RFB);
 
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_BALLOON, STATS_BALLOON);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_BLOCK, STATS_BLOCK);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_CPU_TOTAL, STATS_CPU_TOTAL);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_INTERFACE, STATS_INTERFACE);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_STATE, STATS_STATE);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_VCPU, STATS_VCPU);
+
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE, GET_ALL_STATS_ACTIVE);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE, GET_ALL_STATS_INACTIVE);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER, GET_ALL_STATS_OTHER);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED, GET_ALL_STATS_PAUSED);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT, GET_ALL_STATS_PERSISTENT);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING, GET_ALL_STATS_RUNNING);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF, GET_ALL_STATS_SHUTOFF);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT, GET_ALL_STATS_TRANSIENT);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, GET_ALL_STATS_ENFORCE_STATS);
+      REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING, GET_ALL_STATS_BACKING);
 
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED, EVENT_DEFINED);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_UNDEFINED, EVENT_UNDEFINED);
@@ -6670,6 +7547,10 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_OCCUPIED, CONTROL_OCCUPIED);
       REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR, CONTROL_ERROR);
 
+      REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_NONE, CONTROL_ERROR_REASON_NONE);
+      REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN, CONTROL_ERROR_REASON_UNKNOWN);
+      REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL, CONTROL_ERROR_REASON_INTERNAL);
+      REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR, CONTROL_ERROR_REASON_MONITOR);
 
       REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_CURRENT, DEVICE_MODIFY_CURRENT);
       REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_LIVE, DEVICE_MODIFY_LIVE);
@@ -6695,6 +7576,8 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_JOB_FAILED, JOB_FAILED);
       REGISTER_CONSTANT(VIR_DOMAIN_JOB_CANCELLED, JOB_CANCELLED);
 
+      REGISTER_CONSTANT(VIR_DOMAIN_JOB_STATS_COMPLETED, JOB_STATS_COMPLETED);
+
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_BYTES, JOB_COMPRESSION_BYTES);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_CACHE, JOB_COMPRESSION_CACHE);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES, JOB_COMPRESSION_CACHE_MISSES);
@@ -6706,20 +7589,26 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_PROCESSED, JOB_DISK_PROCESSED);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_REMAINING, JOB_DISK_REMAINING);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_TOTAL, JOB_DISK_TOTAL);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_BPS, JOB_DISK_BPS);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DOWNTIME, JOB_DOWNTIME);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DOWNTIME_NET, JOB_DOWNTIME_NET);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_CONSTANT, JOB_MEMORY_CONSTANT);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_NORMAL, JOB_MEMORY_NORMAL);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES, JOB_MEMORY_NORMAL_BYTES);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_PROCESSED, JOB_MEMORY_PROCESSED);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_REMAINING, JOB_MEMORY_REMAINING);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_TOTAL, JOB_MEMORY_TOTAL);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_BPS, JOB_MEMORY_BPS);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_SETUP_TIME, JOB_SETUP_TIME);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_ELAPSED, JOB_TIME_ELAPSED);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_ELAPSED_NET, JOB_TIME_ELAPSED_NET);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_REMAINING, JOB_TIME_REMAINING);
 
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN, BLOCK_JOB_TYPE_UNKNOWN);
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, BLOCK_JOB_TYPE_PULL);
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_COPY, BLOCK_JOB_TYPE_COPY);
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT, BLOCK_JOB_TYPE_COMMIT);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT, BLOCK_JOB_TYPE_ACTIVE_COMMIT);
 
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_COMPLETED, BLOCK_JOB_COMPLETED);
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_FAILED, BLOCK_JOB_FAILED);
@@ -6728,6 +7617,9 @@ BOOT:
 
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_DELETE, BLOCK_COMMIT_DELETE);
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW, BLOCK_COMMIT_SHALLOW);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_ACTIVE, BLOCK_COMMIT_ACTIVE);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, BLOCK_COMMIT_RELATIVE);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, BLOCK_COMMIT_BANDWIDTH_BYTES);
 
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_REBOOT, EVENT_ID_REBOOT);
@@ -6738,13 +7630,17 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON, EVENT_ID_IO_ERROR_REASON);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_CONTROL_ERROR, EVENT_ID_CONTROL_ERROR);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BLOCK_JOB, EVENT_ID_BLOCK_JOB);
+      REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, EVENT_ID_BLOCK_JOB_2);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DISK_CHANGE, EVENT_ID_DISK_CHANGE);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMSUSPEND, EVENT_ID_PMSUSPEND);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK, EVENT_ID_PMSUSPEND_DISK);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMWAKEUP, EVENT_ID_PMWAKEUP);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, EVENT_ID_TRAY_CHANGE);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE, EVENT_ID_BALLOON_CHANGE);
+      REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, EVENT_ID_DEVICE_ADDED);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, EVENT_ID_DEVICE_REMOVED);
+      REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_TUNABLE, EVENT_ID_TUNABLE);
+      REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, EVENT_ID_AGENT_LIFECYCLE);
 
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NONE);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PAUSE);
@@ -6766,10 +7662,18 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX, EVENT_GRAPHICS_ADDRESS_UNIX);
 
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START, EVENT_DISK_CHANGE_MISSING_ON_START);
+      REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START, EVENT_DISK_DROP_MISSING_ON_START);
 
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN, EVENT_TRAY_CHANGE_OPEN);
       REGISTER_CONSTANT(VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE, EVENT_TRAY_CHANGE_CLOSE);
 
+      REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED, EVENT_AGENT_LIFECYCLE_STATE_CONNECTED);
+      REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED, EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED);
+
+      REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL, EVENT_AGENT_LIFECYCLE_REASON_CHANNEL);
+      REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED, EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED);
+      REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN, EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN);
+
       REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_HARD_LIMIT, MEMORY_HARD_LIMIT);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_SOFT_LIMIT, MEMORY_SOFT_LIMIT);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_MIN_GUARANTEE, MEMORY_MIN_GUARANTEE);
@@ -6778,6 +7682,10 @@ BOOT:
 
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_WEIGHT, BLKIO_WEIGHT);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WEIGHT, BLKIO_DEVICE_WEIGHT);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_READ_BPS, BLKIO_DEVICE_READ_BPS);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS, BLKIO_DEVICE_READ_IOPS);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS, BLKIO_DEVICE_WRITE_BPS);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS, BLKIO_DEVICE_WRITE_IOPS);
 
       REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_CPU_SHARES, SCHEDULER_CPU_SHARES);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, SCHEDULER_VCPU_PERIOD);
@@ -6805,6 +7713,13 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, BLOCK_IOTUNE_TOTAL_IOPS_SEC);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, BLOCK_IOTUNE_READ_IOPS_SEC);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, BLOCK_IOTUNE_WRITE_IOPS_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, BLOCK_IOTUNE_READ_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, BLOCK_IOTUNE_READ_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, BLOCK_IOTUNE_SIZE_IOPS_SEC);
 
 
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_RESIZE_BYTES, BLOCK_RESIZE_BYTES);
@@ -6838,6 +7753,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_GUEST_AGENT, SHUTDOWN_GUEST_AGENT);
       REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_INITCTL, SHUTDOWN_INITCTL);
       REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_SIGNAL, SHUTDOWN_SIGNAL);
+      REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_PARAVIRT, SHUTDOWN_PARAVIRT);
 
 
       REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_DEFAULT, REBOOT_DEFAULT);
@@ -6845,6 +7761,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_GUEST_AGENT, REBOOT_GUEST_AGENT);
       REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_INITCTL, REBOOT_INITCTL);
       REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_SIGNAL, REBOOT_SIGNAL);
+      REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_PARAVIRT, REBOOT_PARAVIRT);
 
       REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_NOP, PROCESS_SIGNAL_NOP);
       REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_HUP, PROCESS_SIGNAL_HUP);
@@ -6938,6 +7855,22 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT, BLOCK_REBASE_REUSE_EXT);
       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_DOMAIN_BLOCK_REBASE_COPY_DEV, BLOCK_REBASE_COPY_DEV);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_RELATIVE, BLOCK_REBASE_RELATIVE);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES, BLOCK_REBASE_BANDWIDTH_BYTES);
+
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, BLOCK_COPY_BANDWIDTH);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_GRANULARITY, BLOCK_COPY_GRANULARITY);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_BUF_SIZE, BLOCK_COPY_BUF_SIZE);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, BLOCK_COPY_REUSE_EXT);
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_SHALLOW, BLOCK_COPY_SHALLOW);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES, BLOCK_JOB_SPEED_BANDWIDTH_BYTES);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, BLOCK_PULL_BANDWIDTH_BYTES);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, BLOCK_JOB_INFO_BANDWIDTH_BYTES);
 
       REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_ACTIVE, LIST_ACTIVE);
       REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_AUTOSTART, LIST_AUTOSTART);
@@ -6956,6 +7889,42 @@ BOOT:
 
       REGISTER_CONSTANT(VIR_DOMAIN_SEND_KEY_MAX_KEYS, SEND_KEY_MAX_KEYS);
 
+      REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, CORE_DUMP_FORMAT_RAW);
+      REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO, CORE_DUMP_FORMAT_KDUMP_LZO);
+      REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY, CORE_DUMP_FORMAT_KDUMP_SNAPPY);
+      REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB, CORE_DUMP_FORMAT_KDUMP_ZLIB);
+
+      REGISTER_CONSTANT(VIR_DOMAIN_TIME_SYNC, TIME_SYNC);
+
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES, TUNABLE_CPU_CPU_SHARES);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN, TUNABLE_CPU_EMULATORPIN);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD, TUNABLE_CPU_EMULATOR_PERIOD);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA, TUNABLE_CPU_EMULATOR_QUOTA);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPUPIN, TUNABLE_CPU_VCPUPIN);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD, TUNABLE_CPU_VCPU_PERIOD);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA, TUNABLE_CPU_VCPU_QUOTA);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_DISK, TUNABLE_BLKDEV_DISK);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC, TUNABLE_BLKDEV_READ_BYTES_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC, TUNABLE_BLKDEV_READ_IOPS_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC, TUNABLE_BLKDEV_TOTAL_BYTES_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC, TUNABLE_BLKDEV_TOTAL_IOPS_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC, TUNABLE_BLKDEV_WRITE_BYTES_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC, TUNABLE_BLKDEV_WRITE_IOPS_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX, TUNABLE_BLKDEV_READ_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX, TUNABLE_BLKDEV_READ_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX, TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX, TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX, TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX, TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC, TUNABLE_BLKDEV_SIZE_IOPS_SEC);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN, TUNABLE_IOTHREADSPIN);
+
+
+      REGISTER_CONSTANT(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT, INTERFACE_ADDRESSES_SRC_AGENT);
+      REGISTER_CONSTANT(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE, INTERFACE_ADDRESSES_SRC_LEASE);
+
+
+      REGISTER_CONSTANT(VIR_DOMAIN_PASSWORD_ENCRYPTED, PASSWORD_ENCRYPTED);
 
       stash = gv_stashpv( "Sys::Virt::DomainSnapshot", TRUE );
       REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, DELETE_CHILDREN);
@@ -7025,6 +7994,8 @@ BOOT:
       REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_MPATH, LIST_MPATH);
       REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_RBD, LIST_RBD);
       REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG, LIST_SHEEPDOG);
+      REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER, LIST_GLUSTER);
+      REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_ZFS, LIST_ZFS);
 
       stash = gv_stashpv( "Sys::Virt::Network", TRUE );
       REGISTER_CONSTANT(VIR_NETWORK_XML_INACTIVE, XML_INACTIVE);
@@ -7060,6 +8031,14 @@ BOOT:
       REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_PERSISTENT, LIST_PERSISTENT);
       REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_TRANSIENT, LIST_TRANSIENT);
 
+      REGISTER_CONSTANT(VIR_NETWORK_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE);
+
+      REGISTER_CONSTANT(VIR_NETWORK_EVENT_DEFINED, EVENT_DEFINED);
+      REGISTER_CONSTANT(VIR_NETWORK_EVENT_UNDEFINED, EVENT_UNDEFINED);
+      REGISTER_CONSTANT(VIR_NETWORK_EVENT_STARTED, EVENT_STARTED);
+      REGISTER_CONSTANT(VIR_NETWORK_EVENT_STOPPED, EVENT_STOPPED);
+
+
       stash = gv_stashpv( "Sys::Virt::Interface", TRUE );
       REGISTER_CONSTANT(VIR_INTERFACE_XML_INACTIVE, XML_INACTIVE);
 
@@ -7088,6 +8067,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_STORAGE_VOL_BLOCK, TYPE_BLOCK);
       REGISTER_CONSTANT(VIR_STORAGE_VOL_DIR, TYPE_DIR);
       REGISTER_CONSTANT(VIR_STORAGE_VOL_NETWORK, TYPE_NETWORK);
+      REGISTER_CONSTANT(VIR_STORAGE_VOL_NETDIR, TYPE_NETDIR);
 
       REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_NORMAL, DELETE_NORMAL);
       REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_ZEROED, DELETE_ZEROED);
@@ -7108,6 +8088,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_STORAGE_VOL_RESIZE_SHRINK, RESIZE_SHRINK);
 
       REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, CREATE_PREALLOC_METADATA);
+      REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_REFLINK, CREATE_REFLINK);
 
 
       stash = gv_stashpv( "Sys::Virt::Secret", TRUE );
@@ -7196,6 +8177,11 @@ BOOT:
       REGISTER_CONSTANT(VIR_FROM_IDENTITY, FROM_IDENTITY);
       REGISTER_CONSTANT(VIR_FROM_ACCESS, FROM_ACCESS);
       REGISTER_CONSTANT(VIR_FROM_SYSTEMD, FROM_SYSTEMD);
+      REGISTER_CONSTANT(VIR_FROM_BHYVE, FROM_BHYVE);
+      REGISTER_CONSTANT(VIR_FROM_CRYPTO, FROM_CRYPTO);
+      REGISTER_CONSTANT(VIR_FROM_FIREWALL, FROM_FIREWALL);
+      REGISTER_CONSTANT(VIR_FROM_POLKIT, FROM_POLKIT);
+      REGISTER_CONSTANT(VIR_FROM_THREAD, FROM_THREAD);
 
 
       REGISTER_CONSTANT(VIR_ERR_OK, ERR_OK);
@@ -7288,4 +8274,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_ERR_RESOURCE_BUSY, ERR_RESOURCE_BUSY);
       REGISTER_CONSTANT(VIR_ERR_ACCESS_DENIED, ERR_ACCESS_DENIED);
       REGISTER_CONSTANT(VIR_ERR_DBUS_SERVICE, ERR_DBUS_SERVICE);
+      REGISTER_CONSTANT(VIR_ERR_STORAGE_VOL_EXIST, ERR_STORAGE_VOL_EXIST);
+      REGISTER_CONSTANT(VIR_ERR_CPU_INCOMPATIBLE, ERR_CPU_INCOMPATIBLE);
+      REGISTER_CONSTANT(VIR_ERR_XML_INVALID_SCHEMA, ERR_INVALID_SCHEMA);
     }
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use Sys::Virt;
+use Data::Dumper;
+
+my $c = Sys::Virt->new(uri => "qemu:///system",
+		       readonly => 1);
+
+$n = $c->get_network_by_name("default");
+
+foreach my $lease ($n->get_dhcp_leases()) {
+    print Dumper($lease);
+}
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+
+use strict;
+use warnings;
+
+use Sys::Virt;
+use Sys::Virt::Domain;
+
+my $uri = @ARGV ? shift @ARGV : undef;
+
+my $c = Sys::Virt->new(uri => $uri);
+
+my $dom = $c->get_domain_by_name(shift @ARGV);
+
+my @fs = $dom->get_fs_info();
+
+use Data::Dumper;
+
+print Dumper($fs[0]);
+print Dumper($fs[1]);
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+
+use strict;
+use warnings;
+
+use Sys::Virt;
+use Sys::Virt::Domain;
+
+my $uri = @ARGV ? shift @ARGV : undef;
+
+my $c = Sys::Virt->new(uri => $uri);
+
+my $dom = $c->get_domain_by_name(shift @ARGV);
+
+my @fs = $dom->get_interface_addresses(
+    Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_LEASE);
+
+use Data::Dumper;
+
+print Dumper(@fs);
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+
+use strict;
+use warnings;
+
+use Sys::Virt;
+use Sys::Virt::Domain;
+
+my $uri = @ARGV ? shift @ARGV : undef;
+
+my $c = Sys::Virt->new(uri => $uri);
+
+my @doms;
+foreach my $name (@ARGV) {
+    push @doms, $c->get_domain_by_name($name);
+}
+
+my @stats = $c->get_all_domain_stats(Sys::Virt::Domain::STATS_STATE,
+				     \@doms,
+				     Sys::Virt::Domain::GET_ALL_STATS_ENFORCE_STATS);
+
+use Data::Dumper;
+
+print Dumper(\@stats);
+
+for (my $i = 0 ; $i <= $#stats ; $i++) {
+    print $stats[$i]->{'dom'}->get_name(), ": ", $stats[$i]->{'data'}->{'state.state'}, "\n";
+}
@@ -20,10 +20,20 @@ sub lifecycle_event {
     print "$dom $event $detail\n";
 }
 
+sub agent_lifecycle_event {
+    my $dom = shift;
+    my $state = shift;
+    my $reason = shift;
+
+    print "Agent $dom state=$state reason=$reason\n";
+}
 
 $c->domain_event_register_any(undef,
 			      Sys::Virt::Domain::EVENT_ID_LIFECYCLE,
 			      \&lifecycle_event);
+$c->domain_event_register_any(undef,
+			      Sys::Virt::Domain::EVENT_ID_AGENT_LIFECYCLE,
+			      \&agent_lifecycle_event);
 
 $c->register_close_callback(
     sub {
@@ -0,0 +1,18 @@
+# -*- perl -*-
+use strict;
+use warnings;
+use Sys::Virt;
+
+die "syntax: $0 URI DOMAIN-NAME MOUNT-POINTS\n" unless int(@ARGV) >= 2;
+
+my $uri = shift @ARGV;
+my $domname = shift @ARGV;
+
+my @mountpoints = @ARGV;
+
+print "Addr $uri\n";
+my $con = Sys::Virt->new(address => $uri, readonly => 0);
+
+my $dom = $con->get_domain_by_name($domname);
+
+$dom->fs_freeze(\@mountpoints);
@@ -0,0 +1,33 @@
+# -*- perl -*-
+use strict;
+use warnings;
+use Sys::Virt;
+
+my $addr = @ARGV ? shift @ARGV : "";
+print "Addr $addr\n";
+my $con = Sys::Virt->new(address => $addr, readonly => 1);
+
+print "VMM type: ", $con->get_type(), "\n";
+
+foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_all_domains) {
+    print "Domain: {\n";
+    print "  ID: ", $dom->get_id(), " '" , $dom->get_name(), "'\n";
+    print "  UUID: ", $dom->get_uuid_string(), "\n";
+    my $nodeinfo = $con->get_node_info;
+    my @info = $dom->get_iothread_info(Sys::Virt::Domain::AFFECT_CONFIG);
+
+    foreach my $info (@info) {
+	print "  IOThread: {\n";
+	foreach (sort { $a cmp $b } keys %{$info}) {
+	    if ($_ eq "affinity") {
+		print "    ", $_, ": ";
+                my @bits = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_}));
+                print join ("", @bits), "\n";
+	    } else {
+		print "    ", $_, ": ", $info->{$_}, "\n";
+	    }
+	}
+	print "  }\n";
+    }
+    print "}\n";
+}
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use Sys::Virt;
+
+if (int(@ARGV) < 2) {
+    die "syntax: $0 URI PAGESIZE=1COUNT1 PAGESIZE2=COUNT2...";
+}
+
+my $uri = shift @ARGV;
+
+my $c = Sys::Virt->new(uri => $uri);
+
+my @pages;
+foreach (@ARGV) {
+    my @bits = split /=/;
+
+    push @pages, \@bits;
+}
+
+
+$c->node_alloc_pages(\@pages, -1, -1);
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+use Sys::Virt;
+
+my $conn = Sys::Virt->new();
+
+my @nodelist = $conn->list_all_node_devices();
+foreach my $dev (@nodelist){
+    my $parent = $dev->get_parent();
+    printf "%s: < %s\n", $dev->get_name(), $parent;
+}
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Sys::Virt;
+
+my $addr = @ARGV ? shift @ARGV : "";
+
+my $hv = Sys::Virt->new(address => $addr, readonly => 1);
+
+my $info = $hv->get_node_info();
+
+my @models = $hv->get_cpu_model_names($info->{model});
+
+print join ("\n", sort{ lc $a cmp lc $b } @models), "\n";
+
+my @info = $hv->get_node_free_pages([2048], 0, 0);
+
+use Data::Dumper;
+print Dumper(\@info);
+
+
+my $xml = $hv->get_domain_capabilities(undef, "x86_64", undef, "kvm");
+print $xml;
@@ -9,22 +9,20 @@ my $con = Sys::Virt->new(address => $addr, readonly => 1);
 
 print "VMM type: ", $con->get_type(), "\n";
 
-foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_domains) {
+foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_all_domains) {
     print "Domain: {\n";
     print "  ID: ", $dom->get_id(), " '" , $dom->get_name(), "'\n";
     print "  UUID: ", $dom->get_uuid_string(), "\n";
     my $nodeinfo = $con->get_node_info;
-    my @info = $dom->get_vcpu_info;
+    my @info = $dom->get_vcpu_info(Sys::Virt::Domain::AFFECT_CONFIG);
 
     foreach my $info (@info) {
 	print "  VCPU: {\n";
 	foreach (sort { $a cmp $b } keys %{$info}) {
 	    if ($_ eq "affinity") {
 		print "    ", $_, ": ";
-		my @mask = split //, $info->{$_};
-		for (my $p = 0 ; $p < $nodeinfo->{cpus} ; $p++) {
-		    print ((ord($mask[$p/8]) & (1 << ($p % 8))) ? 1 : 0);
-		}
+                my @mask = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_}));
+                print join ("", @mask), "\n";
 		print "\n";
 	    } else {
 		print "    ", $_, ": ", $info->{$_}, "\n";
@@ -62,7 +62,7 @@ sub _new {
 	}
     } elsif (exists $params{xml}) {
 	if ($params{nocreate}) {
-	    $self = Sys::Virt::Domain::_define_xml($con,  $params{xml});
+	    $self = Sys::Virt::Domain::_define_xml($con,  $params{xml}, $params{flags});
 	} else {
 	    if (exists $params{fds}) {
 		$self = Sys::Virt::Domain::_create_with_files($con,  $params{xml},
@@ -227,6 +227,34 @@ image to C<$filename> so it can be analysed by tools such as C<crash>.
 The optional C<$flags> flags parameter is currently unused and if
 omitted will default to 0.
 
+=item $dom->core_dump_format($filename, $format, [, $flags])
+
+Trigger a core dump of the guest virtual machine, saving its memory
+image to C<$filename> so it can be analysed by tools such as C<crash>.
+The C<$format> parameter is one of the core dump format constants.
+The optional C<$flags> flags parameter is currently unused and if
+omitted will default to 0.
+
+=over 4
+
+=item Sys::Virt::Domain::CORE_DUMP_FORMAT_RAW
+
+The raw ELF format
+
+=item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_ZLIB
+
+The zlib compressed ELF format
+
+=item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_SNAPPY
+
+The snappy compressed ELF format
+
+=item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_LZO
+
+The lzo compressed ELF format
+
+=back
+
 =item $dom->destroy()
 
 Immediately poweroff the machine. This is equivalent to removing the
@@ -328,6 +356,10 @@ The guest is paused while a snapshot takes place
 
 The guest is paused due to a kernel panic
 
+=item Sys::Virt::Domain::STATE_PAUSED_STARTING_UP
+
+The guest is paused as it is being started up.
+
 =item Sys::Virt::Domain::STATE_RUNNING_BOOTED
 
 The guest is running after being booted
@@ -445,6 +477,43 @@ the current state.
 
 =back
 
+=item my $time = $dom->get_time($flags=0);
+
+Get the current time of the guest, in seconds and nanoseconds.
+The C<$flags> parameter is currently unused and defaults to
+zero. The return value is an array ref with two elements,
+the first contains the time in seconds, the second contains
+the remaining nanoseconds.
+
+=item $dom->set_time($secs, $nsecs, $flags=0);
+
+Set the current time of the guest, in seconds and nanoseconds.
+The C<$flags> parameter accepts one of
+
+=over 4
+
+=item C<Sys::Virt::Domain::TIME_SYNC>
+
+Re-sync domain time from domain's RTC.
+
+=back
+
+
+=item $dom->set_user_password($username, $password, $flags=0);
+
+Update the password for account C<$username> to be
+C<$password>. C<$password> is the clear-text password
+string unless the PASSWORD_ENCRYPTED flag is set.
+
+=over 4
+
+=item C<Sys::Virt::Domain::PASSWORD_ENCRYPTED>
+
+The C<$password> is encrypted with the password scheme required
+by the guest OS.
+
+=back
+
 =item my @errs = $dom->get_disk_errors($flags=0)
 
 Returns a list of all disk errors that have occurred on
@@ -898,6 +967,14 @@ set to 0 or omitted, libvirt will choose a suitable default. Some
 hypervisors do not support this feature and will return an error if
 this field is used and is not 0.
 
+=item C<Sys::Virt::Domain::MIGRATE_PARAM_LISTEN_ADDRESS>
+
+The address on which to listen for incoming migration connections.
+If omitted, libvirt will listen on the wildcard address (0.0.0.0
+or ::). This default may be a security risk if guests, or other
+untrusted users have the ability to connect to the virtualization
+host, thus use of an explicit restricted listen address is recommended.
+
 =back
 
 =item $ddom = $dom->migrate(destcon, flags=0, dname=undef, uri=undef, bandwidth=0)
@@ -1105,6 +1182,16 @@ anoymous socket pair. The C<$flags> argument should be one of
 the constants listed at the end of this document, and defaults
 to 0.
 
+=item $fd = $dom->open_graphics_fd($idx, $flags)
+
+Open the graphics console for a guest, identified by C<$idx>,
+counting from 0. The C<$flags> argument should be one of the
+constants listed at the end of this document, and defaults
+to 0. The return value will be a file descriptor connected
+to the console which must be closed when no longer needed.
+This method is preferred over C<open_graphics> since it will
+work correctly under sVirt mandatory access control policies.
+
 =item my $mimetype = $dom->screenshot($st, $screen, $flags)
 
 Capture a screenshot of the virtual machine's monitor. The C<$screen>
@@ -1113,7 +1200,7 @@ or multi-card configuration. C<$st> must be a C<Sys::Virt::Stream>
 object from which the data can be read. C<$flags> is currently unused
 and defaults to 0. The mimetype of the screenshot is returned
 
-=item @vcpuinfo = $dom->get_vcpu_info()
+=item @vcpuinfo = $dom->get_vcpu_info($flags=0)
 
 Obtain information about the state of all virtual CPUs in a running
 guest domain. The returned list will have one element for each vCPU,
@@ -1124,7 +1211,9 @@ time of the vCPU, C<state> the running state and C<affinity> giving
 the allowed shedular placement. The value for C<affinity> is a
 string representing a bitmask against physical CPUs, 8 cpus per
 character. To extract the bits use the C<unpack> function with
-the C<b*> template.
+the C<b*> template. NB The C<state>, C<cpuTime>, C<cpu> values are
+only available if using C<$flags> value of 0, and the domain is
+currently running; otherwise they will all be set to zero.
 
 =item $dom->pin_vcpu($vcpu, $mask)
 
@@ -1147,6 +1236,35 @@ the physical CPUa, 8 cpus per character. To create a suitable
 bitstring, use the C<vec> function with a value of C<1> for the
 C<BITS> parameter.
 
+=item @iothreadinfo = $dom->get_iothread_info($flags=0)
+
+Obtain information about the state of all IOThreads in a running
+guest domain. The returned list will have one element for each IOThread,
+where each elements contains a hash reference. The keys in the hash
+are, C<number> the IOThread number and C<affinity> giving the allowed
+schedular placement. The value for C<affinity> is a
+string representing a bitmask against physical CPUs, 8 cpus per
+character. To extract the bits use the C<unpack> function with
+the C<b*> template.
+
+=item $dom->pin_iothread($iothread, $mask)
+
+Pin the IOThread given by index C<$iothread> to physical CPUs
+given by C<$mask>. The C<$mask> is a string representing a bitmask
+against physical CPUs, 8 cpus per character.
+
+=item $dom->add_iothread($iothread, $flags=0)
+
+Add a new IOThread by the C<$iothread> value to the guest domain.
+The C<$flags> parameter accepts one or more the CONFIG OPTION constants
+documented later, and defaults to 0 if omitted.
+
+=item $dom->del_iothread($iothread, $flags=0)
+
+Delete an existing IOThread by the C<$iothread> value from the guest domain.
+The C<$flags> parameter accepts one or more the CONFIG OPTION constants
+documented later, and defaults to 0 if omitted.
+
 =item my @stats = $dom->get_cpu_stats($startCpu, $numCpus, $flags=0)
 
 Requests the guests host physical CPU usage statistics, starting
@@ -1214,7 +1332,7 @@ The expected amount of file remaining to be processed by the job, in bytes.
 
 =back
 
-=item my ($type, $stats) = $dom->get_job_stats()
+=item my ($type, $stats) = $dom->get_job_stats($flags=0)
 
 Returns an array summarising the execution state of the
 background job. The C<$type> value is one of the JOB TYPE
@@ -1229,10 +1347,27 @@ following constants.
 The type of job, one of the JOB TYPE constants listed later in
 this document.
 
+The C<$flags> parameter defaults to zero and can take one of
+the following constants.
+
+=over 4
+
+=item Sys::Virt::Domain::JOB_STATS_COMPLETED
+
+Return the stats of the most recently completed job.
+
+=back
+
 =item Sys::Virt::Domain::JOB_TIME_ELAPSED
 
 The elapsed time in milliseconds
 
+=item Sys::Virt::Domain::JOB_TIME_ELAPSED_NET
+
+Time in miliseconds since the beginning of the migration job NOT
+including the time required to transfer control flow from the
+source host to the destination host.
+
 =item Sys::Virt::Domain::JOB_TIME_REMAINING
 
 The expected remaining time in milliseconds. Only set if the
@@ -1275,6 +1410,10 @@ The number of pages transferred without any compression
 
 The number of bytes transferred without any compression
 
+=item Sys::Virt::Domain::JOB_MEMORY_BPS
+
+The bytes per second transferred
+
 =item Sys::Virt::Domain::JOB_DISK_TOTAL
 
 The total amount of file expected to be processed by the job, in bytes.
@@ -1287,6 +1426,10 @@ The current amount of file processed by the job, in bytes.
 
 The expected amount of file remaining to be processed by the job, in bytes.
 
+=item Sys::Virt::Domain::JOB_DISK_BPS
+
+The bytes per second transferred
+
 =item Sys::Virt::Domain::JOB_COMPRESSION_CACHE
 
 The size of the compression cache in bytes
@@ -1314,6 +1457,16 @@ non-compressed page.
 The number of milliseconds of downtime expected during
 migration switchover.
 
+=item Sys::Virt::Domain::JOB_DOWNTIME_NET
+
+Real measured downtime (ms) NOT including the time required to
+transfer control flow from the source host to the destination
+host.
+
+=item Sys::Virt::Domain::JOB_SETUP_TIME
+
+The number of milliseconds of time doing setup of the job
+
 =back
 
 =item $dom->abort_job()
@@ -1324,13 +1477,32 @@ Aborts the currently executing job
 
 Returns a hash reference summarising the execution state of
 the block job. The C<$path> parameter should be the fully
-qualified path of the block device being changed.
+qualified path of the block device being changed. Valid
+C<$flags> include:
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_JOB_INFO_BANDWIDTH_BYTES
+
+Treat bandwidth value as bytes instead of MiB.
+
+=back
 
 =item $dom->set_block_job_speed($path, $bandwidth, $flags=0)
 
 Change the maximum I/O bandwidth used by the block job that
 is currently executing for C<$path>. The C<$bandwidth> argument
-is specified in MB/s
+is specified in MB/s.  The C<$flags> parameter
+can take the bitwise union of the values:
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_JOB_SPEED_BANDWIDTH_BYTES
+
+The C<$bandwidth> parameter value is measured in bytes/s
+instead of MB/s.
+
+=back
 
 =item $dom->abort_block_job($path, $flags=0)
 
@@ -1341,20 +1513,73 @@ associated with C<$path>
 
 Merge the backing files associated with C<$path> into the
 top level file. The C<$bandwidth> parameter specifies the
-maximum I/O rate to allow in MB/s.
+maximum I/O rate to allow in MB/s. The C<$flags> parameter
+can take the bitwise union of the values:
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_PULL_BANDWIDTH_BYTES
+
+The C<$bandwidth> parameter value is measured in bytes/s
+instead of MB/s.
+
+=back
 
 =item $dom->block_rebase($path, $base, $bandwith, $flags=0)
 
 Switch the backing path associated with C<$path> to instead
 use C<$base>. The C<$bandwidth> parameter specifies the
-maximum I/O rate to allow in MB/s.
+maximum I/O rate to allow in MB/s. The C<$flags> parameter
+can take the bitwise union of the values:
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_REBASE_BANDWIDTH_BYTES
+
+The C<$bandwidth> parameter value is measured in bytes/s
+instead of MB/s.
+
+=back
+
+=item $dom->block_copy($path, $destxml, $params, $flags=0)
+
+Copy contents of a disk image <$path> into the target volume
+described by C<$destxml> which follows the schema of the
+<disk> element in the domain XML. The C<$params> parameter
+is a hash of optional parameters to control the process
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_COPY_BANDWIDTH
+
+The maximum bandwidth in bytes per second.
+
+=item Sys::Virt::Domain::BLOCK_COPY_GRANULARITY
+
+The granularity in bytes of the copy process
+
+=item Sys::Virt::Domain::BLOCK_COPY_BUF_SIZE
+
+The maximum amount of data in flight in bytes.
+
+=back
 
 =item $dom->block_commit($path, $base, $top, $bandwith, $flags=0)
 
 Commit changes there were made to the temporary top level file C<$top>.
 Takes all the differences between C<$top> and C<$base> and merge them
 into C<$base>. The C<$bandwidth> parameter specifies the
-maximum I/O rate to allow in MB/s.
+maximum I/O rate to allow in MB/s.  The C<$flags> parameter
+can take the bitwise union of the values:
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_COMMIT_BANDWIDTH_BYTES
+
+The C<$bandwidth> parameter value is measured in bytes
+instead of MB/s.
+
+=back
 
 =item $count = $dom->num_of_snapshots()
 
@@ -1450,6 +1675,104 @@ to remove chunks of unused space that are at least
 C<$minimum> bytes in length. C<$flags> is currently
 unused and defaults to zero.
 
+=item $dom->fs_freeze(\@mountPoints, $flags=0);
+
+Freeze all the filesystems associated with the C<@mountPoints>
+array reference. If <@mountPoints> is an empty list, then all
+filesystems will be frozen. C<$flags> is currently
+unused and defaults to zero.
+
+=item $dom->fs_thaw(\@mountPoints, $flags=0);
+
+Thaw all the filesystems associated with the C<@mountPoints>
+array reference. If <@mountPoints> is an empty list, then all
+filesystems will be thawed. C<$flags> is currently
+unused and defaults to zero.
+
+=item @fslist = $dom->get_fs_info($flags=0);
+
+Obtain a list of all guest filesystems. The returned list will
+contain one element for each filesystem, whose value will be
+a hash reference with the following keys
+
+=over 4
+
+=item name
+
+The name of the guest device that is mounted
+
+=item fstype
+
+The filesystem type (eg 'ext4', 'fat', 'ntfs', etc)
+
+=item mountpoint
+
+The location in the filesystem tree of the mount
+
+=item devalias
+
+An array reference containing list of device aliases
+associated with the guest device. The device aliases
+correspond to disk target names in the guest XML
+configuration
+
+=back
+
+=item @nics = $dom->get_interface_addresses($src, $flags=0);
+
+Obtain a list of all guest network interfaces. The C<$src>
+parameter is one of the constants
+
+=over 4
+
+=item Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_LEASE
+
+Extract the DHCP server lease information
+
+=item Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_AGENT
+
+Query the guest OS via an agent
+
+=back
+
+The returned list will contain one element for each interface.
+The values in the list will be a hash reference with the
+following keys
+
+=over 4
+
+=item name
+
+The name of the guest interface that is mounted
+
+=item hwaddr
+
+The hardware address, aka MAC, if available.
+
+=item addrs
+
+An array reference containing list of IP addresses
+associated with the guest NIC. Each element in the
+array is a further hash containing
+
+=over 4
+
+=item addr
+
+The IP address string
+
+=item prefix
+
+The IP address network prefix
+
+=item type
+
+The IP address type (IPv4 vs IPv6)
+
+=back
+
+=back
+
 =item $dom->send_process_signal($pid, $signum, $flags=0);
 
 Send the process C<$pid> the signal C<$signum>. The
@@ -1533,6 +1856,29 @@ The control channel is busy with a job
 
 =back
 
+If the status is C<Sys::Virt::Domain::CONTROL_ERROR>, then one
+of the following constants describes the reason
+
+=over 4
+
+=item Sys::Virt::Domain::CONTROL_ERROR_REASON_NONE
+
+There is no reason for the error available
+
+=item Sys::Virt::Domain::CONTROL_ERROR_REASON_UNKNOWN
+
+The reason for the error is unknown
+
+=item Sys::Virt::Domain::CONTROL_ERROR_REASON_INTERNAL
+
+There was an internal error in libvirt
+
+=item Sys::Virt::Domain::CONTROL_ERROR_REASON_MONITOR
+
+There was an error speaking to the monitor
+
+=back
+
 =head2 DOMAIN CREATION
 
 The following constants can be used to control the behaviour
@@ -1556,8 +1902,24 @@ Do not use OS I/O cache if starting a domain with a saved state image
 
 Boot the guest, even if there was a saved snapshot
 
+=item Sys::Virt::Domain::START_VALIDATE
+
+Validate the XML document against the XML schema
+
 =back
 
+=head2 DOMAIN DEFINE
+
+The following constants can be used to control the behaviour
+of domain define operations
+
+=over 4
+
+=item Sys::Virt::Domain::DEFINE_VALIDATE
+
+Validate the XML document against the XML schema
+
+=back
 
 =head2 KEYCODE SETS
 
@@ -1865,6 +2227,15 @@ Enable compression of the migration data stream
 
 Abort if an I/O error occurrs on the disk
 
+=item Sys::Virt::Domain::MIGRATE_AUTO_CONVERGE
+
+Force convergance of the migration operation by
+throttling guest runtime
+
+=item Sys::Virt::Domain::MIGRATE_RDMA_PIN_ALL
+
+Pin memory for RDMA transfer
+
 =back
 
 =head2 UNDEFINE CONSTANTS
@@ -1884,6 +2255,11 @@ domain
 Also remove any snapshot metadata when undefining the virtual
 domain.
 
+=item Sys::Virt::Domain::UNDEFINE_NVRAM
+
+Also remove any NVRAM state file when undefining the virtual
+domain.
+
 =back
 
 =head2 JOB TYPES
@@ -1965,6 +2341,22 @@ The I/O weight parameter
 
 The per-device I/O weight parameter
 
+=item Sys::Virt::Domain::BLKIO_DEVICE_READ_BPS
+
+The per-device I/O bytes read per second
+
+=item Sys::Virt::Domain::BLKIO_DEVICE_READ_IOPS
+
+The per-device I/O operations read per second
+
+=item Sys::Virt::Domain::BLKIO_DEVICE_WRITE_BPS
+
+The per-device I/O bytes write per second
+
+=item Sys::Virt::Domain::BLKIO_DEVICE_WRITE_IOPS
+
+The per-device I/O operations write per second
+
 =back
 
 =head2 BLKIO TUNING PARAMETERS
@@ -1998,6 +2390,34 @@ The I/O operations read per second.
 
 The I/O operations written per second.
 
+=item Sys::Virt::Domain::BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX
+
+The maximum total bytes processed per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_READ_BYTES_SEC_MAX
+
+The maximum bytes read per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX
+
+The maximum bytes written per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX
+
+The maximum total I/O operations processed per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_READ_IOPS_SEC_MAX
+
+The maximum I/O operations read per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX
+
+The maximum I/O operations written per second.
+
+=item Sys::Virt::Domain::BLOCK_IOTUNE_SIZE_IOPS_SEC
+
+The maximum I/O operations per second
+
 =back
 
 =head2 SCHEDULER CONSTANTS
@@ -2379,7 +2799,13 @@ Errors from the virtualization control channel
 
 =item Sys::Virt::Domain::EVENT_ID_BLOCK_JOB
 
-Completion status of asynchronous block jobs
+Completion status of asynchronous block jobs,
+identified by source file name.
+
+=item Sys::Virt::Domain::EVENT_ID_BLOCK_JOB_2
+
+Completion status of asynchronous block jobs,
+identified by target device name.
 
 =item Sys::Virt::Domain::EVENT_ID_DISK_CHANGE
 
@@ -2405,10 +2831,57 @@ Power management initiated wakeup
 
 Balloon target changes
 
+=item Sys::Virt::Domain::EVENT_ID_DEVICE_ADDED
+
+Asynchronous guest device addition
+
 =item Sys::Virt::Domain::EVENT_ID_DEVICE_REMOVED
 
 Asynchronous guest device removal
 
+=item Sys::Virt::Domain::EVENT_ID_TUNABLE
+
+Changes of any domain tuning parameters. The callback
+will be provided with a hash listing all changed parameters.
+The later DOMAIN TUNABLE constants can be useful when accessing
+the hash keys
+
+=item Sys::Virt::Domain::EVENT_ID_AGENT_LIFECYCLE
+
+Domain guest agent lifecycle events. The C<state> parameter
+to the callback will match one of the constants
+
+=over 4
+
+=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_CONNECTED
+
+The agent is now connected
+
+=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED
+
+The agent is now disconnected
+
+=back
+
+The second parameter, C<reason>, matches one of the following
+constants
+
+=over 4
+
+=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN
+
+The reason is unknown
+
+=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED
+
+The domain was initially booted
+
+=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_CHANNEL
+
+The channel on a running guest changed state
+
+=back
+
 =back
 
 =head2 IO ERROR EVENT CONSTANTS
@@ -2513,7 +2986,11 @@ These constants describe the reason for a disk change event
 
 =item Sys::Virt::Domain::EVENT_DISK_CHANGE_MISSING_ON_START
 
-The disk media was missing when attempting to start the guest
+The disk media was cleared, as its source was missing when attempting to start the guest
+
+=item Sys::Virt::Domain::EVENT_DISK_DROP_MISSING_ON_START
+
+The disk device was dropped, as its source was missing whe  attempting to start the guest
 
 =back
 
@@ -2556,6 +3033,10 @@ The block copy job type
 
 The block commit job type
 
+=item Sys::Virt::Domain::BLOCK_JOB_TYPE_ACTIVE_COMMIT
+
+The block active commit job type
+
 =back
 
 =head2 DOMAIN BLOCK JOB COMPLETION CONSTANTS
@@ -2605,6 +3086,30 @@ Make destination file raw
 
 Start a copy job
 
+=item Sys::Virt::Domain::BLOCK_REBASE_COPY_DEV
+
+Treat destination as a block device instead of file
+
+=item Sys::Virt::Domain::BLOCK_REBASE_RELATIVE
+
+Keep backing chain referenced using relative names
+
+=back
+
+=head2 DOMAIN BLOCK COPY CONSTANTS
+
+The following constants are useful when copying block devices
+
+=over 4
+
+=item Sys::Virt::Domain::BLOCK_COPY_SHALLOW
+
+Limit copy to top of source backing chain
+
+=item Sys::Virt::Domain::BLOCK_COPY_REUSE_EXT
+
+Reuse existing external file for copy
+
 =back
 
 =head2 DOMAIN BLOCK JOB ABORT CONSTANTS
@@ -2637,6 +3142,14 @@ Delete any files that are invalid after commit
 
 NULL base means next backing file, not whole chain
 
+=item Sys::Virt::Domain::BLOCK_COMMIT_ACTIVE
+
+Allow two phase commit when top is active layer
+
+=item Sys::Virt::Domain::BLOCK_COMMIT_RELATIVE
+
+Keep backing chain referenced using relative names
+
 =back
 
 =head2 DOMAIN SAVE / RESTORE CONSTANTS
@@ -2736,6 +3249,10 @@ Shutdown by talking to initctl (containers only)
 
 Shutdown by sending SIGTERM to the init process
 
+=item Sys::Virt::Domain::SHUTDOWN_PARAVIRT
+
+Shutdown by issuing a paravirt power control command
+
 =back
 
 =head2 REBOOT CONSTANTS
@@ -2765,6 +3282,10 @@ Reboot by talking to initctl (containers only)
 
 Reboot by sending SIGHUP to the init process
 
+=item Sys::Virt::Domain::REBOOT_PARAVIRT
+
+Reboot by issuing a paravirt power control command
+
 =back
 
 =head2 METADATA CONSTANTS
@@ -3013,6 +3534,88 @@ The quota for the emulator in one schedular time period
 
 =back
 
+=head2 DOMAIN STATS FLAG CONSTANTS
+
+The following constants are used as flags when requesting
+bulk domain stats from C<Sys::Virt::get_all_domain_stats>.
+
+=over 4
+
+=item Sys::Virt::Domain::GET_ALL_STATS_ACTIVE
+
+Include stats for active domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_INACTIVE
+
+Include stats for inactive domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_OTHER
+
+Include stats for other domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_PAUSED
+
+Include stats for paused domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_PERSISTENT
+
+Include stats for persistent domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_RUNNING
+
+Include stats for running domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_SHUTOFF
+
+Include stats for shutoff domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_TRANSIENT
+
+Include stats for transient domains
+
+=item Sys::Virt::Domain::GET_ALL_STATS_ENFORCE_STATS
+
+Require that all requested stats fields are returned
+
+=item Sys::Virt::Domain::GET_ALL_STATS_BACKING
+
+Get stats for image backing files too
+
+=back
+
+=head2 DOMAIN STATS FIELD CONSTANTS
+
+The following constants are used to control which fields
+are returned for stats queries.
+
+=over
+
+=item Sys::Virt::Domain::STATS_BALLOON
+
+Balloon statistics
+
+=item Sys::Virt::Domain::STATS_BLOCK
+
+Block device info
+
+=item Sys::Virt::Domain::STATS_CPU_TOTAL
+
+CPU usage info
+
+=item Sys::Virt::Domain::STATS_INTERFACE
+
+Network interface info
+
+=item Sys::Virt::Domain::STATS_STATE
+
+General lifecycle state
+
+=item Sys::Virt::Domain::STATS_VCPU
+
+Virtual CPU info
+
+=back
+
 =head2 PROCESS SIGNALS
 
 The following constants provide the names of signals
@@ -3283,6 +3886,103 @@ SIGRT32
 
 =back
 
+=head2 DOMAIN TUNABLE CONSTANTS
+
+The following constants are useful when accessing domain
+tuning parameters in APIs and events
+
+=over 4
+
+=item Sys::Virt::Domain::TUNABLE_CPU_CPU_SHARES
+
+Proportional CPU weight
+
+=item Sys::Virt::Domain::TUNABLE_CPU_EMULATORPIN
+
+Emulator thread CPU pinning mask
+
+=item Sys::Virt::Domain::TUNABLE_CPU_EMULATOR_PERIOD
+
+Emulator thread CPU period
+
+=item Sys::Virt::Domain::TUNABLE_CPU_EMULATOR_QUOTA
+
+Emulator thread CPU quota
+
+=item Sys::Virt::Domain::TUNABLE_CPU_VCPUPIN
+
+VCPU thread pinning mask
+
+=item Sys::Virt::Domain::TUNABLE_CPU_VCPU_PERIOD
+
+VCPU thread period
+
+=item Sys::Virt::Domain::TUNABLE_CPU_VCPU_QUOTA
+
+VCPU thread quota
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_DISK
+
+The name of guest disks
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SEC
+
+Read throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SEC
+
+Read throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SEC
+
+Total throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SEC
+
+Total throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SEC
+
+Write throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SEC
+
+Write throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SEC_MAX
+
+Maximum read throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SEC_MAX
+
+Maximum read throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX
+
+Maximum total throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX
+
+Maximum total throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX
+
+Maximum write throughput in bytes per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX
+
+Maximum write throughput in I/O operations per sec
+
+=item Sys::Virt::Domain::TUNABLE_BLKDEV_SIZE_IOPS_SEC
+
+The maximum I/O operations per second
+
+=item Sys::Virt::Domain::TUNABLE_IOTHREADSPIN
+
+The I/O threads pinning
+
+=back
+
 =head1 AUTHORS
 
 Daniel P. Berrange <berrange@redhat.com>
@@ -362,6 +362,26 @@ The access control code
 
 The systemd init service
 
+=item Sys::Virt::Error::FROM_BHYVE
+
+The FreeBSD BHyve driver
+
+=item Sys::Virt::Error::FROM_CRYPTO
+
+The cryptographic helper APIs.
+
+=item Sys::Virt::Error::FROM_FIREWALL
+
+The firewall helper APIs.
+
+=item Sys::Virt::Error::FROM_POLKIT
+
+The polkit authentication / authorization APIs
+
+=item Sys::Virt::Error::FROM_THREAD
+
+The thread helper utils
+
 =back
 
 =head2 ERROR CODE CONSTANTS
@@ -732,6 +752,18 @@ Not authorized to perform the operation
 
 An error from a DBus service API
 
+=item Sys::Virt::Error::ERR_STORAGE_VOL_EXIST
+
+The storage volume already exists
+
+=item Sys::Virt::Error::ERR_CPU_INCOMPATIBLE
+
+The CPUs are not compatible
+
+=item Sys::Virt::Error::ERR_INVALID_SCHEMA
+
+The XML document does not comply with the XML schema
+
 =back
 
 =head1 AUTHORS
@@ -143,6 +143,56 @@ start upon boot. Return false, otherwise
 Set the state of the autostart flag, which determines whether the
 virtual network will automatically start upon boot of the host OS.
 
+=item @leases = $net->get_dhcp_leases($mac=undef, $flags=0)
+
+Get a list of all active DHCP leases. If C<$mac> is undefined than
+leases for all VMs are returned, otherwise only leases for the
+matching MAC address are returned. The C<$flags> parameter is
+currently unused and defaults to zero.
+
+The elements in the returned array are hash references with
+the following fields
+
+=over 4
+
+=item C<iface>
+
+Network interface name
+
+=item C<expirytime>
+
+Seconds since the epoch until the lease expires
+
+=item C<type>
+
+One of the Sys::Virt IP address type constants
+
+=item C<mac>
+
+The MAC address of the lease
+
+=item C<iaid>
+
+The IAID of the client
+
+=item C<ipaddr>
+
+The IP address of the lease
+
+=item C<prefix>
+
+The IP address prefix
+
+=item C<hostname>
+
+The optional hostname associated with the lease
+
+=item C<clientid>
+
+The client ID or DUID
+
+=back
+
 =back
 
 =head1 CONSTANTS
@@ -299,6 +349,44 @@ Insert the matching entry at the end
 
 =back
 
+=head2 EVENT ID CONSTANTS
+
+=over 4
+
+=item Sys::Virt::Network::EVENT_ID_LIFECYCLE
+
+Network lifecycle events
+
+=back
+
+=head2 LIFECYCLE CHANGE EVENTS
+
+The following constants allow network lifecycle change events to be
+interpreted. The events contain both a state change, and a
+reason though the reason is currently unsed.
+
+=over 4
+
+=item Sys::Virt::Network::EVENT_DEFINED
+
+Indicates that a persistent configuration has been defined for
+the network.
+
+=item Sys::Virt::Network::EVENT_STARTED
+
+The network has started running
+
+=item Sys::Virt::Network::EVENT_STOPPED
+
+The network has stopped running
+
+=item Sys::Virt::Network::EVENT_UNDEFINED
+
+The persistent configuration has gone away
+
+=back
+
+
 =cut
 
 
@@ -51,10 +51,11 @@ sub _new {
     my $self;
     if (exists $params{name}) {
 	$self = Sys::Virt::NodeDevice::_lookup_by_name($con,  $params{name});
-    } elsif (exists $params{wwpn}) {
+    } elsif (exists $params{wwnn}) {
 	$self = Sys::Virt::NodeDevice::_lookup_scsihost_by_wwn($con,
+							       $params{wwnn},
 							       $params{wwpn},
-							       $params{wwnn});
+							       $params{flags});
     } elsif (exists $params{xml}) {
 	$self = Sys::Virt::NodeDevice::_create_xml($con, $params{xml});
     } else {
@@ -439,6 +439,13 @@ Include SCSI storage pools
 
 Include sheepdog storage pools
 
+=item Sys::Virt::StoragePool::LIST_GLUSTER
+
+Include gluster storage pools
+
+=item Sys::Virt::StoragePool::LIST_ZFS
+
+Include ZFS storage pools
 
 =back
 
@@ -171,6 +171,10 @@ The volume is a directory
 
 The volume is a network source
 
+=item Sys::Virt::StorageVol::TYPE_NETDIR
+
+The volume is a network directory
+
 =back
 
 =head2 CREATE MODES
@@ -184,6 +188,10 @@ the C<create> method
 
 Preallocate header metadata when creating the volume.
 
+=item Sys::Virt::StorageVol::CREATE_REFLINK
+
+Perform lightweight reference copy
+
 =back
 
 =head2 DELETE MODES
@@ -78,7 +78,7 @@ use Sys::Virt::NWFilter;
 use Sys::Virt::DomainSnapshot;
 use Sys::Virt::Stream;
 
-our $VERSION = '1.1.1';
+our $VERSION = '1.2.16';
 require XSLoader;
 XSLoader::load('Sys::Virt', $VERSION);
 
@@ -262,7 +262,7 @@ sub create_domain_with_files {
 				   fds => $fds, flags => $flags);
 }
 
-=item my $dom = $vmm->define_domain($xml);
+=item my $dom = $vmm->define_domain($xml, $flags=0);
 
 Defines, but does not start, a new domain based on the XML description
 passed into the C<$xml> parameter. The returned object is an instance
@@ -276,8 +276,9 @@ object.
 sub define_domain {
     my $self = shift;
     my $xml = shift;
+    my $flags = shift || 0;
 
-    return Sys::Virt::Domain->_new(connection => $self, xml => $xml, nocreate => 1);
+    return Sys::Virt::Domain->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags);
 }
 
 =item my $dom = $vmm->create_network($xml);
@@ -790,7 +791,7 @@ sub list_secrets {
     my $self = shift;
 
     my $nuuids = $self->num_of_secrets();
-    my @uuids = $self->list_secrets($nuuids);
+    my @uuids = $self->list_secret_uuids($nuuids);
 
     my @secrets;
     foreach my $uuid (@uuids) {
@@ -1161,6 +1162,22 @@ C<$flags> parameter is optional, and if omitted defaults to zero. The
 returned scalar is an XML document describing the discovered storage
 pool sources.
 
+=item my @stats = $vmm->get_all_domain_stats($stats, \@doms=undef, $flags=0);
+
+Get an list of all statistics for domains known to the hypervisor.
+The C<$stats> parameter controls which data fields to return and
+should be a combination of the DOMAIN STATS FIELD CONSTANTS.
+
+The optional C<@doms> parameter is a list of Sys::Virt::Domain objects
+to return stats for. If this is undefined, then all domains will be
+returned. The C<$flags> method can be used to filter the list of
+returned domains.
+
+The return data for the method is a list, one element for each domain.
+The element will be a hash with two keys, C<dom> pointing to an instance
+of C<Sys::Virt::Domain> and C<data> pointing to another hash reference
+containing the actual statistics.
+
 =item $vmm->interface_change_begin($flags)
 
 Begin a transaction for changing the configuration of one or more
@@ -1531,6 +1548,38 @@ unregistering the event.
 Unregister a callback, associated with the C<$callbackID> previously
 obtained from C<domain_event_register_any>.
 
+=item $callback = $conn->network_event_register_any($dom, $eventID, $callback)
+
+Register a callback to received notifications of network events.
+The C<$dom> parameter can be C<undef> to request events on all
+known networks, or a specific C<Sys::Virt::Network> object to
+filter events. The C<$eventID> parameter is one of the EVENT ID
+constants described later in this document. The C<$callback> is
+a subroutine reference that will receive the events.
+
+All callbacks receive a C<Sys::Virt> connection as the first parameter
+and a C<Sys::Virt::Network> object indiciating the network on which the
+event occurred as the second parameter. Subsequent parameters vary
+according to the event type
+
+=over
+
+=item EVENT_ID_LIFECYCLE
+
+Extra C<event> and C<detail> parameters defining the lifecycle
+transition that occurred.
+
+=back
+
+The return value is a unique callback ID that must be used when
+unregistering the event.
+
+
+=item $conn->network_event_deregister_any($callbackID)
+
+Unregister a callback, associated with the C<$callbackID> previously
+obtained from C<network_event_register_any>.
+
 =item $conn->register_close_callback($coderef);
 
 Register a callback to be invoked when the connection is closed.
@@ -1548,7 +1597,28 @@ Remove the previously registered close callback.
 Given an array ref whose elements are XML documents describing host CPUs,
 compute the baseline CPU model that is operable across all hosts. The
 XML for the baseline CPU model is returned. The optional C<$flags>
-parameter is currently unused and defaults to 0.
+parameter can take one of
+
+=over 4
+
+=item Sys::Virt::BASELINE_CPU_EXPAND_FEATURES
+
+Expand the CPU definition to list all feature flags, even those
+implied by the model name.
+
+=item Sys::Virt::BASELINE_CPU_MIGRATABLE
+
+Only include features which can be live migrated.
+
+=back
+
+=item @names = $con->get_cpu_model_names($arch, $flags=0)
+
+Get a list of valid CPU models names for the architecture
+given by C<$arch>. The C<$arch> value should be one of the
+architectures listed in the capabilities XML document.
+The C<$flags> parameter is currently unused and defaults
+to 0.
 
 =item my $info = $con->get_node_security_model()
 
@@ -1561,12 +1631,32 @@ specifying the 'domain of interpretation' for security labels.
 
 Returns an XML document describing the hypervisor capabilities
 
+=item my $xml = $con->get_domain_capabilities($emulator, $arch, $machine, $virttype, flags=0);
+
+Returns an XML document describing the capabilities of the
+requested guest configuration. Either C<$emulator> or C<$arch>
+must be a valid string referring to an emulator binary or an
+architecture name respectively. The C<$machine> parameter is
+an optional name of a guest machine, and C<$virttype> is an
+optional name of the virtualization type. C<$flags> is unused
+and defaults to zero.
+
 =item my $result = $con->compare_cpu($xml, $flags=0);
 
 Checks whether the CPU definition in C<$xml> is compatible with the
 current hypervisor connection. This can be used to determine whether
 it is safe to migrate a guest to this host. The returned result is
-one of the constants listed later
+one of the constants listed later The optional C<$flags> parameter
+can take one of the following constants
+
+=over 4
+
+=item Sys::Virt::COMPARE_CPU_FAIL_INCOMPATIBLE
+
+Raise a fatal error if the CPUs are not compatible, instead of
+just returning a special error code.
+
+=back
 
 =item $mem = $con->get_node_free_memory();
 
@@ -1576,6 +1666,43 @@ Returns the current free memory on the host
 
 Returns the free memory on each NUMA cell between C<$start> and C<$end>.
 
+=item @pages = $con->get_node_free_pages(\@pagesizes, $start, $end);
+
+Returns information about the number of pages free on each NUMA cell
+between C<$start> and C<$end> inclusive. The C<@pagesizes> parameter
+should be an arrayref specifying which pages sizes information should
+be returned for. Information about supported page sizes is available
+in the capabilities XML. The returned array has an element for each
+NUMA cell requested. The elements are hash references with two keys,
+'cell' specifies the NUMA cell number and 'pages' specifies the
+free page information for that cell. The 'pages' value is another
+hash reference where the keys are the page sizes and the values
+are the free count for that size.
+
+=item $con->node_alloc_pages(\@pages, $start, $end, $flags=0)
+
+Allocate further huge pages for the reserved pool. The <\@pages>
+parameter is an array reference with one entry per page size to
+allocate for. Each entry is a further array reference where the
+first element is the page size and the second element is the
+page count. The same number of pages will be allocated on each
+NUMA node in the range C<$start> to C<$end> inclusive. The
+C<$flags> parameter accepts two contants
+
+=over 4
+
+=item Sys::Virt::NODE_ALLOC_PAGES_ADD
+
+The requested number of pages will be added to the existing huge
+page reservation.
+
+=item Sys::Virt::NODE_ALLOC_PAGES_SET
+
+The huge page reservation will be set to exactly the requested
+number
+
+=back
+
 =back
 
 =head1 CONSTANTS
@@ -1736,6 +1863,10 @@ How many pages changing too fast to be placed in a tree.
 
 How many milliseconds the shared memory service should sleep before next scan.
 
+=item Sys::Virt::NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
+
+Whether pages can be merged across NUMA nodes
+
 =back
 
 =head2 CLOSE REASON CONSTANTS
@@ -1787,6 +1918,10 @@ Time spent executing kernel code
 
 Time spent executing user code
 
+=item Sys::Virt::NODE_CPU_STATS_INTR
+
+Time spent processing interrupts
+
 =item Sys::Virt::NODE_CPU_STATS_UTILIZATION
 
 Percentage utilization of the CPU.
@@ -1817,6 +1952,22 @@ The total amount of memory
 
 =back
 
+=head2 IP address constants
+
+The following constants are used to interpret IP address types
+
+=over 4
+
+=item Sys::Virt::IP_ADDR_TYPE_IPV4
+
+An IPv4 address type
+
+=item Sys::Virt::IP_ADDR_TYPE_IPV6
+
+An IPv6 address type
+
+=back
+
 =head1 BUGS
 
 Hopefully none, but the XS code needs to be audited to ensure it
@@ -1,7 +1,7 @@
 # Automatically generated by perl-Sys-Virt.spec.PL
 
 Name:           perl-Sys-Virt
-Version:        1.1.1
+Version:        1.2.16
 Release:        1%{?dist}%{?extra_release}
 Summary:        Represent and manage a libvirt hypervisor connection
 License:        GPLv2+ or Artistic
@@ -87,7 +87,12 @@ virConnectDomainEventPMSuspendDiskCallback
 virConnectDomainEventPMWakeupCallback
 virConnectDomainEventTrayChangeCallback
 virConnectDomainEventBalloonChangeCallback
+virConnectDomainEventDeviceAddedCallback
 virConnectDomainEventDeviceRemovedCallback
+virConnectDomainEventTunableCallback
+virConnectDomainEventAgentLifecycleCallback
+
+virConnectNetworkEventLifecycleCallback
 
 virEventAddHandleFunc
 virEventAddTimeoutFunc
@@ -125,6 +130,8 @@ virTypedParamsGetLLong
 virTypedParamsGetString
 virTypedParamsGetUInt
 virTypedParamsGetULLong
+
+virNetworkDHCPLeaseFree
 );
 
 foreach my $func (sort { $a cmp $b } @functions) {
@@ -161,6 +168,7 @@ VIR_CPU_USED
 VIR_DOMAIN_BLKIO_FIELD_LENGTH
 VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH
 VIR_DOMAIN_EVENT_CALLBACK
+VIR_NETWORK_EVENT_CALLBACK
 VIR_DOMAIN_MEMORY_FIELD_LENGTH
 VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
 VIR_DOMAIN_SCHED_FIELD_LENGTH
@@ -179,6 +187,7 @@ VIR_UUID_STRING_BUFLEN
 _virBlkioParameter
 _virMemoryParameter
 _virSchedParameter
+LIBVIR_CHECK_VERSION
 );
 
 foreach my $macro (sort { $a cmp $b } @macros) {
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 24;
+use Test::More tests => 25;
 use XML::XPath;
 use XML::XPath::XMLParser;
 use Sys::Hostname;
@@ -77,3 +77,7 @@ SKIP: {
 
 ok($conn->is_secure(), "connection is secure");
 ok(!$conn->is_encrypted(), "connection is not encrypted");
+
+my @models = $conn->get_cpu_model_names($info->{model});
+
+ok($#models > -1, "got some cpu models");