[Pkg-libvirt-commits] [ruby-libvirt] 01/02: New upstream version 0.6.0
Guido Guenther
agx at moszumanska.debian.org
Thu Feb 4 16:27:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
agx pushed a commit to branch debian/experimental
in repository ruby-libvirt.
commit dc7846fdf0dddf6820e826be68ab1f293bd7f992
Author: Guido Günther <agx at sigxcpu.org>
Date: Thu Feb 4 17:04:56 2016 +0100
New upstream version 0.6.0
---
NEWS | 17 ++-
Rakefile | 5 +-
ext/libvirt/common.c | 27 ++--
ext/libvirt/common.h | 10 ++
ext/libvirt/connect.c | 263 +++++++++++++++++++++++++-------
ext/libvirt/domain.c | 382 ++++++++++++++++++++++++++++++++++++++++++-----
ext/libvirt/extconf.h | 380 ++++++++++++++++++++++++++++++++++++++++++++++
ext/libvirt/extconf.rb | 32 ++++
ext/libvirt/interface.c | 6 +-
ext/libvirt/network.c | 103 ++++++++++++-
ext/libvirt/nodedevice.c | 8 +-
ext/libvirt/nwfilter.c | 6 +-
ext/libvirt/secret.c | 10 +-
ext/libvirt/storage.c | 27 ++--
tests/test_conn.rb | 24 ++-
tests/test_domain.rb | 6 +-
tests/test_interface.rb | 8 +-
tests/test_network.rb | 2 +-
tests/test_nwfilter.rb | 2 +-
tests/test_storage.rb | 10 +-
tests/test_utils.rb | 20 +--
21 files changed, 1172 insertions(+), 176 deletions(-)
diff --git a/NEWS b/NEWS
index eb5e7d9..8af4530 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,20 @@
-2014-01-08
+2015-11-20 0.6.0
+ * Fix possible buffer overflow
+ * Fix storage volume creation error messages
+ * Add additional storage pool defines
+ * Implement Network dhcp_leases method
+ * Implement Connect node_alloc_pages method
+ * Implement Domain time method
+ * Implement Connect domain_capabilities method
+ * Implement Domain core_dump_with_format method
+ * Implement Domain fs_freeze method
+ * Implement Domain fs_info method
+ * Implement Connect node_free_pages method
+
+2014-01-08 0.5.2
* Fix to make sure we don't free more entires than retrieved
-2013-12-15
+2013-12-15 0.5.1
* Fixes to compile against older libvirt
* Fixes to compile against ruby 1.8
diff --git a/Rakefile b/Rakefile
index 4155f0e..331cd30 100644
--- a/Rakefile
+++ b/Rakefile
@@ -21,7 +21,7 @@ require 'rubygems/package_task'
require 'rbconfig'
PKG_NAME='ruby-libvirt'
-PKG_VERSION='0.5.2'
+PKG_VERSION='0.6.0'
EXT_CONF='ext/libvirt/extconf.rb'
MAKEFILE="ext/libvirt/Makefile"
@@ -37,8 +37,7 @@ LIBVIRT_SRC << MAKEFILE
CLEAN.include [ "ext/**/*.o", LIBVIRT_MODULE, "ext/**/depend", "ext/**/*.gcda",
"ext/**/*.gcno", "ext/**/*.gcov" ]
-CLOBBER.include [ "config.save", "ext/**/mkmf.log", "ext/**/extconf.h",
- MAKEFILE ]
+CLOBBER.include [ "ext/**/mkmf.log", "ext/**/extconf.h", MAKEFILE ]
task :default => :build
diff --git a/ext/libvirt/common.c b/ext/libvirt/common.c
index bbb2c95..be483fd 100644
--- a/ext/libvirt/common.c
+++ b/ext/libvirt/common.c
@@ -2,7 +2,7 @@
* common.c: Common utilities for the ruby libvirt bindings
*
* Copyright (C) 2007,2010 Red Hat Inc.
- * Copyright (C) 2013 Chris Lalancette <clalancette at gmail.com>
+ * Copyright (C) 2013,2014 Chris Lalancette <clalancette at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -84,6 +84,15 @@ VALUE ruby_libvirt_hash_aset_wrap(VALUE arg)
return rb_hash_aset(e->hash, rb_str_new2(e->name), e->val);
}
+VALUE ruby_libvirt_str_new2_and_ary_store_wrap(VALUE arg)
+{
+ struct ruby_libvirt_str_new2_and_ary_store_arg *e = (struct ruby_libvirt_str_new2_and_ary_store_arg *)arg;
+
+ rb_ary_store(e->arr, e->index, rb_str_new2(e->value));
+
+ return Qnil;
+}
+
void ruby_libvirt_raise_error_if(const int condition, VALUE error,
const char *method, virConnectPtr conn)
{
@@ -186,7 +195,7 @@ VALUE ruby_libvirt_generate_list(int num, char **list)
VALUE result;
int exception = 0;
int i, j;
- struct ruby_libvirt_ary_store_arg arg;
+ struct ruby_libvirt_str_new2_and_ary_store_arg arg;
i = 0;
@@ -197,15 +206,13 @@ VALUE ruby_libvirt_generate_list(int num, char **list)
for (i = 0; i < num; i++) {
arg.arr = result;
arg.index = i;
- arg.elem = rb_protect(ruby_libvirt_str_new2_wrap, (VALUE)&(list[i]),
- &exception);
- if (exception) {
- goto exception;
- }
- rb_protect(ruby_libvirt_ary_store_wrap, (VALUE)&arg, &exception);
+ arg.value = list[i];
+ rb_protect(ruby_libvirt_str_new2_and_ary_store_wrap, (VALUE)&arg,
+ &exception);
if (exception) {
goto exception;
}
+
xfree(list[i]);
}
@@ -373,8 +380,10 @@ int ruby_libvirt_typed_parameter_assign(VALUE key, VALUE val, VALUE in)
default:
rb_raise(rb_eArgError, "Invalid parameter type");
}
+ /* ensure that the field is NULL-terminated */
+ args->params[args->i].field[VIR_TYPED_PARAM_FIELD_LENGTH - 1] = '\0';
strncpy(args->params[args->i].field, keyname,
- VIR_TYPED_PARAM_FIELD_LENGTH);
+ VIR_TYPED_PARAM_FIELD_LENGTH - 1);
(args->i)++;
found = 1;
break;
diff --git a/ext/libvirt/common.h b/ext/libvirt/common.h
index f905247..6329528 100644
--- a/ext/libvirt/common.h
+++ b/ext/libvirt/common.h
@@ -232,11 +232,13 @@ unsigned long ruby_libvirt_value_to_ulong(VALUE in);
unsigned long long ruby_libvirt_value_to_ulonglong(VALUE in);
VALUE ruby_libvirt_ary_new2_wrap(VALUE arg);
+
struct ruby_libvirt_ary_push_arg {
VALUE arr;
VALUE value;
};
VALUE ruby_libvirt_ary_push_wrap(VALUE arg);
+
struct ruby_libvirt_ary_store_arg {
VALUE arr;
long index;
@@ -245,6 +247,7 @@ struct ruby_libvirt_ary_store_arg {
VALUE ruby_libvirt_ary_store_wrap(VALUE arg);
VALUE ruby_libvirt_str_new2_wrap(VALUE arg);
+
struct ruby_libvirt_str_new_arg {
char *val;
size_t size;
@@ -258,6 +261,13 @@ struct ruby_libvirt_hash_aset_arg {
};
VALUE ruby_libvirt_hash_aset_wrap(VALUE arg);
+struct ruby_libvirt_str_new2_and_ary_store_arg {
+ VALUE arr;
+ long index;
+ char *value;
+};
+VALUE ruby_libvirt_str_new2_and_ary_store_wrap(VALUE arg);
+
#ifndef RARRAY_LEN
#define RARRAY_LEN(ar) (RARRAY(ar)->len)
#endif
diff --git a/ext/libvirt/connect.c b/ext/libvirt/connect.c
index cef4de1..bbdbc94 100644
--- a/ext/libvirt/connect.c
+++ b/ext/libvirt/connect.c
@@ -2,7 +2,7 @@
* connect.c: virConnect methods
*
* Copyright (C) 2007,2010 Red Hat Inc.
- * Copyright (C) 2013 Chris Lalancette <clalancette at gmail.com>
+ * Copyright (C) 2013,2014 Chris Lalancette <clalancette at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -143,7 +143,7 @@ static VALUE libvirt_connect_closed_p(VALUE c)
/*
* call-seq:
- * conn.type -> string
+ * conn.type -> String
*
* Call virConnectGetType[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetType]
* to retrieve the type of hypervisor for this connection.
@@ -157,7 +157,7 @@ static VALUE libvirt_connect_type(VALUE c)
/*
* call-seq:
- * conn.version -> fixnum
+ * conn.version -> Fixnum
*
* Call virConnectGetVersion[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetVersion]
* to retrieve the version of the hypervisor for this connection.
@@ -177,7 +177,7 @@ static VALUE libvirt_connect_version(VALUE c)
#if HAVE_VIRCONNECTGETLIBVERSION
/*
* call-seq:
- * conn.libversion -> fixnum
+ * conn.libversion -> Fixnum
*
* Call virConnectGetLibVersion[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetLibVersion]
* to retrieve the version of the libvirt library for this connection.
@@ -198,7 +198,7 @@ static VALUE libvirt_connect_libversion(VALUE c)
/*
* call-seq:
- * conn.hostname -> string
+ * conn.hostname -> String
*
* Call virConnectGetHostname[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetHostname]
* to retrieve the hostname of the hypervisor for this connection.
@@ -212,7 +212,7 @@ static VALUE libvirt_connect_hostname(VALUE c)
/*
* call-seq:
- * conn.uri -> string
+ * conn.uri -> String
*
* Call virConnectGetURI[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetURI]
* to retrieve the canonical URI for this connection.
@@ -226,7 +226,7 @@ static VALUE libvirt_connect_uri(VALUE c)
/*
* call-seq:
- * conn.max_vcpus(type=nil) -> fixnum
+ * conn.max_vcpus(type=nil) -> Fixnum
*
* Call virConnectGetMaxVcpus[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetMaxVcpus]
* to retrieve the maximum number of virtual cpus supported by the hypervisor
@@ -276,7 +276,7 @@ static VALUE libvirt_connect_node_info(VALUE c)
/*
* call-seq:
- * conn.node_free_memory -> fixnum
+ * conn.node_free_memory -> Fixnum
*
* Call virNodeGetFreeMemory[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeGetFreeMemory]
* to retrieve the amount of free memory available on the host for this
@@ -408,7 +408,7 @@ static VALUE libvirt_connect_secure_p(VALUE c)
/*
* call-seq:
- * conn.capabilities -> string
+ * conn.capabilities -> String
*
* Call virConnectGetCapabilities[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetCapabilities]
* to retrieve the capabilities XML for this connection.
@@ -786,7 +786,7 @@ static int domain_event_graphics_callback(virConnectPtr conn, virDomainPtr dom,
/*
* call-seq:
- * conn.domain_event_register_any(eventID, callback, dom=nil, opaque=nil) -> fixnum
+ * conn.domain_event_register_any(eventID, callback, dom=nil, opaque=nil) -> Fixnum
*
* Call virConnectDomainEventRegisterAny[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectDomainEventRegisterAny]
* to register callback for eventID with libvirt. The eventID must be one of
@@ -958,7 +958,7 @@ static VALUE libvirt_connect_domain_event_deregister(VALUE c)
/*
* call-seq:
- * conn.num_of_domains -> fixnum
+ * conn.num_of_domains -> Fixnum
*
* Call virConnectNumOfDomains[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDomains]
* to retrieve the number of active domains on this connection.
@@ -1006,7 +1006,7 @@ static VALUE libvirt_connect_list_domains(VALUE c)
/*
* call-seq:
- * conn.num_of_defined_domains -> fixnum
+ * conn.num_of_defined_domains -> Fixnum
*
* Call virConnectNumOfDefinedDomains[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDefinedDomains]
* to retrieve the number of inactive domains on this connection.
@@ -1157,7 +1157,7 @@ static VALUE libvirt_connect_define_domain_xml(VALUE c, VALUE xml)
#if HAVE_VIRCONNECTDOMAINXMLFROMNATIVE
/*
* call-seq:
- * conn.domain_xml_from_native(nativeFormat, xml, flags=0) -> string
+ * conn.domain_xml_from_native(nativeFormat, xml, flags=0) -> String
*
* Call virConnectDomainXMLFromNative[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectDomainXMLFromNative]
* to convert a native hypervisor domain representation to libvirt XML.
@@ -1181,7 +1181,7 @@ static VALUE libvirt_connect_domain_xml_from_native(int argc, VALUE *argv,
#if HAVE_VIRCONNECTDOMAINXMLTONATIVE
/*
* call-seq:
- * conn.domain_xml_to_native(nativeFormat, xml, flags=0) -> string
+ * conn.domain_xml_to_native(nativeFormat, xml, flags=0) -> String
*
* Call virConnectDomainXMLToNative[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectDomainXMLToNative]
* to convert libvirt XML to a native domain hypervisor representation.
@@ -1205,7 +1205,7 @@ static VALUE libvirt_connect_domain_xml_to_native(int argc, VALUE *argv,
#if HAVE_TYPE_VIRINTERFACEPTR
/*
* call-seq:
- * conn.num_of_interfaces -> fixnum
+ * conn.num_of_interfaces -> Fixnum
*
* Call virConnectNumOfInterfaces[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfInterfaces]
* to retrieve the number of active interfaces on this connection.
@@ -1229,7 +1229,7 @@ static VALUE libvirt_connect_list_interfaces(VALUE c)
/*
* call-seq:
- * conn.num_of_defined_interfaces -> fixnum
+ * conn.num_of_defined_interfaces -> Fixnum
*
* Call virConnectNumOfDefinedInterfaces[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDefinedInterfaces]
* to retrieve the number of inactive interfaces on this connection.
@@ -1319,7 +1319,7 @@ static VALUE libvirt_connect_define_interface_xml(int argc, VALUE *argv,
/*
* call-seq:
- * conn.num_of_networks -> fixnum
+ * conn.num_of_networks -> Fixnum
*
* Call virConnectNumOfNetworks[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfNetworks]
* to retrieve the number of active networks on this connection.
@@ -1343,7 +1343,7 @@ static VALUE libvirt_connect_list_networks(VALUE c)
/*
* call-seq:
- * conn.num_of_defined_networks -> fixnum
+ * conn.num_of_defined_networks -> Fixnum
*
* Call virConnectNumOfDefinedNetworks[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDefinedNetworks]
* to retrieve the number of inactive networks on this connection.
@@ -1448,7 +1448,7 @@ static VALUE libvirt_connect_define_network_xml(VALUE c, VALUE xml)
/*
* call-seq:
- * conn.num_of_nodedevices(cap=nil, flags=0) -> fixnum
+ * conn.num_of_nodedevices(cap=nil, flags=0) -> Fixnum
*
* Call virNodeNumOfDevices[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeNumOfDevices]
* to retrieve the number of node devices on this connection.
@@ -1564,7 +1564,7 @@ static VALUE libvirt_connect_create_nodedevice_xml(int argc, VALUE *argv,
/*
* call-seq:
- * conn.num_of_nwfilters -> fixnum
+ * conn.num_of_nwfilters -> Fixnum
*
* Call virConnectNumOfNWFilters[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfNWFilters]
* to retrieve the number of network filters on this connection.
@@ -1651,7 +1651,7 @@ static VALUE libvirt_connect_define_nwfilter_xml(VALUE c, VALUE xml)
/*
* call-seq:
- * conn.num_of_secrets -> fixnum
+ * conn.num_of_secrets -> Fixnum
*
* Call virConnectNumOfSecrets[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfSecrets]
* to retrieve the number of secrets on this connection.
@@ -1758,7 +1758,7 @@ static VALUE libvirt_connect_list_storage_pools(VALUE c)
/*
* call-seq:
- * conn.num_of_storage_pools -> fixnum
+ * conn.num_of_storage_pools -> Fixnum
*
* Call virConnectNumOfStoragePools[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfStoragePools]
* to retrieve the number of active storage pools on this connection.
@@ -1782,7 +1782,7 @@ static VALUE libvirt_connect_list_defined_storage_pools(VALUE c)
/*
* call-seq:
- * conn.num_of_defined_storage_pools -> fixnum
+ * conn.num_of_defined_storage_pools -> Fixnum
*
* Call virConnectNumOfDefinedStoragePools[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDefinedStoragePools]
* to retrieve the number of inactive storage pools on this connection.
@@ -1882,7 +1882,7 @@ static VALUE libvirt_connect_define_pool_xml(int argc, VALUE *argv, VALUE c)
/*
* call-seq:
- * conn.discover_storage_pool_sources(type, srcSpec=nil, flags=0) -> string
+ * conn.discover_storage_pool_sources(type, srcSpec=nil, flags=0) -> String
*
* Call virConnectFindStoragePoolSources[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectFindStoragePoolSources]
* to find the storage pool sources corresponding to type.
@@ -1906,7 +1906,7 @@ static VALUE libvirt_connect_find_storage_pool_sources(int argc, VALUE *argv,
#if HAVE_VIRCONNECTGETSYSINFO
/*
* call-seq:
- * conn.sys_info(flags=0) -> string
+ * conn.sys_info(flags=0) -> String
*
* Call virConnectGetSysinfo[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetSysinfo]
* to get machine-specific information about the hypervisor. This may include
@@ -2137,7 +2137,7 @@ static VALUE libvirt_connect_node_memory_stats(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRDOMAINSAVEIMAGEGETXMLDESC
/*
* call-seq:
- * conn.save_image_xml_desc(filename, flags=0) -> string
+ * conn.save_image_xml_desc(filename, flags=0) -> String
*
* Call virDomainSaveImageGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSaveImageGetXMLDesc]
* to get the XML corresponding to a save file.
@@ -2353,7 +2353,7 @@ static VALUE libvirt_connect_node_cpu_map(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRCONNECTSETKEEPALIVE
/*
* call-seq:
- * conn.set_keepalive(interval, count) -> fixnum
+ * conn.set_keepalive(interval, count) -> Fixnum
*
* Call virConnectSetKeepAlive[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectSetKeepAlive]
* to start sending keepalive messages. Deprecated; use conn.keepalive=
@@ -2398,7 +2398,7 @@ static VALUE libvirt_connect_keepalive_equal(VALUE c, VALUE in)
#if HAVE_VIRCONNECTLISTALLDOMAINS
/*
* call-seq:
- * conn.list_all_domains(flags=0) -> array
+ * conn.list_all_domains(flags=0) -> Array
*
* Call virConnectListAllDomains[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllDomains]
* to get an array of domain objects for all domains.
@@ -2415,7 +2415,7 @@ static VALUE libvirt_connect_list_all_domains(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRCONNECTLISTALLNETWORKS
/*
* call-seq:
- * conn.list_all_networks(flags=0) -> array
+ * conn.list_all_networks(flags=0) -> Array
*
* Call virConnectListAllNetworks[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllNetworks]
* to get an array of network objects for all networks.
@@ -2433,7 +2433,7 @@ static VALUE libvirt_connect_list_all_networks(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRCONNECTLISTALLINTERFACES
/*
* call-seq:
- * conn.list_all_interfaces(flags=0) -> array
+ * conn.list_all_interfaces(flags=0) -> Array
*
* Call virConnectListAllInterfaces[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllInterfaces]
* to get an array of interface objects for all interfaces.
@@ -2451,7 +2451,7 @@ static VALUE libvirt_connect_list_all_interfaces(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRCONNECTLISTALLSECRETS
/*
* call-seq:
- * conn.list_all_secrets(flags=0) -> array
+ * conn.list_all_secrets(flags=0) -> Array
*
* Call virConnectListAllSecrets[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllSecrets]
* to get an array of secret objects for all secrets.
@@ -2468,7 +2468,7 @@ static VALUE libvirt_connect_list_all_secrets(int argc, VALUE *argv, VALUE c)
#if HAVE_VIRCONNECTLISTALLNODEDEVICES
/*
* call-seq:
- * conn.list_all_nodedevices(flags=0) -> array
+ * conn.list_all_nodedevices(flags=0) -> Array
*
* Call virConnectListAllNodeDevices[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllNodeDevices]
* to get an array of nodedevice objects for all nodedevices.
@@ -2487,7 +2487,7 @@ static VALUE libvirt_connect_list_all_nodedevices(int argc, VALUE *argv,
#if HAVE_VIRCONNECTLISTALLSTORAGEPOOLS
/*
* call-seq:
- * conn.list_all_storage_pools(flags=0) -> array
+ * conn.list_all_storage_pools(flags=0) -> Array
*
* Call virConnectListAllStoragePools[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllStoragePools]
* to get an array of storage pool objects for all storage pools.
@@ -2505,7 +2505,7 @@ static VALUE libvirt_connect_list_all_storage_pools(int argc, VALUE *argv,
#if HAVE_VIRCONNECTLISTALLNWFILTERS
/*
* call-seq:
- * conn.list_all_nwfilters(flags=0) -> array
+ * conn.list_all_nwfilters(flags=0) -> Array
*
* Call virConnectListAllNWFilters[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectListAllNWFilters]
* to get an array of nwfilters for all nwfilter objects.
@@ -2608,24 +2608,6 @@ static VALUE libvirt_connect_qemu_attach(int argc, VALUE *argv, VALUE c)
#endif
#if HAVE_VIRCONNECTGETCPUMODELNAMES
-struct model_name_args {
- VALUE result;
- int i;
- char *value;
-};
-
-static VALUE model_name_wrap(VALUE arg)
-{
- struct model_name_args *e = (struct model_name_args *)arg;
- VALUE elem;
-
- elem = rb_str_new2(e->value);
-
- rb_ary_store(e->result, e->i, elem);
-
- return Qnil;
-}
-
/*
* call-seq:
* conn.cpu_model_names(arch, flags=0) -> Array
@@ -2638,7 +2620,7 @@ static VALUE libvirt_connect_cpu_model_names(int argc, VALUE *argv, VALUE c)
VALUE arch, flags, result;
char **models;
int i = 0, j, elems = 0;
- struct model_name_args args;
+ struct ruby_libvirt_str_new2_and_ary_store_arg args;
int exception;
rb_scan_args(argc, argv, "11", &arch, &flags);
@@ -2656,11 +2638,12 @@ static VALUE libvirt_connect_cpu_model_names(int argc, VALUE *argv, VALUE c)
}
for (i = 0; i < elems; i++) {
- args.result = result;
- args.i = i;
+ args.arr = result;
+ args.index = i;
args.value = models[i];
- rb_protect(model_name_wrap, (VALUE)&args, &exception);
+ rb_protect(ruby_libvirt_str_new2_and_ary_store_wrap, (VALUE)&args,
+ &exception);
if (exception) {
goto error;
}
@@ -2681,6 +2664,145 @@ error:
}
#endif
+#if HAVE_VIRNODEALLOCPAGES
+/*
+ * call-seq:
+ * conn.node_alloc_pages(page_arr, cells=nil, flags=0) -> Fixnum
+ *
+ * Call virNodeAllocPages[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeAllocPages]
+ * to reserve huge pages in the system pool.
+ */
+static VALUE libvirt_connect_node_alloc_pages(int argc, VALUE *argv, VALUE c)
+{
+ VALUE page_arr, cells, flags, entry, size, count, tmp;
+ int i, arraylen, start_cell, ret;
+ unsigned int *page_sizes;
+ unsigned long long *page_counts;
+ unsigned int cell_count;
+
+ rb_scan_args(argc, argv, "12", &page_arr, &cells, &flags);
+
+ Check_Type(page_arr, T_ARRAY);
+
+ arraylen = RARRAY_LEN(page_arr);
+
+ page_sizes = alloca(arraylen * sizeof(unsigned int));
+ page_counts = alloca(arraylen * sizeof(unsigned long long));
+
+ for (i = 0; i < arraylen; i++) {
+ entry = rb_ary_entry(page_arr, i);
+ Check_Type(entry, T_HASH);
+
+ size = rb_hash_aref(entry, rb_str_new2("size"));
+ Check_Type(size, T_FIXNUM);
+
+ count = rb_hash_aref(entry, rb_str_new2("count"));
+ Check_Type(count, T_FIXNUM);
+
+ page_sizes[i] = NUM2UINT(size);
+ page_counts[i] = NUM2ULL(count);
+ }
+
+ if (NIL_P(cells)) {
+ start_cell = -1;
+ cell_count = 0;
+ }
+ else {
+ Check_Type(cells, T_HASH);
+
+ tmp = rb_hash_aref(cells, rb_str_new2("start"));
+ Check_Type(tmp, T_FIXNUM);
+ start_cell = NUM2INT(tmp);
+
+ tmp = rb_hash_aref(cells, rb_str_new2("count"));
+ Check_Type(tmp, T_FIXNUM);
+ cell_count = NUM2UINT(tmp);
+ }
+
+ ret = virNodeAllocPages(ruby_libvirt_connect_get(c), arraylen, page_sizes,
+ page_counts, start_cell, cell_count,
+ ruby_libvirt_value_to_uint(flags));
+ ruby_libvirt_raise_error_if(ret < 0, e_Error,
+ "virNodeAllocPages",
+ ruby_libvirt_connect_get(c));
+
+ return INT2NUM(ret);
+}
+#endif
+
+#if HAVE_VIRCONNECTGETDOMAINCAPABILITIES
+/*
+ * call-seq:
+ * conn.domain_capabilities(emulatorbin, arch, machine, virttype, flags=0) -> String
+ *
+ * Call virNodeAllocPages[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectGetDomainCapabilities]
+ * to get the capabilities of the underlying emulator.
+ */
+static VALUE libvirt_connect_domain_capabilities(int argc, VALUE *argv, VALUE c)
+{
+ VALUE emulatorbin, arch, machine, virttype, flags;
+
+ rb_scan_args(argc, argv, "41", &emulatorbin, &arch, &machine, &virttype,
+ &flags);
+
+ ruby_libvirt_generate_call_string(virConnectGetDomainCapabilities,
+ ruby_libvirt_connect_get(c), 1,
+ ruby_libvirt_connect_get(c),
+ ruby_libvirt_get_cstring_or_null(emulatorbin),
+ ruby_libvirt_get_cstring_or_null(arch),
+ ruby_libvirt_get_cstring_or_null(machine),
+ ruby_libvirt_get_cstring_or_null(virttype),
+ NUM2UINT(flags));
+}
+#endif
+
+#if HAVE_VIRNODEGETFREEPAGES
+/*
+ * call-seq:
+ * conn.node_free_pages(pages, cells, flags=0) -> Hash
+ *
+ * Call virNodeGetFreePages[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeGetFreePages]
+ * to query the host system on free pages of specified size.
+ */
+static VALUE libvirt_connect_node_free_pages(int argc, VALUE *argv, VALUE c)
+{
+ VALUE pageArr, cells, flags, result;
+ unsigned int *pages;
+ unsigned int npages, i, cellCount;
+ int startCell, ret;
+ unsigned long long *counts;
+
+ rb_scan_args(argc, argv, "21", &pageArr, &cells, &flags);
+
+ Check_Type(pageArr, T_ARRAY);
+ Check_Type(cells, T_HASH);
+
+ npages = RARRAY_LEN(pageArr);
+ pages = alloca(npages);
+ for (i = 0; i < npages; i++) {
+ pages[i] = NUM2UINT(rb_ary_entry(pageArr, i));
+ }
+
+ startCell = NUM2INT(rb_hash_aref(cells, rb_str_new2("startCell")));
+ cellCount = NUM2UINT(rb_hash_aref(cells, rb_str_new2("cellCount")));
+
+ counts = alloca(npages * cellCount * sizeof(long long));
+
+ ret = virNodeGetFreePages(ruby_libvirt_connect_get(c), npages, pages,
+ startCell, cellCount, counts,
+ ruby_libvirt_value_to_uint(flags));
+ ruby_libvirt_raise_error_if(ret < 0, e_Error, "virNodeGetFreePages",
+ ruby_libvirt_connect_get(c));
+
+ result = rb_hash_new();
+ for (i = 0; i < npages; i++) {
+ rb_hash_aset(result, UINT2NUM(pages[i]), ULL2NUM(counts[i]));
+ }
+
+ return result;
+}
+#endif
+
/*
* Class Libvirt::Connect
*/
@@ -2754,6 +2876,11 @@ void ruby_libvirt_connect_init(void)
rb_define_method(c_connect, "compare_cpu", libvirt_connect_compare_cpu, -1);
#endif
+#if HAVE_CONST_VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE
+ rb_define_const(c_connect, "COMPARE_CPU_FAIL_INCOMPATIBLE",
+ INT2NUM(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE));
+#endif
+
#if HAVE_VIRCONNECTBASELINECPU
rb_define_method(c_connect, "baseline_cpu", libvirt_connect_baseline_cpu,
-1);
@@ -3301,6 +3428,14 @@ void ruby_libvirt_connect_init(void)
rb_define_method(c_connect, "list_all_storage_pools",
libvirt_connect_list_all_storage_pools, -1);
#endif
+#if HAVE_CONST_VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER
+ rb_define_const(c_connect, "LIST_STORAGE_POOLS_GLUSTER",
+ INT2NUM(VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER));
+#endif
+#if HAVE_CONST_VIR_CONNECT_LIST_STORAGE_POOLS_ZFS
+ rb_define_const(c_connect, "LIST_STORAGE_POOLS_ZFS",
+ INT2NUM(VIR_CONNECT_LIST_STORAGE_POOLS_ZFS));
+#endif
#if HAVE_VIRCONNECTLISTALLNWFILTERS
rb_define_method(c_connect, "list_all_nwfilters",
libvirt_connect_list_all_nwfilters, -1);
@@ -3319,4 +3454,20 @@ void ruby_libvirt_connect_init(void)
rb_define_method(c_connect, "cpu_model_names",
libvirt_connect_cpu_model_names, -1);
#endif
+#if HAVE_VIRNODEALLOCPAGES
+ rb_define_const(c_connect, "NODE_ALLOC_PAGES_ADD",
+ INT2NUM(VIR_NODE_ALLOC_PAGES_ADD));
+ rb_define_const(c_connect, "NODE_ALLOC_PAGES_SET",
+ INT2NUM(VIR_NODE_ALLOC_PAGES_SET));
+ rb_define_method(c_connect, "node_alloc_pages",
+ libvirt_connect_node_alloc_pages, -1);
+#endif
+#if HAVE_VIRCONNECTGETDOMAINCAPABILITIES
+ rb_define_method(c_connect, "domain_capabilities",
+ libvirt_connect_domain_capabilities, -1);
+#endif
+#if HAVE_VIRNODEGETFREEPAGES
+ rb_define_method(c_connect, "node_free_pages",
+ libvirt_connect_node_free_pages, -1);
+#endif
}
diff --git a/ext/libvirt/domain.c b/ext/libvirt/domain.c
index 8ac7d99..8961467 100644
--- a/ext/libvirt/domain.c
+++ b/ext/libvirt/domain.c
@@ -2,7 +2,7 @@
* domain.c: virDomain methods
*
* Copyright (C) 2007,2010 Red Hat Inc.
- * Copyright (C) 2013 Chris Lalancette <clalancette at gmail.com>
+ * Copyright (C) 2013,2014 Chris Lalancette <clalancette at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -718,7 +718,7 @@ static VALUE libvirt_domain_block_info(int argc, VALUE *argv, VALUE d)
#if HAVE_VIRDOMAINBLOCKPEEK
/*
* call-seq:
- * dom.block_peek(path, offset, size, flags=0) -> string
+ * dom.block_peek(path, offset, size, flags=0) -> String
*
* Call virDomainBlockPeek[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainBlockPeek]
* to read size number of bytes, starting at offset offset from domain backing
@@ -748,7 +748,7 @@ static VALUE libvirt_domain_block_peek(int argc, VALUE *argv, VALUE d)
#if HAVE_VIRDOMAINMEMORYPEEK
/*
* call-seq:
- * dom.memory_peek(start, size, flags=Libvirt::Domain::MEMORY_VIRTUAL) -> string
+ * dom.memory_peek(start, size, flags=Libvirt::Domain::MEMORY_VIRTUAL) -> String
*
* Call virDomainMemoryPeek[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainMemoryPeek]
* to read size number of bytes from offset start from the domain memory.
@@ -803,7 +803,7 @@ static VALUE libvirt_domain_vcpus(VALUE d)
cpumaplen = VIR_CPU_MAPLEN(maxcpus);
- cpumap = alloca(cpumaplen);
+ cpumap = alloca(sizeof(unsigned char) * cpumaplen);
r = virDomainGetVcpus(ruby_libvirt_domain_get(d), cpuinfo,
dominfo.nrVirtCpu, cpumap, cpumaplen);
@@ -928,7 +928,7 @@ static VALUE libvirt_domain_if_stats(VALUE d, VALUE sif)
/*
* call-seq:
- * dom.name -> string
+ * dom.name -> String
*
* Call virDomainGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetName]
* to retrieve the name of this domain.
@@ -942,7 +942,7 @@ static VALUE libvirt_domain_name(VALUE d)
/*
* call-seq:
- * dom.id -> fixnum
+ * dom.id -> Fixnum
*
* Call virDomainGetID[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetID]
* to retrieve the ID of this domain. If the domain isn't running, this will
@@ -967,7 +967,7 @@ static VALUE libvirt_domain_id(VALUE d)
/*
* call-seq:
- * dom.uuid -> string
+ * dom.uuid -> String
*
* Call virDomainGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetUUIDString]
* to retrieve the UUID of this domain.
@@ -981,7 +981,7 @@ static VALUE libvirt_domain_uuid(VALUE d)
/*
* call-seq:
- * dom.os_type -> string
+ * dom.os_type -> String
*
* Call virDomainGetOSType[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetOSType]
* to retrieve the os_type of this domain. In libvirt terms, os_type determines
@@ -996,7 +996,7 @@ static VALUE libvirt_domain_os_type(VALUE d)
/*
* call-seq:
- * dom.max_memory -> fixnum
+ * dom.max_memory -> Fixnum
*
* Call virDomainGetMaxMemory[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetMaxMemory]
* to retrieve the maximum amount of memory this domain is allowed to access.
@@ -1070,7 +1070,7 @@ static VALUE libvirt_domain_memory_equal(VALUE d, VALUE in)
/*
* call-seq:
- * dom.max_vcpus -> fixnum
+ * dom.max_vcpus -> Fixnum
*
* Call virDomainGetMaxVcpus[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetMaxVcpus]
* to retrieve the maximum number of virtual CPUs this domain can use.
@@ -1084,7 +1084,7 @@ static VALUE libvirt_domain_max_vcpus(VALUE d)
#if HAVE_VIRDOMAINGETVCPUSFLAGS
/* call-seq:
- * dom.num_vcpus(flags) -> fixnum
+ * dom.num_vcpus(flags) -> Fixnum
*
* Call virDomainGetVcpusFlags[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetVcpusFlags]
* to retrieve the number of virtual CPUs assigned to this domain.
@@ -1194,7 +1194,7 @@ static VALUE libvirt_domain_pin_vcpu(int argc, VALUE *argv, VALUE d)
cpumaplen = VIR_CPU_MAPLEN(maxcpus);
- cpumap = alloca(cpumaplen);
+ cpumap = alloca(sizeof(unsigned char) * cpumaplen);
MEMZERO(cpumap, unsigned char, cpumaplen);
for (i = 0; i < RARRAY_LEN(cpulist); i++) {
@@ -1222,7 +1222,7 @@ static VALUE libvirt_domain_pin_vcpu(int argc, VALUE *argv, VALUE d)
/*
* call-seq:
- * dom.xml_desc(flags=0) -> string
+ * dom.xml_desc(flags=0) -> String
*
* Call virDomainGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetXMLDesc]
* to retrieve the XML describing this domain.
@@ -1478,7 +1478,7 @@ static VALUE libvirt_domain_snapshot_create_xml(int argc, VALUE *argv, VALUE d)
/*
* call-seq:
- * dom.num_of_snapshots(flags=0) -> fixnum
+ * dom.num_of_snapshots(flags=0) -> Fixnum
*
* Call virDomainSnapshotNum[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotNum]
* to retrieve the number of available snapshots for this domain.
@@ -1624,7 +1624,7 @@ static VALUE libvirt_domain_current_snapshot(int argc, VALUE *argv, VALUE d)
/*
* call-seq:
- * snapshot.xml_desc(flags=0) -> string
+ * snapshot.xml_desc(flags=0) -> String
*
* Call virDomainSnapshotGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotGetXMLDesc]
* to retrieve the xml description for this snapshot.
@@ -1678,7 +1678,7 @@ static VALUE libvirt_domain_snapshot_free(VALUE s)
#if HAVE_VIRDOMAINSNAPSHOTGETNAME
/*
* call-seq:
- * snapshot.name -> string
+ * snapshot.name -> String
*
* Call virDomainSnapshotGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotGetName]
* to get the name associated with a snapshot.
@@ -1796,7 +1796,7 @@ static VALUE libvirt_domain_scheduler_type(VALUE d)
#if HAVE_VIRDOMAINQEMUMONITORCOMMAND
/*
* call-seq:
- * dom.qemu_monitor_command(cmd, flags=0) -> string
+ * dom.qemu_monitor_command(cmd, flags=0) -> String
*
* Call virDomainQemuMonitorCommand
* to send a qemu command directly to the monitor. Note that this will only
@@ -2330,7 +2330,7 @@ VALUE libvirt_domain_send_key(VALUE d, VALUE codeset, VALUE holdtime,
#if HAVE_VIRDOMAINMIGRATEGETMAXSPEED
/*
* call-seq:
- * dom.migrate_max_speed(flags=0) -> fixnum
+ * dom.migrate_max_speed(flags=0) -> Fixnum
*
* Call virDomainMigrateGetMaxSpeed[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateGetMaxSpeed]
* to retrieve the maximum speed a migration can use.
@@ -2397,7 +2397,7 @@ static VALUE libvirt_domain_hostname(int argc, VALUE *argv, VALUE d)
#if HAVE_VIRDOMAINGETMETADATA
/*
* call-seq:
- * dom.metadata(type, uri=nil, flags=0) -> string
+ * dom.metadata(type, uri=nil, flags=0) -> String
*
* Call virDomainGetMetadata[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata]
* to get the metadata from a domain.
@@ -2487,7 +2487,7 @@ static VALUE libvirt_domain_send_process_signal(int argc, VALUE *argv, VALUE d)
#if HAVE_VIRDOMAINLISTALLSNAPSHOTS
/*
* call-seq:
- * dom.list_all_snapshots(flags=0) -> array
+ * dom.list_all_snapshots(flags=0) -> Array
*
* Call virDomainListAllSnapshots[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainListAllSnapshots]
* to get an array of snapshot objects for all snapshots.
@@ -2505,7 +2505,7 @@ static VALUE libvirt_domain_list_all_snapshots(int argc, VALUE *argv, VALUE d)
#if HAVE_VIRDOMAINSNAPSHOTNUMCHILDREN
/*
* call-seq:
- * snapshot.num_children(flags=0) -> fixnum
+ * snapshot.num_children(flags=0) -> Fixnum
*
* Call virDomainSnapshotNumChildren[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotNumChildren]
* to get the number of children snapshots of this snapshot.
@@ -2527,7 +2527,7 @@ static VALUE libvirt_domain_snapshot_num_children(int argc, VALUE *argv,
#if HAVE_VIRDOMAINSNAPSHOTLISTCHILDRENNAMES
/*
* call-seq:
- * snapshot.list_children_names(flags=0) -> array
+ * snapshot.list_children_names(flags=0) -> Array
*
* Call virDomainSnapshotListChildrenNames[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListChildrenNames]
* to get an array of strings representing the children of this snapshot.
@@ -2535,10 +2535,10 @@ static VALUE libvirt_domain_snapshot_num_children(int argc, VALUE *argv,
static VALUE libvirt_domain_snapshot_list_children_names(int argc, VALUE *argv,
VALUE s)
{
- VALUE flags, result, str;
+ VALUE flags, result;
char **children;
int num_children, ret, i, j, exception = 0;
- struct ruby_libvirt_ary_store_arg arg;
+ struct ruby_libvirt_str_new2_and_ary_store_arg arg;
rb_scan_args(argc, argv, "01", &flags);
@@ -2564,16 +2564,11 @@ static VALUE libvirt_domain_snapshot_list_children_names(int argc, VALUE *argv,
ruby_libvirt_connect_get(s));
for (i = 0; i < ret; i++) {
- str = rb_protect(ruby_libvirt_str_new2_wrap, (VALUE)&(children[i]),
- &exception);
- if (exception) {
- goto error;
- }
-
arg.arr = result;
arg.index = i;
- arg.elem = str;
- rb_protect(ruby_libvirt_ary_store_wrap, (VALUE)&arg, &exception);
+ arg.value = children[i];
+ rb_protect(ruby_libvirt_str_new2_and_ary_store_wrap, (VALUE)&arg,
+ &exception);
if (exception) {
goto error;
}
@@ -2596,7 +2591,7 @@ error:
#if HAVE_VIRDOMAINSNAPSHOTLISTALLCHILDREN
/*
* call-seq:
- * snapshot.list_all_children(flags=0) -> array
+ * snapshot.list_all_children(flags=0) -> Array
*
* Call virDomainSnapshotListAllChildren[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListAllChildren]
* to get an array of snapshot objects that are children of this snapshot.
@@ -3026,7 +3021,7 @@ static VALUE libvirt_domain_emulator_pin_info(int argc, VALUE *argv, VALUE d)
cpumaplen = VIR_CPU_MAPLEN(maxcpus);
- cpumap = alloca(cpumaplen);
+ cpumap = alloca(sizeof(unsigned char) * cpumaplen);
ret = virDomainGetEmulatorPinInfo(ruby_libvirt_domain_get(d), cpumap,
cpumaplen,
@@ -3070,7 +3065,7 @@ static VALUE libvirt_domain_pin_emulator(int argc, VALUE *argv, VALUE d)
cpumaplen = VIR_CPU_MAPLEN(maxcpus);
- cpumap = alloca(cpumaplen);
+ cpumap = alloca(sizeof(unsigned char) * cpumaplen);
MEMZERO(cpumap, unsigned char, cpumaplen);
for (i = 0; i < RARRAY_LEN(cpulist); i++) {
@@ -3263,6 +3258,9 @@ static struct ruby_libvirt_typed_param iotune_allowed[] = {
{VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
{VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
{VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC
+ {VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
+#endif
};
/*
@@ -3955,7 +3953,7 @@ static VALUE libvirt_domain_migrate_to_uri3(int argc, VALUE *argv, VALUE d)
}
#endif
-#if HAVE_VIRNODEGETCPUSTATS
+#if HAVE_VIRDOMAINGETCPUSTATS
/*
* call-seq:
* dom.cpu_stats(start_cpu=-1, numcpus=1, flags=0) -> Hash
@@ -4048,6 +4046,237 @@ static VALUE libvirt_domain_cpu_stats(int argc, VALUE *argv, VALUE d)
}
#endif
+#if HAVE_VIRDOMAINGETTIME
+/*
+ * call-seq:
+ * dom.time(flags=0) -> Hash
+ * Call virDomainGetTime[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetTime]
+ * to get information about the guest time.
+ */
+static VALUE libvirt_domain_get_time(int argc, VALUE *argv, VALUE d)
+{
+ VALUE flags, result;
+ long long seconds;
+ unsigned int nseconds;
+ int ret;
+
+ rb_scan_args(argc, argv, "01", &flags);
+
+ ret = virDomainGetTime(ruby_libvirt_domain_get(d), &seconds, &nseconds,
+ ruby_libvirt_value_to_uint(flags));
+ ruby_libvirt_raise_error_if(ret < 0, e_Error, "virDomainGetTime",
+ ruby_libvirt_connect_get(d));
+
+ result = rb_hash_new();
+ rb_hash_aset(result, rb_str_new2("seconds"), LL2NUM(seconds));
+ rb_hash_aset(result, rb_str_new2("nseconds"), UINT2NUM(nseconds));
+
+ return result;
+}
+#endif
+
+#if HAVE_VIRDOMAINSETTIME
+/*
+ * call-seq:
+ * dom.time = Hash,flags=0
+ * Call virDomainSetTime[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSetTime]
+ * to set guest time.
+ */
+static VALUE libvirt_domain_time_equal(VALUE d, VALUE in)
+{
+ VALUE hash, flags, seconds, nseconds;
+
+ ruby_libvirt_assign_hash_and_flags(in, &hash, &flags);
+
+ seconds = rb_hash_aref(hash, rb_str_new2("seconds"));
+ nseconds = rb_hash_aref(hash, rb_str_new2("nseconds"));
+
+ ruby_libvirt_generate_call_nil(virDomainSetTime,
+ ruby_libvirt_connect_get(d),
+ ruby_libvirt_domain_get(d),
+ NUM2LL(seconds), NUM2UINT(nseconds),
+ NUM2UINT(flags));
+}
+#endif
+
+#if HAVE_VIRDOMAINCOREDUMPWITHFORMAT
+/*
+ * call-seq:
+ * dom.core_dump_with_format(filename, dumpformat, flags=0) -> nil
+ *
+ * Call virDomainCoreDumpWithFormat[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainCoreDump]
+ * to do a full memory dump of the domain to filename.
+ */
+static VALUE libvirt_domain_core_dump_with_format(int argc, VALUE *argv, VALUE d)
+{
+ VALUE to, dumpformat, flags;
+
+ rb_scan_args(argc, argv, "21", &to, &dumpformat, &flags);
+
+ ruby_libvirt_generate_call_nil(virDomainCoreDumpWithFormat,
+ ruby_libvirt_connect_get(d),
+ ruby_libvirt_domain_get(d),
+ StringValueCStr(to),
+ NUM2UINT(dumpformat),
+ ruby_libvirt_value_to_uint(flags));
+}
+#endif
+
+#if HAVE_VIRDOMAINFSFREEZE
+/*
+ * call-seq:
+ * dom.fs_freeze(mountpoints=nil, flags=0) -> Fixnum
+ *
+ * Call virDomainFSFreeze[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainFSFreeze]
+ * to freeze the specified filesystems within the guest.
+ */
+static VALUE libvirt_domain_fs_freeze(int argc, VALUE *argv, VALUE d)
+{
+ VALUE mountpoints, flags, entry;
+ const char **mnt;
+ unsigned int nmountpoints;
+ int i;
+
+ rb_scan_args(argc, argv, "02", &mountpoints, &flags);
+
+ if (NIL_P(mountpoints)) {
+ mnt = NULL;
+ nmountpoints = 0;
+ }
+ else {
+ Check_Type(mountpoints, T_ARRAY);
+
+ nmountpoints = RARRAY_LEN(mountpoints);
+ mnt = alloca(nmountpoints * sizeof(char *));
+
+ for (i = 0; i < nmountpoints; i++) {
+ entry = rb_ary_entry(mountpoints, i);
+ mnt[i] = StringValueCStr(entry);
+ }
+ }
+
+ ruby_libvirt_generate_call_int(virDomainFSFreeze,
+ ruby_libvirt_connect_get(d),
+ ruby_libvirt_domain_get(d),
+ mnt, nmountpoints,
+ ruby_libvirt_value_to_uint(flags));
+}
+#endif
+
+ #if HAVE_VIRDOMAINFSTHAW
+/*
+ * call-seq:
+ * dom.fs_thaw(mountpoints=nil, flags=0) -> Fixnum
+ *
+ * Call virDomainFSThaw[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainFSThaw]
+ * to thaw the specified filesystems within the guest.
+ */
+static VALUE libvirt_domain_fs_thaw(int argc, VALUE *argv, VALUE d)
+{
+ VALUE mountpoints, flags, entry;
+ const char **mnt;
+ unsigned int nmountpoints;
+ int i;
+
+ rb_scan_args(argc, argv, "02", &mountpoints, &flags);
+
+ if (NIL_P(mountpoints)) {
+ mnt = NULL;
+ nmountpoints = 0;
+ }
+ else {
+ Check_Type(mountpoints, T_ARRAY);
+
+ nmountpoints = RARRAY_LEN(mountpoints);
+ mnt = alloca(nmountpoints * sizeof(char *));
+
+ for (i = 0; i < nmountpoints; i++) {
+ entry = rb_ary_entry(mountpoints, i);
+ mnt[i] = StringValueCStr(entry);
+ }
+ }
+
+ ruby_libvirt_generate_call_int(virDomainFSThaw,
+ ruby_libvirt_connect_get(d),
+ ruby_libvirt_domain_get(d),
+ mnt, nmountpoints,
+ ruby_libvirt_value_to_uint(flags));
+}
+#endif
+
+#if HAVE_VIRDOMAINGETFSINFO
+struct fs_info_arg {
+ virDomainFSInfoPtr *info;
+ int ninfo;
+};
+
+static VALUE fs_info_wrap(VALUE arg)
+{
+ struct fs_info_arg *e = (struct fs_info_arg *)arg;
+ VALUE aliases, entry, result;
+ int i, j;
+
+ result = rb_ary_new2(e->ninfo);
+
+ for (i = 0; i < e->ninfo; i++) {
+ aliases = rb_ary_new2(e->info[i]->ndevAlias);
+ for (j = 0; j < e->info[i]->ndevAlias; j++) {
+ rb_ary_store(aliases, j, rb_str_new2(e->info[i]->devAlias[j]));
+ }
+
+ entry = rb_hash_new();
+ rb_hash_aset(entry, rb_str_new2("mountpoint"),
+ rb_str_new2(e->info[i]->mountpoint));
+ rb_hash_aset(entry, rb_str_new2("name"),
+ rb_str_new2(e->info[i]->name));
+ rb_hash_aset(entry, rb_str_new2("fstype"),
+ rb_str_new2(e->info[i]->fstype));
+ rb_hash_aset(entry, rb_str_new2("aliases"), aliases);
+
+ rb_ary_store(result, i, entry);
+ }
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * dom.fs_info(flags=0) -> [Hash]
+ *
+ * Call virDomainGetFSInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainGetFSInfo]
+ * to get information about the guest filesystems.
+ */
+static VALUE libvirt_domain_fs_info(int argc, VALUE *argv, VALUE d)
+{
+ VALUE flags, result;
+ virDomainFSInfoPtr *info;
+ int ret, i = 0, exception;
+ struct fs_info_arg args;
+
+ rb_scan_args(argc, argv, "01", &flags);
+
+ ret = virDomainGetFSInfo(ruby_libvirt_domain_get(d), &info,
+ ruby_libvirt_value_to_uint(flags));
+ ruby_libvirt_raise_error_if(ret < 0, e_Error, "virDomainGetFSInfo",
+ ruby_libvirt_connect_get(d));
+
+ args.info = info;
+ args.ninfo = ret;
+ result = rb_protect(fs_info_wrap, (VALUE)&args, &exception);
+
+ for (i = 0; i < ret; i++) {
+ virDomainFSInfoFree(info[i]);
+ }
+ free(info);
+
+ if (exception) {
+ rb_jump_tag(exception);
+ }
+
+ return result;
+}
+#endif
+
/*
* Class Libvirt::Domain
*/
@@ -4115,6 +4344,14 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "MIGRATE_ABORT_ON_ERROR",
INT2NUM(VIR_MIGRATE_ABORT_ON_ERROR));
#endif
+#if HAVE_CONST_VIR_MIGRATE_AUTO_CONVERGE
+ rb_define_const(c_domain, "MIGRATE_AUTO_CONVERGE",
+ INT2NUM(VIR_MIGRATE_AUTO_CONVERGE));
+#endif
+#if HAVE_CONST_VIR_MIGRATE_RDMA_PIN_ALL
+ rb_define_const(c_domain, "MIGRATE_RDMA_PIN_ALL",
+ INT2NUM(VIR_MIGRATE_RDMA_PIN_ALL));
+#endif
/* Ideally we would just have the "XML_SECURE" constant. Unfortunately
* we screwed up long ago, and we have to leave "DOMAIN_XML_SECURE" for
@@ -4238,7 +4475,10 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "UNDEFINE_SNAPSHOTS_METADATA",
INT2NUM(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA));
#endif
-
+#if HAVE_CONST_VIR_DOMAIN_UNDEFINE_NVRAM
+ rb_define_const(c_domain, "UNDEFINE_NVRAM",
+ INT2NUM(VIR_DOMAIN_UNDEFINE_NVRAM));
+#endif
rb_define_attr(c_domain, "connection", 1, 0);
#if HAVE_CONST_VIR_DOMAIN_SHUTDOWN_DEFAULT
@@ -4261,6 +4501,10 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "SHUTDOWN_SIGNAL",
INT2NUM(VIR_DOMAIN_SHUTDOWN_SIGNAL));
#endif
+#if HAVE_CONST_VIR_DOMAIN_SHUTDOWN_PARAVIRT
+ rb_define_const(c_domain, "SHUTDOWN_PARAVIRT",
+ INT2NUM(VIR_DOMAIN_SHUTDOWN_PARAVIRT));
+#endif
rb_define_method(c_domain, "shutdown", libvirt_domain_shutdown, -1);
#if HAVE_CONST_VIR_DOMAIN_REBOOT_DEFAULT
@@ -4283,6 +4527,10 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "REBOOT_SIGNAL",
INT2NUM(VIR_DOMAIN_REBOOT_SIGNAL));
#endif
+#if HAVE_CONST_VIR_DOMAIN_REBOOT_PARAVIRT
+ rb_define_const(c_domain, "REBOOT_PARAVIRT",
+ INT2NUM(VIR_DOMAIN_REBOOT_PARAVIRT));
+#endif
rb_define_method(c_domain, "reboot", libvirt_domain_reboot, -1);
#if HAVE_CONST_VIR_DOMAIN_DESTROY_DEFAULT
rb_define_const(c_domain, "DESTROY_DEFAULT",
@@ -5402,10 +5650,19 @@ void ruby_libvirt_domain_init(void)
rb_define_method(c_domain, "block_job_speed=",
libvirt_domain_block_job_speed_equal, 1);
#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES
+ rb_define_const(c_domain, "BLOCK_JOB_SPEED_BANDWIDTH_BYTES",
+ INT2NUM(VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES));
+#endif
#if HAVE_VIRDOMAINGETBLOCKJOBINFO
rb_define_method(c_domain, "block_job_info", libvirt_domain_block_job_info,
-1);
#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES
+ rb_define_const(c_domain, "BLOCK_JOB_INFO_BANDWIDTH_BYTES",
+ INT2NUM(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES));
+#endif
+
#if HAVE_VIRDOMAINBLOCKJOBABORT
rb_define_method(c_domain, "block_job_abort",
libvirt_domain_block_job_abort, -1);
@@ -5471,6 +5728,18 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "BLOCK_COMMIT_DELETE",
INT2NUM(VIR_DOMAIN_BLOCK_COMMIT_DELETE));
#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_ACTIVE
+ rb_define_const(c_domain, "BLOCK_COMMIT_ACTIVE",
+ INT2NUM(VIR_DOMAIN_BLOCK_COMMIT_ACTIVE));
+#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_RELATIVE
+ rb_define_const(c_domain, "BLOCK_COMMIT_RELATIVE",
+ INT2NUM(VIR_DOMAIN_BLOCK_COMMIT_RELATIVE));
+#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES
+ rb_define_const(c_domain, "BLOCK_COMMIT_BANDWIDTH_BYTES",
+ INT2NUM(VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES));
+#endif
#if HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN
rb_define_const(c_domain, "BLOCK_JOB_TYPE_UNKNOWN",
INT2NUM(VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN));
@@ -5487,6 +5756,10 @@ void ruby_libvirt_domain_init(void)
rb_define_const(c_domain, "BLOCK_JOB_TYPE_COMMIT",
INT2NUM(VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT));
#endif
+#if HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT
+ rb_define_const(c_domain, "BLOCK_JOB_TYPE_ACTIVE_COMMIT",
+ INT2NUM(VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT));
+#endif
#if HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC
rb_define_const(c_domain, "BLOCK_JOB_ABORT_ASYNC",
INT2NUM(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC));
@@ -5514,4 +5787,39 @@ void ruby_libvirt_domain_init(void)
#if HAVE_VIRDOMAINGETCPUSTATS
rb_define_method(c_domain, "cpu_stats", libvirt_domain_cpu_stats, -1);
#endif
+#if HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_RAW
+ rb_define_const(c_domain, "CORE_DUMP_FORMAT_RAW",
+ INT2NUM(VIR_DOMAIN_CORE_DUMP_FORMAT_RAW));
+#endif
+#if HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB
+ rb_define_const(c_domain, "CORE_DUMP_FORMAT_KDUMP_ZLIB",
+ INT2NUM(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB));
+#endif
+#if HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO
+ rb_define_const(c_domain, "CORE_DUMP_FORMAT_KDUMP_LZO",
+ INT2NUM(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO));
+#endif
+#if HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY
+ rb_define_const(c_domain, "CORE_DUMP_FORMAT_KDUMP_SNAPPY",
+ INT2NUM(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY));
+#endif
+#if HAVE_VIRDOMAINGETTIME
+ rb_define_method(c_domain, "time", libvirt_domain_get_time, -1);
+#endif
+#if HAVE_VIRDOMAINSETTIME
+ rb_define_method(c_domain, "time=", libvirt_domain_time_equal, 1);
+#endif
+#if HAVE_VIRDOMAINCOREDUMPWITHFORMAT
+ rb_define_method(c_domain, "core_dump_with_format",
+ libvirt_domain_core_dump_with_format, -1);
+#endif
+#if HAVE_VIRDOMAINFSFREEZE
+ rb_define_method(c_domain, "fs_freeze", libvirt_domain_fs_freeze, -1);
+#endif
+#if HAVE_VIRDOMAINFSTHAW
+ rb_define_method(c_domain, "fs_thaw", libvirt_domain_fs_thaw, -1);
+#endif
+#if HAVE_VIRDOMAINGETFSINFO
+ rb_define_method(c_domain, "fs_info", libvirt_domain_fs_info, -1);
+#endif
}
diff --git a/ext/libvirt/extconf.h b/ext/libvirt/extconf.h
new file mode 100644
index 0000000..38c0c5d
--- /dev/null
+++ b/ext/libvirt/extconf.h
@@ -0,0 +1,380 @@
+#ifndef EXTCONF_H
+#define EXTCONF_H
+#define HAVE_TYPE_VIRNETWORKPTR 1
+#define HAVE_TYPE_VIRSTORAGEPOOLPTR 1
+#define HAVE_TYPE_VIRSTORAGEVOLPTR 1
+#define HAVE_TYPE_VIRSECRETPTR 1
+#define HAVE_TYPE_VIRNWFILTERPTR 1
+#define HAVE_TYPE_VIRINTERFACEPTR 1
+#define HAVE_TYPE_VIRDOMAINBLOCKINFOPTR 1
+#define HAVE_TYPE_VIRDOMAINMEMORYSTATPTR 1
+#define HAVE_TYPE_VIRDOMAINSNAPSHOTPTR 1
+#define HAVE_TYPE_VIRDOMAINJOBINFOPTR 1
+#define HAVE_TYPE_VIRNODEDEVICEPTR 1
+#define HAVE_TYPE_VIRSTREAMPTR 1
+#define HAVE_TYPE_VIRTYPEDPARAMETERPTR 1
+#define HAVE_TYPE_VIRDOMAINBLOCKJOBINFOPTR 1
+#define HAVE_VIRSTORAGEVOLWIPE 1
+#define HAVE_VIRSTORAGEPOOLISACTIVE 1
+#define HAVE_VIRSTORAGEPOOLISPERSISTENT 1
+#define HAVE_VIRSTORAGEVOLCREATEXMLFROM 1
+#define HAVE_VIRCONNECTGETLIBVERSION 1
+#define HAVE_VIRCONNECTISENCRYPTED 1
+#define HAVE_VIRCONNECTISSECURE 1
+#define HAVE_VIRNETWORKISACTIVE 1
+#define HAVE_VIRNETWORKISPERSISTENT 1
+#define HAVE_VIRNODEDEVICECREATEXML 1
+#define HAVE_VIRNODEDEVICEDESTROY 1
+#define HAVE_VIRINTERFACEISACTIVE 1
+#define HAVE_VIRDOMAINMIGRATETOURI 1
+#define HAVE_VIRDOMAINMIGRATESETMAXDOWNTIME 1
+#define HAVE_VIRDOMAINMANAGEDSAVE 1
+#define HAVE_VIRDOMAINISACTIVE 1
+#define HAVE_VIRDOMAINISPERSISTENT 1
+#define HAVE_VIRCONNECTDOMAINXMLFROMNATIVE 1
+#define HAVE_VIRCONNECTDOMAINXMLTONATIVE 1
+#define HAVE_VIRDOMAINCREATEWITHFLAGS 1
+#define HAVE_VIRDOMAINATTACHDEVICEFLAGS 1
+#define HAVE_VIRDOMAINDETACHDEVICEFLAGS 1
+#define HAVE_VIRDOMAINUPDATEDEVICEFLAGS 1
+#define HAVE_VIRNODEGETSECURITYMODEL 1
+#define HAVE_VIRDOMAINCREATEXML 1
+#define HAVE_VIRDOMAINGETSECURITYLABEL 1
+#define HAVE_VIRCONNECTCOMPARECPU 1
+#define HAVE_VIRCONNECTBASELINECPU 1
+#define HAVE_VIRDOMAINSETVCPUSFLAGS 1
+#define HAVE_VIRDOMAINGETVCPUSFLAGS 1
+#define HAVE_VIRCONNECTDOMAINEVENTREGISTERANY 1
+#define HAVE_VIRCONNECTDOMAINEVENTREGISTER 1
+#define HAVE_VIRDOMAINBLOCKPEEK 1
+#define HAVE_VIRDOMAINMEMORYPEEK 1
+#define HAVE_VIRCONNECTOPENAUTH 1
+#define HAVE_VIREVENTREGISTERIMPL 1
+#define HAVE_VIRDOMAINISUPDATED 1
+#define HAVE_VIRDOMAINSETMEMORYPARAMETERS 1
+#define HAVE_VIRCONNECTGETSYSINFO 1
+#define HAVE_VIRDOMAINSETBLKIOPARAMETERS 1
+#define HAVE_VIRDOMAINSETMEMORYFLAGS 1
+#define HAVE_VIRDOMAINGETSTATE 1
+#define HAVE_VIRDOMAINOPENCONSOLE 1
+#define HAVE_VIRDOMAINMIGRATE2 1
+#define HAVE_VIRDOMAINSCREENSHOT 1
+#define HAVE_VIRINTERFACECHANGEBEGIN 1
+#define HAVE_VIRSTORAGEVOLDOWNLOAD 1
+#define HAVE_VIRDOMAININJECTNMI 1
+#define HAVE_VIRDOMAINGETCONTROLINFO 1
+#define HAVE_VIRDOMAINMIGRATEGETMAXSPEED 1
+#define HAVE_VIRNODEGETCPUSTATS 1
+#define HAVE_VIRNODEGETMEMORYSTATS 1
+#define HAVE_VIRDOMAINDESTROYFLAGS 1
+#define HAVE_VIRDOMAINSAVEFLAGS 1
+#define HAVE_VIRDOMAINSAVEIMAGEGETXMLDESC 1
+#define HAVE_VIRDOMAINSENDKEY 1
+#define HAVE_VIRNETWORKUPDATE 1
+#define HAVE_VIRNODESUSPENDFORDURATION 1
+#define HAVE_VIRNODEGETMEMORYPARAMETERS 1
+#define HAVE_VIRNODEGETCPUMAP 1
+#define HAVE_VIRDOMAINUNDEFINEFLAGS 1
+#define HAVE_VIRDOMAINPINVCPUFLAGS 1
+#define HAVE_VIRDOMAINGETVCPUPININFO 1
+#define HAVE_VIRDOMAINSNAPSHOTGETNAME 1
+#define HAVE_VIRCONNECTSETKEEPALIVE 1
+#define HAVE_VIRDOMAINRESET 1
+#define HAVE_VIRDOMAINSHUTDOWNFLAGS 1
+#define HAVE_VIRDOMAINGETHOSTNAME 1
+#define HAVE_VIRDOMAINGETMETADATA 1
+#define HAVE_VIRDOMAINSETMETADATA 1
+#define HAVE_VIRCONNECTLISTALLDOMAINS 1
+#define HAVE_VIRCONNECTLISTALLNETWORKS 1
+#define HAVE_VIRCONNECTLISTALLINTERFACES 1
+#define HAVE_VIRCONNECTLISTALLSECRETS 1
+#define HAVE_VIRCONNECTLISTALLNODEDEVICES 1
+#define HAVE_VIRCONNECTLISTALLSTORAGEPOOLS 1
+#define HAVE_VIRCONNECTLISTALLNWFILTERS 1
+#define HAVE_VIRCONNECTISALIVE 1
+#define HAVE_VIRNODEDEVICEDETACHFLAGS 1
+#define HAVE_VIRDOMAINSENDPROCESSSIGNAL 1
+#define HAVE_VIRDOMAINLISTALLSNAPSHOTS 1
+#define HAVE_VIRDOMAINSNAPSHOTNUMCHILDREN 1
+#define HAVE_VIRDOMAINSNAPSHOTLISTCHILDRENNAMES 1
+#define HAVE_VIRDOMAINSNAPSHOTLISTALLCHILDREN 1
+#define HAVE_VIRDOMAINSNAPSHOTGETPARENT 1
+#define HAVE_VIRDOMAINSNAPSHOTISCURRENT 1
+#define HAVE_VIRDOMAINSNAPSHOTHASMETADATA 1
+#define HAVE_VIRDOMAINSETMEMORYSTATSPERIOD 1
+#define HAVE_VIRDOMAINFSTRIM 1
+#define HAVE_VIRDOMAINBLOCKREBASE 1
+#define HAVE_VIRDOMAINOPENCHANNEL 1
+#define HAVE_VIRNODEDEVICELOOKUPSCSIHOSTBYWWN 1
+#define HAVE_VIRSTORAGEVOLWIPEPATTERN 1
+#define HAVE_VIRSTORAGEPOOLLISTALLVOLUMES 1
+#define HAVE_VIRDOMAINCREATEWITHFILES 1
+#define HAVE_VIRDOMAINCREATEXMLWITHFILES 1
+#define HAVE_VIRDOMAINOPENGRAPHICS 1
+#define HAVE_VIRSTORAGEVOLRESIZE 1
+#define HAVE_VIRDOMAINPMWAKEUP 1
+#define HAVE_VIRDOMAINBLOCKRESIZE 1
+#define HAVE_VIRDOMAINPMSUSPENDFORDURATION 1
+#define HAVE_VIRDOMAINMIGRATEGETCOMPRESSIONCACHE 1
+#define HAVE_VIRDOMAINMIGRATESETCOMPRESSIONCACHE 1
+#define HAVE_VIRDOMAINGETDISKERRORS 1
+#define HAVE_VIRDOMAINGETEMULATORPININFO 1
+#define HAVE_VIRDOMAINPINEMULATOR 1
+#define HAVE_VIRDOMAINGETSECURITYLABELLIST 1
+#define HAVE_VIRDOMAINGETJOBSTATS 1
+#define HAVE_VIRDOMAINGETBLOCKIOTUNE 1
+#define HAVE_VIRDOMAINSETBLOCKIOTUNE 1
+#define HAVE_VIRDOMAINBLOCKCOMMIT 1
+#define HAVE_VIRDOMAINBLOCKPULL 1
+#define HAVE_VIRDOMAINBLOCKJOBSETSPEED 1
+#define HAVE_VIRDOMAINGETBLOCKJOBINFO 1
+#define HAVE_VIRDOMAINBLOCKJOBABORT 1
+#define HAVE_VIRDOMAINGETINTERFACEPARAMETERS 1
+#define HAVE_VIRDOMAINBLOCKSTATSFLAGS 1
+#define HAVE_VIRDOMAINGETNUMAPARAMETERS 1
+#define HAVE_VIRCONNECTGETCPUMODELNAMES 1
+#define HAVE_VIRDOMAINMIGRATE3 1
+#define HAVE_VIRDOMAINGETCPUSTATS 1
+#define HAVE_VIRNETWORKGETDHCPLEASES 1
+#define HAVE_VIRNODEALLOCPAGES 1
+#define HAVE_VIRDOMAINGETTIME 1
+#define HAVE_VIRDOMAINSETTIME 1
+#define HAVE_VIRCONNECTGETDOMAINCAPABILITIES 1
+#define HAVE_VIRDOMAINCOREDUMPWITHFORMAT 1
+#define HAVE_VIRDOMAINFSFREEZE 1
+#define HAVE_VIRDOMAINFSTHAW 1
+#define HAVE_VIRDOMAINGETFSINFO 1
+#define HAVE_VIRNODEGETFREEPAGES 1
+#define HAVE_CONST_VIR_MIGRATE_LIVE 1
+#define HAVE_CONST_VIR_MIGRATE_PEER2PEER 1
+#define HAVE_CONST_VIR_MIGRATE_TUNNELLED 1
+#define HAVE_CONST_VIR_MIGRATE_PERSIST_DEST 1
+#define HAVE_CONST_VIR_MIGRATE_UNDEFINE_SOURCE 1
+#define HAVE_CONST_VIR_MIGRATE_PAUSED 1
+#define HAVE_CONST_VIR_MIGRATE_NON_SHARED_DISK 1
+#define HAVE_CONST_VIR_MIGRATE_NON_SHARED_INC 1
+#define HAVE_CONST_VIR_DOMAIN_XML_UPDATE_CPU 1
+#define HAVE_CONST_VIR_MEMORY_PHYSICAL 1
+#define HAVE_CONST_VIR_DOMAIN_START_PAUSED 1
+#define HAVE_CONST_VIR_DUMP_CRASH 1
+#define HAVE_CONST_VIR_DUMP_LIVE 1
+#define HAVE_CONST_VIR_DOMAIN_DEVICE_MODIFY_CURRENT 1
+#define HAVE_CONST_VIR_DOMAIN_DEVICE_MODIFY_LIVE 1
+#define HAVE_CONST_VIR_DOMAIN_DEVICE_MODIFY_CONFIG 1
+#define HAVE_CONST_VIR_DOMAIN_DEVICE_MODIFY_FORCE 1
+#define HAVE_CONST_VIR_INTERFACE_XML_INACTIVE 1
+#define HAVE_CONST_VIR_STORAGE_POOL_INACCESSIBLE 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_DEFINED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_STARTED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SUSPENDED_IOERROR 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_WATCHDOG 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_IO_ERROR 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_GRAPHICS 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_REBOOT 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_RTC_CHANGE 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON 1
+#define HAVE_CONST_VIR_DOMAIN_AFFECT_CURRENT 1
+#define HAVE_CONST_VIR_DOMAIN_MEM_CURRENT 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_ID_CONTROL_ERROR 1
+#define HAVE_CONST_VIR_DOMAIN_PAUSED_SHUTTING_DOWN 1
+#define HAVE_CONST_VIR_DOMAIN_START_AUTODESTROY 1
+#define HAVE_CONST_VIR_DOMAIN_START_BYPASS_CACHE 1
+#define HAVE_CONST_VIR_DOMAIN_START_FORCE_BOOT 1
+#define HAVE_CONST_VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON 1
+#define HAVE_CONST_VIR_DUMP_BYPASS_CACHE 1
+#define HAVE_CONST_VIR_MIGRATE_CHANGE_PROTECTION 1
+#define HAVE_CONST_VIR_DOMAIN_SAVE_BYPASS_CACHE 1
+#define HAVE_CONST_VIR_DOMAIN_SAVE_RUNNING 1
+#define HAVE_CONST_VIR_DOMAIN_SAVE_PAUSED 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_NONE 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_MODIFY 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_DELETE 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_ADD_LAST 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_NONE 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_BRIDGE 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_DOMAIN 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_IP 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_IP_DHCP_HOST 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_IP_DHCP_RANGE 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_FORWARD 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_FORWARD_INTERFACE 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_FORWARD_PF 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_PORTGROUP 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_DNS_HOST 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_DNS_TXT 1
+#define HAVE_CONST_VIR_NETWORK_SECTION_DNS_SRV 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_AFFECT_CURRENT 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_AFFECT_LIVE 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_AFFECT_CONFIG 1
+#define HAVE_CONST_VIR_DOMAIN_PMSUSPENDED 1
+#define HAVE_CONST_VIR_DOMAIN_RUNNING_WAKEUP 1
+#define HAVE_CONST_VIR_DOMAIN_PMSUSPENDED_UNKNOWN 1
+#define HAVE_CONST_VIR_DOMAIN_UNDEFINE_MANAGED_SAVE 1
+#define HAVE_CONST_VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA 1
+#define HAVE_CONST_VIR_DOMAIN_PAUSED_SNAPSHOT 1
+#define HAVE_CONST_VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN 1
+#define HAVE_CONST_VIR_DUMP_RESET 1
+#define HAVE_CONST_VIR_DUMP_MEMORY_ONLY 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_DEFAULT 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_GUEST_AGENT 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_INITCTL 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_SIGNAL 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_DEFAULT 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_ACPI_POWER_BTN 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_GUEST_AGENT 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_INITCTL 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_SIGNAL 1
+#define HAVE_CONST_VIR_DOMAIN_DESTROY_DEFAULT 1
+#define HAVE_CONST_VIR_DOMAIN_DESTROY_GRACEFUL 1
+#define HAVE_CONST_VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_LIVE 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_REBASE_SHALLOW 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_REBASE_COPY_RAW 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_REBASE_COPY 1
+#define HAVE_CONST_VIR_DOMAIN_CHANNEL_FORCE 1
+#define HAVE_CONST_VIR_DOMAIN_CONSOLE_FORCE 1
+#define HAVE_CONST_VIR_DOMAIN_CONSOLE_SAFE 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_ZERO 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_NNSA 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_DOD 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_BSI 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_GUTMANN 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33 1
+#define HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_RANDOM 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_RESIZE_BYTES 1
+#define HAVE_CONST_VIR_DOMAIN_MEMORY_STAT_RSS 1
+#define HAVE_CONST_VIR_MIGRATE_UNSAFE 1
+#define HAVE_CONST_VIR_MIGRATE_OFFLINE 1
+#define HAVE_CONST_VIR_MIGRATE_COMPRESSED 1
+#define HAVE_CONST_VIR_MIGRATE_ABORT_ON_ERROR 1
+#define HAVE_CONST_VIR_CONNECT_NO_ALIASES 1
+#define HAVE_CONST_VIR_DOMAIN_XML_MIGRATABLE 1
+#define HAVE_CONST_VIR_NETWORK_XML_INACTIVE 1
+#define HAVE_CONST_VIR_STORAGE_VOL_DIR 1
+#define HAVE_CONST_VIR_STORAGE_VOL_NETWORK 1
+#define HAVE_CONST_VIR_STORAGE_XML_INACTIVE 1
+#define HAVE_CONST_VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA 1
+#define HAVE_CONST_VIR_SECRET_USAGE_TYPE_CEPH 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_REVERT_FORCE 1
+#define HAVE_CONST_VIR_SECRET_USAGE_TYPE_ISCSI 1
+#define HAVE_CONST_VIR_DOMAIN_NOSTATE_UNKNOWN 1
+#define HAVE_CONST_VIR_DOMAIN_RUNNING_CRASHED 1
+#define HAVE_CONST_VIR_DOMAIN_PAUSED_CRASHED 1
+#define HAVE_CONST_VIR_DOMAIN_CRASHED_PANICKED 1
+#define HAVE_CONST_VIR_NODE_CPU_STATS_ALL_CPUS 1
+#define HAVE_CONST_VIR_NODE_MEMORY_STATS_ALL_CELLS 1
+#define HAVE_CONST_VIR_DOMAIN_VCPU_CURRENT 1
+#define HAVE_CONST_VIR_DOMAIN_VCPU_GUEST 1
+#define HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_DELETE 1
+#define HAVE_CONST_VIR_STORAGE_POOL_BUILD_NO_OVERWRITE 1
+#define HAVE_CONST_VIR_STORAGE_POOL_BUILD_OVERWRITE 1
+#define HAVE_CONST_VIR_KEYCODE_SET_LINUX 1
+#define HAVE_CONST_VIR_KEYCODE_SET_XT 1
+#define HAVE_CONST_VIR_KEYCODE_SET_ATSET1 1
+#define HAVE_CONST_VIR_KEYCODE_SET_ATSET2 1
+#define HAVE_CONST_VIR_KEYCODE_SET_ATSET3 1
+#define HAVE_CONST_VIR_KEYCODE_SET_OSX 1
+#define HAVE_CONST_VIR_KEYCODE_SET_XT_KBD 1
+#define HAVE_CONST_VIR_KEYCODE_SET_USB 1
+#define HAVE_CONST_VIR_KEYCODE_SET_WIN32 1
+#define HAVE_CONST_VIR_KEYCODE_SET_RFB 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SHUTDOWN 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_PMSUSPENDED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_CRASHED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_STARTED_WAKEUP 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SUSPENDED_RESTORED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_PMSUSPENDED_DISK 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_CRASHED_PANICKED 1
+#define HAVE_CONST_VIR_SECRET_USAGE_TYPE_NONE 1
+#define HAVE_CONST_VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY 1
+#define HAVE_CONST_VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_SHALLOW 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_DELETE 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_PULL 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_COPY 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_COMPLETED 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_FAILED 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_CANCELED 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_READY 1
+#define HAVE_CONST_VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE 1
+#define HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC 1
+#define HAVE_CONST_VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER 1
+#define HAVE_CONST_VIR_CONNECT_LIST_STORAGE_POOLS_ZFS 1
+#define HAVE_CONST_VIR_STORAGE_VOL_NETDIR 1
+#define HAVE_CONST_VIR_IP_ADDR_TYPE_IPV4 1
+#define HAVE_CONST_VIR_IP_ADDR_TYPE_IPV6 1
+#define HAVE_CONST_VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE 1
+#define HAVE_CONST_VIR_DOMAIN_UNDEFINE_NVRAM 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_ACTIVE 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_RELATIVE 1
+#define HAVE_CONST_VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES 1
+#define HAVE_CONST_VIR_FROM_VMWARE 1
+#define HAVE_CONST_VIR_FROM_AUDIT 1
+#define HAVE_CONST_VIR_FROM_SYSINFO 1
+#define HAVE_CONST_VIR_FROM_STREAMS 1
+#define HAVE_CONST_VIR_FROM_XENAPI 1
+#define HAVE_CONST_VIR_FROM_HOOK 1
+#define HAVE_CONST_VIR_ERR_HOOK_SCRIPT_FAILED 1
+#define HAVE_CONST_VIR_ERR_MIGRATE_PERSIST_FAILED 1
+#define HAVE_CONST_VIR_ERR_OPERATION_TIMEOUT 1
+#define HAVE_CONST_VIR_ERR_CONFIG_UNSUPPORTED 1
+#define HAVE_CONST_VIR_FROM_XENXM 1
+#define HAVE_CONST_VIR_ERR_OPERATION_INVALID 1
+#define HAVE_CONST_VIR_ERR_NO_SECURITY_MODEL 1
+#define HAVE_CONST_VIR_ERR_AUTH_FAILED 1
+#define HAVE_CONST_VIR_FROM_PHYP 1
+#define HAVE_CONST_VIR_FROM_ESX 1
+#define HAVE_CONST_VIR_FROM_ONE 1
+#define HAVE_CONST_VIR_FROM_VBOX 1
+#define HAVE_CONST_VIR_FROM_LXC 1
+#define HAVE_CONST_VIR_FROM_UML 1
+#define HAVE_CONST_VIR_FROM_NETWORK 1
+#define HAVE_CONST_VIR_FROM_DOMAIN 1
+#define HAVE_CONST_VIR_FROM_STATS_LINUX 1
+#define HAVE_CONST_VIR_FROM_XEN_INOTIFY 1
+#define HAVE_CONST_VIR_FROM_SECURITY 1
+#define HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_RAW 1
+#define HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB 1
+#define HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO 1
+#define HAVE_CONST_VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY 1
+#define HAVE_CONST_VIR_MIGRATE_AUTO_CONVERGE 1
+#define HAVE_CONST_VIR_MIGRATE_RDMA_PIN_ALL 1
+#define HAVE_CONST_VIR_DOMAIN_SHUTDOWN_PARAVIRT 1
+#define HAVE_CONST_VIR_DOMAIN_REBOOT_PARAVIRT 1
+#define HAVE_VIRDOMAINQEMUMONITORCOMMAND 1
+#define HAVE_VIRDOMAINQEMUATTACH 1
+#define HAVE_VIRDOMAINQEMUAGENTCOMMAND 1
+#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK 1
+#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT 1
+#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT 1
+#define HAVE_CONST_VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT 1
+#define HAVE_CONST_VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP 1
+#define HAVE_VIRDOMAINLXCOPENNAMESPACE 1
+#define HAVE_VIRDOMAINLXCENTERNAMESPACE 1
+#define HAVE_VIRDOMAINLXCENTERSECURITYLABEL 1
+#endif
diff --git a/ext/libvirt/extconf.rb b/ext/libvirt/extconf.rb
index c808aec..d5f4d74 100644
--- a/ext/libvirt/extconf.rb
+++ b/ext/libvirt/extconf.rb
@@ -212,6 +212,16 @@ libvirt_funcs = [ 'virStorageVolWipe',
'virConnectGetCPUModelNames',
'virDomainMigrate3',
'virDomainGetCPUStats',
+ 'virNetworkGetDHCPLeases',
+ 'virNodeAllocPages',
+ 'virDomainGetTime',
+ 'virDomainSetTime',
+ 'virConnectGetDomainCapabilities',
+ 'virDomainCoreDumpWithFormat',
+ 'virDomainFSFreeze',
+ 'virDomainFSThaw',
+ 'virDomainGetFSInfo',
+ 'virNodeGetFreePages',
]
libvirt_qemu_funcs = [ 'virDomainQemuMonitorCommand',
@@ -404,6 +414,20 @@ libvirt_consts = [ 'VIR_MIGRATE_LIVE',
'VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT',
'VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE',
'VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC',
+ 'VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER',
+ 'VIR_CONNECT_LIST_STORAGE_POOLS_ZFS',
+ 'VIR_STORAGE_VOL_NETDIR',
+ 'VIR_IP_ADDR_TYPE_IPV4',
+ 'VIR_IP_ADDR_TYPE_IPV6',
+ 'VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE',
+ 'VIR_DOMAIN_UNDEFINE_NVRAM',
+ 'VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT',
+ 'VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES',
+ 'VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES',
+ 'VIR_DOMAIN_BLOCK_COMMIT_ACTIVE',
+ 'VIR_DOMAIN_BLOCK_COMMIT_RELATIVE',
+ 'VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES',
+ 'VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC',
]
virterror_consts = [
@@ -432,6 +456,14 @@ virterror_consts = [
'VIR_FROM_STATS_LINUX',
'VIR_FROM_XEN_INOTIFY',
'VIR_FROM_SECURITY',
+ 'VIR_DOMAIN_CORE_DUMP_FORMAT_RAW',
+ 'VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB',
+ 'VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO',
+ 'VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY',
+ 'VIR_MIGRATE_AUTO_CONVERGE',
+ 'VIR_MIGRATE_RDMA_PIN_ALL',
+ 'VIR_DOMAIN_SHUTDOWN_PARAVIRT',
+ 'VIR_DOMAIN_REBOOT_PARAVIRT',
]
libvirt_qemu_consts = [
diff --git a/ext/libvirt/interface.c b/ext/libvirt/interface.c
index 0b0685f..d46da9c 100644
--- a/ext/libvirt/interface.c
+++ b/ext/libvirt/interface.c
@@ -114,7 +114,7 @@ static VALUE libvirt_interface_active_p(VALUE p)
/*
* call-seq:
- * interface.name -> string
+ * interface.name -> String
*
* Call virInterfaceGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetName]
* to retrieve the name of this interface.
@@ -128,7 +128,7 @@ static VALUE libvirt_interface_name(VALUE i)
/*
* call-seq:
- * interface.mac -> string
+ * interface.mac -> String
*
* Call virInterfaceGetMACString[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetMACString]
* to retrieve the MAC address of this interface.
@@ -142,7 +142,7 @@ static VALUE libvirt_interface_mac(VALUE i)
/*
* call-seq:
- * interface.xml_desc -> string
+ * interface.xml_desc -> String
*
* Call virInterfaceGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetXMLDesc]
* to retrieve the XML of this interface.
diff --git a/ext/libvirt/network.c b/ext/libvirt/network.c
index 7814f50..7c77d73 100644
--- a/ext/libvirt/network.c
+++ b/ext/libvirt/network.c
@@ -2,7 +2,7 @@
* network.c: virNetwork methods
*
* Copyright (C) 2007,2010 Red Hat Inc.
- * Copyright (C) 2013 Chris Lalancette <clalancette at gmail.com>
+ * Copyright (C) 2013,2014 Chris Lalancette <clalancette at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -107,7 +107,7 @@ static VALUE libvirt_network_destroy(VALUE n)
/*
* call-seq:
- * net.name -> string
+ * net.name -> String
*
* Call virNetworkGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetName]
* to retrieve the name of this network.
@@ -121,7 +121,7 @@ static VALUE libvirt_network_name(VALUE n)
/*
* call-seq:
- * net.uuid -> string
+ * net.uuid -> String
*
* Call virNetworkGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetUUIDString]
* to retrieve the UUID of this network.
@@ -134,7 +134,7 @@ static VALUE libvirt_network_uuid(VALUE n)
/*
* call-seq:
- * net.xml_desc(flags=0) -> string
+ * net.xml_desc(flags=0) -> String
*
* Call virNetworkGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetXMLDesc]
* to retrieve the XML for this network.
@@ -153,7 +153,7 @@ static VALUE libvirt_network_xml_desc(int argc, VALUE *argv, VALUE n)
/*
* call-seq:
- * net.bridge_name -> string
+ * net.bridge_name -> String
*
* Call virNetworkGetBridgeName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetBridgeName]
* to retrieve the bridge name for this network.
@@ -246,6 +246,84 @@ static VALUE libvirt_network_persistent_p(VALUE n)
}
#endif
+#if HAVE_VIRNETWORKGETDHCPLEASES
+struct leases_arg {
+ virNetworkDHCPLeasePtr *leases;
+ int nleases;
+};
+
+static VALUE leases_wrap(VALUE arg)
+{
+ struct leases_arg *e = (struct leases_arg *)arg;
+ VALUE result, hash;
+ virNetworkDHCPLeasePtr lease;
+ int i;
+
+ result = rb_ary_new2(e->nleases);
+
+ for (i = 0; i < e->nleases; i++) {
+ lease = e->leases[i];
+
+ hash = rb_hash_new();
+ rb_hash_aset(hash, rb_str_new2("iface"), rb_str_new2(lease->iface));
+ rb_hash_aset(hash, rb_str_new2("expirytime"),
+ LL2NUM(lease->expirytime));
+ rb_hash_aset(hash, rb_str_new2("type"), INT2NUM(lease->type));
+ rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
+ rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
+ rb_hash_aset(hash, rb_str_new2("ipaddr"), rb_str_new2(lease->ipaddr));
+ rb_hash_aset(hash, rb_str_new2("prefix"), UINT2NUM(lease->prefix));
+ rb_hash_aset(hash, rb_str_new2("hostname"),
+ rb_str_new2(lease->hostname));
+ rb_hash_aset(hash, rb_str_new2("clientid"),
+ rb_str_new2(lease->clientid));
+
+ rb_ary_store(result, i, hash);
+ }
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * net.dhcp_leases(mac=nil, flags=0) -> Hash
+ *
+ * Call virNetworkGetDHCPLeases[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetDHCPLeases]
+ * to retrieve the leases for this network.
+ */
+static VALUE libvirt_network_get_dhcp_leases(int argc, VALUE *argv, VALUE n)
+{
+ VALUE mac, flags, result;
+ int nleases, i = 0, exception = 0;
+ virNetworkDHCPLeasePtr *leases = NULL;
+ struct leases_arg args;
+
+ rb_scan_args(argc, argv, "02", &mac, &flags);
+
+ nleases = virNetworkGetDHCPLeases(network_get(n),
+ ruby_libvirt_get_cstring_or_null(mac),
+ &leases,
+ ruby_libvirt_value_to_uint(flags));
+ ruby_libvirt_raise_error_if(nleases < 0, e_Error, "virNetworkGetDHCPLeases",
+ ruby_libvirt_connect_get(n));
+
+ args.leases = leases;
+ args.nleases = nleases;
+ result = rb_protect(leases_wrap, (VALUE)&args, &exception);
+
+ for (i = 0; i < nleases; i++) {
+ virNetworkDHCPLeaseFree(leases[i]);
+ }
+ free(leases);
+
+ if (exception) {
+ rb_jump_tag(exception);
+ }
+
+ return result;
+}
+#endif
+
#endif
/*
@@ -450,5 +528,20 @@ void ruby_libvirt_network_init(void)
INT2NUM(VIR_NETWORK_UPDATE_COMMAND_DELETE));
#endif
+#if HAVE_VIRNETWORKGETDHCPLEASES
+ rb_define_method(c_network, "dhcp_leases",
+ libvirt_network_get_dhcp_leases, -1);
+#endif
+
+#if HAVE_CONST_VIR_IP_ADDR_TYPE_IPV4
+ rb_define_const(c_network, "IP_ADDR_TYPE_IPV4",
+ INT2NUM(VIR_IP_ADDR_TYPE_IPV4));
+#endif
+
+#if HAVE_CONST_VIR_IP_ADDR_TYPE_IPV6
+ rb_define_const(c_network, "IP_ADDR_TYPE_IPV6",
+ INT2NUM(VIR_IP_ADDR_TYPE_IPV6));
+#endif
+
#endif
}
diff --git a/ext/libvirt/nodedevice.c b/ext/libvirt/nodedevice.c
index f0cbb4b..f9c63e9 100644
--- a/ext/libvirt/nodedevice.c
+++ b/ext/libvirt/nodedevice.c
@@ -46,7 +46,7 @@ VALUE ruby_libvirt_nodedevice_new(virNodeDevicePtr n, VALUE conn)
/*
* call-seq:
- * nodedevice.name -> string
+ * nodedevice.name -> String
*
* Call virNodeDeviceGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetName]
* to retrieve the name of the node device.
@@ -60,7 +60,7 @@ static VALUE libvirt_nodedevice_name(VALUE c)
/*
* call-seq:
- * nodedevice.parent -> string
+ * nodedevice.parent -> String
*
* Call virNodeDeviceGetParent[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetParent]
* to retrieve the parent of the node device.
@@ -85,7 +85,7 @@ static VALUE libvirt_nodedevice_parent(VALUE c)
/*
* call-seq:
- * nodedevice.num_of_caps -> fixnum
+ * nodedevice.num_of_caps -> Fixnum
*
* Call virNodeDeviceNumOfCaps[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceNumOfCaps]
* to retrieve the number of capabilities of the node device.
@@ -129,7 +129,7 @@ static VALUE libvirt_nodedevice_list_caps(VALUE c)
/*
* call-seq:
- * nodedevice.xml_desc(flags=0) -> string
+ * nodedevice.xml_desc(flags=0) -> String
*
* Call virNodeDeviceGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetXMLDesc]
* to retrieve the XML for the node device.
diff --git a/ext/libvirt/nwfilter.c b/ext/libvirt/nwfilter.c
index c60044e..494eb96 100644
--- a/ext/libvirt/nwfilter.c
+++ b/ext/libvirt/nwfilter.c
@@ -60,7 +60,7 @@ static VALUE libvirt_nwfilter_undefine(VALUE n)
/*
* call-seq:
- * nwfilter.name -> string
+ * nwfilter.name -> String
*
* Call virNWFilterGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetName]
* to retrieve the network filter name.
@@ -74,7 +74,7 @@ static VALUE libvirt_nwfilter_name(VALUE n)
/*
* call-seq:
- * nwfilter.uuid -> string
+ * nwfilter.uuid -> String
*
* Call virNWFilterGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetUUIDString]
* to retrieve the network filter UUID.
@@ -87,7 +87,7 @@ static VALUE libvirt_nwfilter_uuid(VALUE n)
/*
* call-seq:
- * nwfilter.xml_desc(flags=0) -> string
+ * nwfilter.xml_desc(flags=0) -> String
*
* Call virNWFilterGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetXMLDesc]
* to retrieve the XML for this network filter.
diff --git a/ext/libvirt/secret.c b/ext/libvirt/secret.c
index 5b0348c..f083e0d 100644
--- a/ext/libvirt/secret.c
+++ b/ext/libvirt/secret.c
@@ -46,7 +46,7 @@ VALUE ruby_libvirt_secret_new(virSecretPtr s, VALUE conn)
/*
* call-seq:
- * secret.uuid -> string
+ * secret.uuid -> String
*
* Call virSecretGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUUIDString]
* to retrieve the UUID for this secret.
@@ -59,7 +59,7 @@ static VALUE libvirt_secret_uuid(VALUE s)
/*
* call-seq:
- * secret.usagetype -> fixnum
+ * secret.usagetype -> Fixnum
*
* Call virSecretGetUsageType[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageType]
* to retrieve the usagetype for this secret.
@@ -73,7 +73,7 @@ static VALUE libvirt_secret_usagetype(VALUE s)
/*
* call-seq:
- * secret.usageid -> string
+ * secret.usageid -> String
*
* Call virSecretGetUsageID[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageID]
* to retrieve the usageid for this secret.
@@ -87,7 +87,7 @@ static VALUE libvirt_secret_usageid(VALUE s)
/*
* call-seq:
- * secret.xml_desc(flags=0) -> string
+ * secret.xml_desc(flags=0) -> String
*
* Call virSecretGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetXMLDesc]
* to retrieve the XML for this secret.
@@ -166,7 +166,7 @@ static VALUE libvirt_secret_value_equal(VALUE s, VALUE in)
/*
* call-seq:
- * secret.value(flags=0) -> string
+ * secret.value(flags=0) -> String
*
* Call virSecretGetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetValue]
* to retrieve the value from this secret.
diff --git a/ext/libvirt/storage.c b/ext/libvirt/storage.c
index a01edbc..eed028e 100644
--- a/ext/libvirt/storage.c
+++ b/ext/libvirt/storage.c
@@ -2,7 +2,7 @@
* storage.c: virStoragePool and virStorageVolume methods
*
* Copyright (C) 2007,2010 Red Hat Inc.
- * Copyright (C) 2013 Chris Lalancette <clalancette at gmail.com>
+ * Copyright (C) 2013,2014 Chris Lalancette <clalancette at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -186,7 +186,7 @@ static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
/*
* call-seq:
- * pool.name -> string
+ * pool.name -> String
*
* Call virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetName]
* to retrieve the name of this storage pool.
@@ -200,7 +200,7 @@ static VALUE libvirt_storage_pool_name(VALUE p)
/*
* call-seq:
- * pool.uuid -> string
+ * pool.uuid -> String
*
* Call virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetUUIDString]
* to retrieve the UUID of this storage pool.
@@ -240,7 +240,7 @@ static VALUE libvirt_storage_pool_info(VALUE p)
/*
* call-seq:
- * pool.xml_desc(flags=0) -> string
+ * pool.xml_desc(flags=0) -> String
*
* Call virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetXMLDesc]
* to retrieve the XML for this storage pool.
@@ -297,7 +297,7 @@ static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
/*
* call-seq:
- * pool.num_of_volumes -> fixnum
+ * pool.num_of_volumes -> Fixnum
*
* Call virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolNumOfVolumes]
* to retrieve the number of volumes in this storage pool.
@@ -438,7 +438,7 @@ static VALUE libvirt_storage_pool_lookup_vol_by_path(VALUE p, VALUE path)
#if HAVE_VIRSTORAGEPOOLLISTALLVOLUMES
/*
* call-seq:
- * pool.list_all_volumes(flags=0) -> array
+ * pool.list_all_volumes(flags=0) -> Array
*
* Call virStoragePoolListAllVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListAllVolumes]
* to get an array of volume objects for all volumes.
@@ -455,7 +455,7 @@ static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
/*
* call-seq:
- * vol.name -> string
+ * vol.name -> String
*
* Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetName]
* to retrieve the name of this storage volume.
@@ -469,7 +469,7 @@ static VALUE libvirt_storage_vol_name(VALUE v)
/*
* call-seq:
- * vol.key -> string
+ * vol.key -> String
*
* Call virStorageVolGetKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetKey]
* to retrieve the key for this storage volume.
@@ -498,7 +498,7 @@ static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
vol = virStorageVolCreateXML(pool_get(p), StringValueCStr(xml),
ruby_libvirt_value_to_uint(flags));
- ruby_libvirt_raise_error_if(vol == NULL, e_Error, "virNetworkCreateXML",
+ ruby_libvirt_raise_error_if(vol == NULL, e_Error, "virStorageVolCreateXML",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
@@ -525,7 +525,7 @@ static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
vol_get(cloneval),
ruby_libvirt_value_to_uint(flags));
ruby_libvirt_raise_error_if(vol == NULL, e_Error,
- "virNetworkCreateXMLFrom",
+ "virStorageVolCreateXMLFrom",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
@@ -631,7 +631,7 @@ static VALUE libvirt_storage_vol_info(VALUE v)
/*
* call-seq:
- * vol.xml_desc(flags=0) -> string
+ * vol.xml_desc(flags=0) -> String
*
* Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetXMLDesc]
* to retrieve the xml for this storage volume.
@@ -650,7 +650,7 @@ static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
/*
* call-seq:
- * vol.path -> string
+ * vol.path -> String
*
* Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetPath]
* to retrieve the path for this storage volume.
@@ -913,6 +913,9 @@ void ruby_libvirt_storage_init(void)
#if HAVE_CONST_VIR_STORAGE_VOL_NETWORK
rb_define_const(c_storage_vol, "NETWORK", INT2NUM(VIR_STORAGE_VOL_NETWORK));
#endif
+#if HAVE_CONST_VIR_STORAGE_VOL_NETDIR
+ rb_define_const(c_storage_vol, "NETDIR", INT2NUM(VIR_STORAGE_VOL_NETDIR));
+#endif
/* virStorageVolDeleteFlags */
rb_define_const(c_storage_vol, "DELETE_NORMAL",
diff --git a/tests/test_conn.rb b/tests/test_conn.rb
index 8189e81..95ff8ec 100644
--- a/tests/test_conn.rb
+++ b/tests/test_conn.rb
@@ -16,8 +16,8 @@ cleanup_test_network(conn)
# test setup
begin
- `rm -f /etc/sysconfig/network-scripts/ifcfg-ruby-libvirt-tester`
- `brctl delbr ruby-libvirt-tester >& /dev/null`
+ `rm -f /etc/sysconfig/network-scripts/ifcfg-rb-libvirt-test`
+ `brctl delbr rb-libvirt-test >& /dev/null`
rescue
end
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
@@ -256,11 +256,11 @@ expect_too_few_args(conn, "lookup_domain_by_name")
expect_invalid_arg_type(conn, "lookup_domain_by_name", 1)
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_domain_by_name", "foobarbazsucker")
-expect_success(conn, "name arg for running domain", "lookup_domain_by_name", "ruby-libvirt-tester") {|x| x.name == "ruby-libvirt-tester"}
+expect_success(conn, "name arg for running domain", "lookup_domain_by_name", "rb-libvirt-test") {|x| x.name == "rb-libvirt-test"}
newdom.destroy
newdom = conn.define_domain_xml($new_dom_xml)
-expect_success(conn, "name arg for defined domain", "lookup_domain_by_name", "ruby-libvirt-tester") {|x| x.name == "ruby-libvirt-tester"}
+expect_success(conn, "name arg for defined domain", "lookup_domain_by_name", "rb-libvirt-test") {|x| x.name == "rb-libvirt-test"}
newdom.undefine
# TESTGROUP: conn.lookup_domain_by_id
@@ -351,11 +351,9 @@ expect_too_few_args(conn, "lookup_interface_by_name")
expect_invalid_arg_type(conn, "lookup_interface_by_name", 1)
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_interface_by_name", "foobarbazsucker")
-expect_success(conn, "name arg", "lookup_interface_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_interface_by_name", "rb-libvirt-test")
-newiface.destroy
-
-expect_success(conn, "name arg", "lookup_interface_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_interface_by_name", "rb-libvirt-test")
newiface.undefine
@@ -408,11 +406,11 @@ expect_too_few_args(conn, "lookup_network_by_name")
expect_invalid_arg_type(conn, "lookup_network_by_name", 1)
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_network_by_name", "foobarbazsucker")
-expect_success(conn, "name arg", "lookup_network_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_network_by_name", "rb-libvirt-test")
newnet.destroy
newnet = conn.define_network_xml($new_net_xml)
-expect_success(conn, "name arg", "lookup_network_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_network_by_name", "rb-libvirt-test")
newnet.undefine
# TESTGROUP: conn.lookup_network_by_uuid
@@ -499,7 +497,7 @@ expect_too_many_args(conn, "lookup_nwfilter_by_name", 1, 2)
expect_too_few_args(conn, "lookup_nwfilter_by_name")
expect_invalid_arg_type(conn, "lookup_nwfilter_by_name", 1)
-expect_success(conn, "name arg", "lookup_nwfilter_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_nwfilter_by_name", "rb-libvirt-test")
newnw.undefine
@@ -593,12 +591,12 @@ expect_too_few_args(conn, "lookup_storage_pool_by_name")
expect_invalid_arg_type(conn, "lookup_storage_pool_by_name", 1)
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_storage_pool_by_name", "foobarbazsucker")
-expect_success(conn, "name arg", "lookup_storage_pool_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_storage_pool_by_name", "rb-libvirt-test")
newpool.destroy
newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
-expect_success(conn, "name arg", "lookup_storage_pool_by_name", "ruby-libvirt-tester")
+expect_success(conn, "name arg", "lookup_storage_pool_by_name", "rb-libvirt-test")
newpool.undefine
# TESTGROUP: conn.lookup_storage_pool_by_uuid
diff --git a/tests/test_domain.rb b/tests/test_domain.rb
index 027a708..5e12c1f 100644
--- a/tests/test_domain.rb
+++ b/tests/test_domain.rb
@@ -220,7 +220,7 @@ newdom.undefine
newdom = conn.create_domain_xml($new_dom_xml)
sleep 1
-expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
+#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
#newdom.migrate_to_uri("qemu://remote/system")
#expect_success(newdom, "10 second downtime", "migrate_set_max_downtime", 10)
@@ -603,7 +603,7 @@ sleep 1
expect_too_many_args(newdom, "name", 1)
-expect_success(newdom, "no args", "name") {|x| x == "ruby-libvirt-tester"}
+expect_success(newdom, "no args", "name") {|x| x == "rb-libvirt-test"}
newdom.destroy
@@ -1187,7 +1187,7 @@ newdom.undefine
newdom = conn.create_domain_xml($new_dom_xml)
sleep 1
-expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
+#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
# FIXME: get this working
#newdom.migrate_to_uri("qemu://remote/system")
diff --git a/tests/test_interface.rb b/tests/test_interface.rb
index f154f0b..db35a2e 100644
--- a/tests/test_interface.rb
+++ b/tests/test_interface.rb
@@ -13,8 +13,8 @@ conn = Libvirt::open("qemu:///system")
# test setup
begin
- `rm -f /etc/sysconfig/network-scripts/ifcfg-ruby-libvirt-tester`
- `brctl delbr ruby-libvirt-tester >& /dev/null`
+ `rm -f /etc/sysconfig/network-scripts/ifcfg-rb-libvirt-test`
+ `brctl delbr rb-libvirt-test >& /dev/null`
rescue
end
@@ -44,7 +44,7 @@ newiface = conn.define_interface_xml($new_interface_xml)
expect_too_many_args(newiface, "destroy", 1, 2)
expect_invalid_arg_type(newiface, "destroy", 'foo')
-expect_success(newiface, "no args", "destroy")
+#expect_success(newiface, "no args", "destroy")
newiface.undefine
@@ -66,7 +66,7 @@ newiface = conn.define_interface_xml($new_interface_xml)
expect_too_many_args(newiface, "name", 1)
-expect_success(newiface, "no args", "name") {|x| x == "ruby-libvirt-tester"}
+expect_success(newiface, "no args", "name") {|x| x == "rb-libvirt-test"}
newiface.undefine
diff --git a/tests/test_network.rb b/tests/test_network.rb
index 1de06e7..669745e 100644
--- a/tests/test_network.rb
+++ b/tests/test_network.rb
@@ -57,7 +57,7 @@ newnet = conn.create_network_xml($new_net_xml)
expect_too_many_args(newnet, "name", 1)
-expect_success(newnet, "no args", "name") {|x| x == "ruby-libvirt-tester"}
+expect_success(newnet, "no args", "name") {|x| x == "rb-libvirt-test"}
newnet.destroy
diff --git a/tests/test_nwfilter.rb b/tests/test_nwfilter.rb
index a251678..e1a4ed3 100644
--- a/tests/test_nwfilter.rb
+++ b/tests/test_nwfilter.rb
@@ -23,7 +23,7 @@ newnw = conn.define_nwfilter_xml($new_nwfilter_xml)
expect_too_many_args(newnw, "name", 1)
-expect_success(newnw, "no args", "name") {|x| x == "ruby-libvirt-tester"}
+expect_success(newnw, "no args", "name") {|x| x == "rb-libvirt-test"}
newnw.undefine
diff --git a/tests/test_storage.rb b/tests/test_storage.rb
index e090da7..512a3cd 100644
--- a/tests/test_storage.rb
+++ b/tests/test_storage.rb
@@ -12,7 +12,7 @@ set_test_object("storage_pool")
conn = Libvirt::open("qemu:///system")
begin
- oldpool = conn.lookup_storage_pool_by_name("ruby-libvirt-tester")
+ oldpool = conn.lookup_storage_pool_by_name("rb-libvirt-test")
oldpool.destroy
oldpool.undefine
rescue
@@ -28,7 +28,7 @@ new_storage_vol_xml = <<EOF
<allocation>0</allocation>
<capacity unit="G">1</capacity>
<target>
- <path>/tmp/ruby-libvirt-tester/test.img</path>
+ <path>/tmp/rb-libvirt-test/test.img</path>
</target>
</volume>
EOF
@@ -39,7 +39,7 @@ new_storage_vol_xml_2 = <<EOF
<allocation>0</allocation>
<capacity unit="G">5</capacity>
<target>
- <path>/tmp/ruby-libvirt-tester/test2.img</path>
+ <path>/tmp/rb-libvirt-test/test2.img</path>
</target>
</volume>
EOF
@@ -100,7 +100,7 @@ expect_invalid_arg_type(newpool, "delete", 'foo')
expect_success(newpool, "no args", "delete")
-`mkdir -p /tmp/ruby-libvirt-tester`
+`mkdir -p /tmp/rb-libvirt-test`
newpool.undefine
`mkdir -p #{$POOL_PATH}`
@@ -120,7 +120,7 @@ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
expect_too_many_args(newpool, "name", 1)
-expect_success(newpool, "no args", "name") {|x| x == "ruby-libvirt-tester"}
+expect_success(newpool, "no args", "name") {|x| x == "rb-libvirt-test"}
newpool.destroy
diff --git a/tests/test_utils.rb b/tests/test_utils.rb
index 519de27..7bcb17e 100644
--- a/tests/test_utils.rb
+++ b/tests/test_utils.rb
@@ -4,7 +4,7 @@ $SKIPPED = 0
URI = ENV['RUBY_LIBVIRT_TEST_URI'] || "qemu:///system"
-$GUEST_BASE = '/var/lib/libvirt/images/ruby-libvirt-tester'
+$GUEST_BASE = '/var/lib/libvirt/images/rb-libvirt-test'
$GUEST_DISK = $GUEST_BASE + '.qcow2'
$GUEST_SAVE = $GUEST_BASE + '.save'
$GUEST_UUID = "93a5c045-6457-2c09-e56f-927cdf34e17a"
@@ -13,7 +13,7 @@ $GUEST_UUID = "93a5c045-6457-2c09-e56f-927cdf34e17a"
$new_dom_xml = <<EOF
<domain type='kvm'>
<description>Ruby Libvirt Tester</description>
- <name>ruby-libvirt-tester</name>
+ <name>rb-libvirt-test</name>
<uuid>#{$GUEST_UUID}</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
@@ -59,11 +59,11 @@ $new_dom_xml = <<EOF
EOF
# qemu command-line that roughly corresponds to the above XML
-$qemu_cmd_line = "/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name ruby-libvirt-tester -uuid #{$GUEST_UUID} -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/ruby-libvirt-tester.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5"
+$qemu_cmd_line = "/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rb-libvirt-test -uuid #{$GUEST_UUID} -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/rb-libvirt-test.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5"
$NEW_INTERFACE_MAC = 'aa:bb:cc:dd:ee:ff'
$new_interface_xml = <<EOF
-<interface type="ethernet" name="ruby-libvirt-tester">
+<interface type="ethernet" name="rb-libvirt-test">
<start mode="onboot"/>
<mac address="#{$NEW_INTERFACE_MAC}"/>
<protocol family='ipv4'>
@@ -75,7 +75,7 @@ EOF
$NETWORK_UUID = "04068860-d9a2-47c5-bc9d-9e047ae901da"
$new_net_xml = <<EOF
<network>
- <name>ruby-libvirt-tester</name>
+ <name>rb-libvirt-test</name>
<uuid>#{$NETWORK_UUID}</uuid>
<forward mode='nat'/>
<bridge name='rubybr0' stp='on' delay='0' />
@@ -93,7 +93,7 @@ EOF
$NWFILTER_UUID = "bd339530-134c-6d07-441a-17fb90dad807"
$new_nwfilter_xml = <<EOF
-<filter name='ruby-libvirt-tester' chain='ipv4'>
+<filter name='rb-libvirt-test' chain='ipv4'>
<uuid>#{$NWFILTER_UUID}</uuid>
<rule action='accept' direction='out' priority='100'>
<ip srcipaddr='0.0.0.0' dstipaddr='255.255.255.255' protocol='tcp' srcportstart='63000' dstportstart='62000'/>
@@ -116,10 +116,10 @@ $new_secret_xml = <<EOF
EOF
$POOL_UUID = "33a5c045-645a-2c00-e56b-927cdf34e17a"
-$POOL_PATH = "/var/lib/libvirt/images/ruby-libvirt-tester"
+$POOL_PATH = "/var/lib/libvirt/images/rb-libvirt-test"
$new_storage_pool_xml = <<EOF
<pool type="dir">
- <name>ruby-libvirt-tester</name>
+ <name>rb-libvirt-test</name>
<uuid>#{$POOL_UUID}</uuid>
<target>
<path>#{$POOL_PATH}</path>
@@ -210,7 +210,7 @@ end
def cleanup_test_domain(conn)
# cleanup from previous runs
begin
- olddom = conn.lookup_domain_by_name("ruby-libvirt-tester")
+ olddom = conn.lookup_domain_by_name("rb-libvirt-test")
rescue
# in case we didn't find it, don't do anything
end
@@ -234,7 +234,7 @@ end
def cleanup_test_network(conn)
# initial cleanup for previous run
begin
- oldnet = conn.lookup_network_by_name("ruby-libvirt-tester")
+ oldnet = conn.lookup_network_by_name("rb-libvirt-test")
rescue
# in case we didn't find it, don't do anything
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/ruby-libvirt.git
More information about the Pkg-libvirt-commits
mailing list