ruby-libvirt 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/NEWS +7 -0
- data/Rakefile +2 -2
- data/ext/libvirt/common.c +9 -4
- data/ext/libvirt/common.h +1 -1
- data/ext/libvirt/connect.c +12 -4
- data/ext/libvirt/domain.c +10 -13
- data/ext/libvirt/extconf.h +1 -0
- data/ext/libvirt/extconf.rb +10 -46
- data/tests/test_domain.rb +2 -0
- data/tests/test_utils.rb +18 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ca7edd355f3679b48ebacb442e8d9c3d77af72a88681064e06a247ceabd4e391
|
4
|
+
data.tar.gz: dd4253fb78b7e584396aec931be145bc236db2e86a56eb275fe7c5675e7cd3f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf2f9cb3c62d5fb51e919eac7513603bbae31b23b7c712238fc98064c11563451963f5d6bdaa8e6c25f9680bdec14dcc651184d52001cb3d6c24a56134d7535f
|
7
|
+
data.tar.gz: 5561b660c8ec0ce8d61c363a6f1c467c3563277c55998661b75e24936fb6c11708e774a1aab859bfe48fc4f54c1864c371f620cb54bfabe9c9a2ae55d8d33c47
|
data/NEWS
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2021-11-15 0.8.0
|
2
|
+
* Fix default values for node_cpu_stats and node_memory_stats
|
3
|
+
* Fix cpumap allocation for virDomainGetVcpus
|
4
|
+
* Enforce UTF8 for strings and exceptions
|
5
|
+
* Drop local have_const
|
6
|
+
* Use sensible default for libvirt_domain_qemu_agent_command
|
7
|
+
|
1
8
|
2018-02-18 0.7.1
|
2
9
|
* Fix a bad bug in block_resize (Marius Rieder)
|
3
10
|
* Fix up some problems pointed out by clang
|
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ require 'rubygems/package_task'
|
|
21
21
|
require 'rbconfig'
|
22
22
|
|
23
23
|
PKG_NAME='ruby-libvirt'
|
24
|
-
PKG_VERSION='0.
|
24
|
+
PKG_VERSION='0.8.0'
|
25
25
|
|
26
26
|
EXT_CONF='ext/libvirt/extconf.rb'
|
27
27
|
MAKEFILE="ext/libvirt/Makefile"
|
@@ -145,7 +145,7 @@ SPEC = Gem::Specification.new do |s|
|
|
145
145
|
s.author = "David Lutterkort, Chris Lalancette"
|
146
146
|
s.rubyforge_project = "None"
|
147
147
|
s.description = "Ruby bindings for libvirt."
|
148
|
-
s.license = "
|
148
|
+
s.license = "LGPL-2.1-or-later"
|
149
149
|
end
|
150
150
|
|
151
151
|
Gem::PackageTask.new(SPEC) do |pkg|
|
data/ext/libvirt/common.c
CHANGED
@@ -24,7 +24,8 @@
|
|
24
24
|
#endif
|
25
25
|
#include <stdio.h>
|
26
26
|
#include <ruby.h>
|
27
|
-
#include <
|
27
|
+
#include <ruby/encoding.h>
|
28
|
+
#include <ruby/st.h>
|
28
29
|
#include <libvirt/libvirt.h>
|
29
30
|
#include <libvirt/virterror.h>
|
30
31
|
#include "common.h"
|
@@ -38,8 +39,9 @@ struct rb_exc_new2_arg {
|
|
38
39
|
static VALUE ruby_libvirt_exc_new2_wrap(VALUE arg)
|
39
40
|
{
|
40
41
|
struct rb_exc_new2_arg *e = (struct rb_exc_new2_arg *)arg;
|
42
|
+
VALUE ruby_msg = ruby_libvirt_str_new2_wrap((VALUE)&e->msg);
|
41
43
|
|
42
|
-
return
|
44
|
+
return rb_exc_new3(e->error, ruby_msg);
|
43
45
|
}
|
44
46
|
|
45
47
|
VALUE ruby_libvirt_ary_new2_wrap(VALUE arg)
|
@@ -66,8 +68,11 @@ VALUE ruby_libvirt_ary_store_wrap(VALUE arg)
|
|
66
68
|
VALUE ruby_libvirt_str_new2_wrap(VALUE arg)
|
67
69
|
{
|
68
70
|
char **str = (char **)arg;
|
71
|
+
VALUE ruby_msg = rb_str_new2(*str);
|
72
|
+
int enc = rb_enc_find_index("UTF-8");
|
69
73
|
|
70
|
-
|
74
|
+
rb_enc_associate_index(ruby_msg, enc);
|
75
|
+
return ruby_msg;
|
71
76
|
}
|
72
77
|
|
73
78
|
VALUE ruby_libvirt_str_new_wrap(VALUE arg)
|
@@ -144,7 +149,7 @@ void ruby_libvirt_raise_error_if(const int condition, VALUE error,
|
|
144
149
|
rb_iv_set(ruby_errinfo, "@libvirt_level", INT2NUM(err->level));
|
145
150
|
if (err->message != NULL) {
|
146
151
|
rb_iv_set(ruby_errinfo, "@libvirt_message",
|
147
|
-
|
152
|
+
ruby_libvirt_str_new2_wrap((VALUE)&err->message));
|
148
153
|
}
|
149
154
|
}
|
150
155
|
|
data/ext/libvirt/common.h
CHANGED
data/ext/libvirt/connect.c
CHANGED
@@ -2079,7 +2079,12 @@ static VALUE libvirt_connect_node_cpu_stats(int argc, VALUE *argv, VALUE c)
|
|
2079
2079
|
|
2080
2080
|
rb_scan_args(argc, argv, "02", &intparam, &flags);
|
2081
2081
|
|
2082
|
-
|
2082
|
+
if (NIL_P(intparam)) {
|
2083
|
+
tmp = -1;
|
2084
|
+
}
|
2085
|
+
else {
|
2086
|
+
tmp = ruby_libvirt_value_to_int(intparam);
|
2087
|
+
}
|
2083
2088
|
|
2084
2089
|
return ruby_libvirt_get_parameters(c, ruby_libvirt_value_to_uint(flags),
|
2085
2090
|
(void *)&tmp, sizeof(virNodeCPUStats),
|
@@ -2139,7 +2144,12 @@ static VALUE libvirt_connect_node_memory_stats(int argc, VALUE *argv, VALUE c)
|
|
2139
2144
|
|
2140
2145
|
rb_scan_args(argc, argv, "02", &intparam, &flags);
|
2141
2146
|
|
2142
|
-
|
2147
|
+
if (NIL_P(intparam)) {
|
2148
|
+
tmp = -1;
|
2149
|
+
}
|
2150
|
+
else {
|
2151
|
+
tmp = ruby_libvirt_value_to_int(intparam);
|
2152
|
+
}
|
2143
2153
|
|
2144
2154
|
return ruby_libvirt_get_parameters(c, ruby_libvirt_value_to_uint(flags),
|
2145
2155
|
(void *)&tmp, sizeof(virNodeMemoryStats),
|
@@ -2280,9 +2290,7 @@ static struct ruby_libvirt_typed_param memory_allowed[] = {
|
|
2280
2290
|
{VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED, VIR_TYPED_PARAM_ULLONG},
|
2281
2291
|
{VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE, VIR_TYPED_PARAM_ULLONG},
|
2282
2292
|
{VIR_NODE_MEMORY_SHARED_FULL_SCANS, VIR_TYPED_PARAM_ULLONG},
|
2283
|
-
#if HAVE_CONST_VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
|
2284
2293
|
{VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, VIR_TYPED_PARAM_UINT},
|
2285
|
-
#endif
|
2286
2294
|
};
|
2287
2295
|
|
2288
2296
|
/*
|
data/ext/libvirt/domain.c
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
#include <unistd.h>
|
24
24
|
#include <ruby.h>
|
25
25
|
/* we need to include st.h since ruby 1.8 needs it for RHash */
|
26
|
-
#include <st.h>
|
26
|
+
#include <ruby/st.h>
|
27
27
|
#include <libvirt/libvirt.h>
|
28
28
|
#if HAVE_VIRDOMAINQEMUMONITORCOMMAND
|
29
29
|
#include <libvirt/libvirt-qemu.h>
|
@@ -803,7 +803,7 @@ static VALUE libvirt_domain_vcpus(VALUE d)
|
|
803
803
|
|
804
804
|
cpumaplen = VIR_CPU_MAPLEN(maxcpus);
|
805
805
|
|
806
|
-
cpumap = alloca(sizeof(unsigned char) * cpumaplen);
|
806
|
+
cpumap = alloca(sizeof(unsigned char) * cpumaplen * dominfo.nrVirtCpu);
|
807
807
|
|
808
808
|
r = virDomainGetVcpus(ruby_libvirt_domain_get(d), cpuinfo,
|
809
809
|
dominfo.nrVirtCpu, cpumap, cpumaplen);
|
@@ -832,15 +832,16 @@ static VALUE libvirt_domain_vcpus(VALUE d)
|
|
832
832
|
|
833
833
|
result = rb_ary_new();
|
834
834
|
|
835
|
-
for (i = 0; i <
|
835
|
+
for (i = 0; i < r; i++) {
|
836
836
|
vcpuinfo = rb_class_new_instance(0, NULL, c_domain_vcpuinfo);
|
837
|
-
rb_iv_set(vcpuinfo, "@number", UINT2NUM(i));
|
838
837
|
if (cpuinfo != NULL) {
|
838
|
+
rb_iv_set(vcpuinfo, "@number", INT2NUM(cpuinfo[i].number));
|
839
839
|
rb_iv_set(vcpuinfo, "@state", INT2NUM(cpuinfo[i].state));
|
840
840
|
rb_iv_set(vcpuinfo, "@cpu_time", ULL2NUM(cpuinfo[i].cpuTime));
|
841
841
|
rb_iv_set(vcpuinfo, "@cpu", INT2NUM(cpuinfo[i].cpu));
|
842
842
|
}
|
843
843
|
else {
|
844
|
+
rb_iv_set(vcpuinfo, "@number", Qnil);
|
844
845
|
rb_iv_set(vcpuinfo, "@state", Qnil);
|
845
846
|
rb_iv_set(vcpuinfo, "@cpu_time", Qnil);
|
846
847
|
rb_iv_set(vcpuinfo, "@cpu", Qnil);
|
@@ -1948,12 +1949,8 @@ static struct ruby_libvirt_typed_param domain_scheduler_allowed[] = {
|
|
1948
1949
|
{VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG},
|
1949
1950
|
{VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, VIR_TYPED_PARAM_ULLONG},
|
1950
1951
|
{VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_TYPED_PARAM_LLONG},
|
1951
|
-
#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD
|
1952
1952
|
{VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, VIR_TYPED_PARAM_ULLONG},
|
1953
|
-
#endif
|
1954
|
-
#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA
|
1955
1953
|
{VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, VIR_TYPED_PARAM_LLONG},
|
1956
|
-
#endif
|
1957
1954
|
{VIR_DOMAIN_SCHEDULER_WEIGHT, VIR_TYPED_PARAM_UINT},
|
1958
1955
|
{VIR_DOMAIN_SCHEDULER_CAP, VIR_TYPED_PARAM_UINT},
|
1959
1956
|
{VIR_DOMAIN_SCHEDULER_RESERVATION, VIR_TYPED_PARAM_LLONG},
|
@@ -3262,9 +3259,7 @@ static struct ruby_libvirt_typed_param iotune_allowed[] = {
|
|
3262
3259
|
{VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3263
3260
|
{VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3264
3261
|
{VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3265
|
-
#if HAVE_CONST_VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC
|
3266
3262
|
{VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3267
|
-
#endif
|
3268
3263
|
};
|
3269
3264
|
|
3270
3265
|
/*
|
@@ -3775,6 +3770,10 @@ static VALUE libvirt_domain_qemu_agent_command(int argc, VALUE *argv, VALUE d)
|
|
3775
3770
|
|
3776
3771
|
rb_scan_args(argc, argv, "12", &command, &timeout, &flags);
|
3777
3772
|
|
3773
|
+
if (NIL_P(timeout)) {
|
3774
|
+
timeout = INT2NUM(VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT);
|
3775
|
+
}
|
3776
|
+
|
3778
3777
|
ret = virDomainQemuAgentCommand(ruby_libvirt_domain_get(d),
|
3779
3778
|
StringValueCStr(command),
|
3780
3779
|
ruby_libvirt_value_to_int(timeout),
|
@@ -3866,16 +3865,14 @@ static struct ruby_libvirt_typed_param migrate3_allowed[] = {
|
|
3866
3865
|
{VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING},
|
3867
3866
|
{VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG},
|
3868
3867
|
{VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING},
|
3869
|
-
#if HAVE_CONST_VIR_MIGRATE_PARAM_LISTEN_ADDRESS
|
3870
3868
|
{VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING},
|
3871
|
-
#endif
|
3872
3869
|
};
|
3873
3870
|
|
3874
3871
|
/*
|
3875
3872
|
* call-seq:
|
3876
3873
|
* dom.migrate3(dconn, Hash=nil, flags=0) -> Libvirt::Domain
|
3877
3874
|
*
|
3878
|
-
* Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#
|
3875
|
+
* Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate3]
|
3879
3876
|
* to migrate a domain from the host on this connection to the connection
|
3880
3877
|
* referenced in dconn.
|
3881
3878
|
*/
|
data/ext/libvirt/extconf.h
CHANGED
@@ -381,6 +381,7 @@
|
|
381
381
|
#define HAVE_VIRDOMAINQEMUMONITORCOMMAND 1
|
382
382
|
#define HAVE_VIRDOMAINQEMUATTACH 1
|
383
383
|
#define HAVE_VIRDOMAINQEMUAGENTCOMMAND 1
|
384
|
+
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN 1
|
384
385
|
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK 1
|
385
386
|
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT 1
|
386
387
|
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT 1
|
data/ext/libvirt/extconf.rb
CHANGED
@@ -4,38 +4,6 @@ RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
|
4
4
|
RbConfig::MAKEFILE_CONFIG['CCDLFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
|
5
5
|
RbConfig::MAKEFILE_CONFIG['EXTDLDFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
|
6
6
|
|
7
|
-
# older mkmf does not have checking_message, so implement our own here
|
8
|
-
def libvirt_checking_message(target, place = nil, opt = nil)
|
9
|
-
[["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
|
10
|
-
if noun
|
11
|
-
[[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
|
12
|
-
if noun.respond_to?(meth)
|
13
|
-
break noun = noun.send(meth, *args)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
msg << " #{pre} #{noun}" unless noun.empty?
|
17
|
-
end
|
18
|
-
msg
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def have_const(const, headers = nil, opt = "", &b)
|
23
|
-
checking_for libvirt_checking_message(const, headers, opt) do
|
24
|
-
headers = cpp_include(headers)
|
25
|
-
if try_compile(<<"SRC", opt, &b)
|
26
|
-
#{COMMON_HEADERS}
|
27
|
-
#{headers}
|
28
|
-
/*top*/
|
29
|
-
static int t = #{const};
|
30
|
-
SRC
|
31
|
-
$defs.push(format("-DHAVE_CONST_%s", const.strip.upcase.tr_s("^A-Z0-9_", "_")))
|
32
|
-
true
|
33
|
-
else
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
7
|
extension_name = '_libvirt'
|
40
8
|
|
41
9
|
# this is a poor-man's dir_config, but is a bit more flexible. In particular,
|
@@ -58,22 +26,23 @@ extension_name = '_libvirt'
|
|
58
26
|
include = with_config("libvirt-include")
|
59
27
|
lib = with_config("libvirt-lib")
|
60
28
|
if include and lib
|
29
|
+
print "Looking for libvirt in " + include + " and " + lib + "\n"
|
61
30
|
$LIBPATH = [lib] | $LIBPATH
|
62
31
|
$CPPFLAGS += " -I" + include
|
63
|
-
have_library("virt", "virConnectOpen", "libvirt/libvirt.h")
|
64
|
-
|
65
|
-
# if we are using custom libvirt libraries, we have to suppress the default
|
66
|
-
# library path so have_func() only picks up the custom ones, not the installed
|
67
|
-
# ones
|
68
|
-
$DEFLIBPATH = []
|
69
32
|
elsif (include and not lib) or (not include and lib)
|
70
33
|
raise "Must specify both --with-libvirt-include and --with-libvirt-lib, or neither"
|
71
34
|
else
|
35
|
+
print "Looking for libvirt using pkg-config\n"
|
72
36
|
unless pkg_config("libvirt")
|
73
37
|
raise "libvirt library not found in default locations"
|
74
38
|
end
|
75
39
|
end
|
76
40
|
|
41
|
+
# Quick sanity check: if we can't find the virConnectOpen() function,
|
42
|
+
# there's no way anything will work and we might as well give up now
|
43
|
+
unless have_library("virt", "virConnectOpen", "libvirt/libvirt.h")
|
44
|
+
raise "No working libvirt installation found"
|
45
|
+
end
|
77
46
|
|
78
47
|
libvirt_types = [ 'virNetworkPtr',
|
79
48
|
'virStoragePoolPtr',
|
@@ -409,11 +378,7 @@ libvirt_consts = [ 'VIR_MIGRATE_LIVE',
|
|
409
378
|
'VIR_DOMAIN_BLOCK_JOB_FAILED',
|
410
379
|
'VIR_DOMAIN_BLOCK_JOB_CANCELED',
|
411
380
|
'VIR_DOMAIN_BLOCK_JOB_READY',
|
412
|
-
'VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES',
|
413
381
|
'VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC',
|
414
|
-
'VIR_MIGRATE_PARAM_LISTEN_ADDRESS',
|
415
|
-
'VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD',
|
416
|
-
'VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA',
|
417
382
|
'VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT',
|
418
383
|
'VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE',
|
419
384
|
'VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC',
|
@@ -430,14 +395,12 @@ libvirt_consts = [ 'VIR_MIGRATE_LIVE',
|
|
430
395
|
'VIR_DOMAIN_BLOCK_COMMIT_ACTIVE',
|
431
396
|
'VIR_DOMAIN_BLOCK_COMMIT_RELATIVE',
|
432
397
|
'VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES',
|
433
|
-
'VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC',
|
434
398
|
'VIR_STORAGE_POOL_CREATE_NORMAL',
|
435
399
|
'VIR_STORAGE_POOL_CREATE_WITH_BUILD',
|
436
400
|
'VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE',
|
437
401
|
'VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE',
|
438
402
|
'VIR_STORAGE_VOL_CREATE_REFLINK',
|
439
403
|
'VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS',
|
440
|
-
'VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN',
|
441
404
|
'VIR_DOMAIN_DEFINE_VALIDATE',
|
442
405
|
'VIR_DOMAIN_PASSWORD_ENCRYPTED',
|
443
406
|
'VIR_DOMAIN_TIME_SYNC',
|
@@ -480,6 +443,7 @@ virterror_consts = [
|
|
480
443
|
]
|
481
444
|
|
482
445
|
libvirt_qemu_consts = [
|
446
|
+
'VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN',
|
483
447
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK',
|
484
448
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT',
|
485
449
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT',
|
@@ -492,13 +456,13 @@ libvirt_funcs.each { |f| have_func(f, "libvirt/libvirt.h") }
|
|
492
456
|
libvirt_consts.each { |c| have_const(c, ["libvirt/libvirt.h"]) }
|
493
457
|
virterror_consts.each { |c| have_const(c, ["libvirt/virterror.h"]) }
|
494
458
|
if find_header("libvirt/libvirt-qemu.h")
|
495
|
-
have_library("virt-qemu", "virDomainQemuMonitorCommand")
|
459
|
+
have_library("virt-qemu", "virDomainQemuMonitorCommand", "libvirt/libvirt-qemu.h")
|
496
460
|
libvirt_qemu_funcs.each { |f| have_func(f, "libvirt/libvirt-qemu.h") }
|
497
461
|
libvirt_qemu_consts.each { |c| have_const(c, ["libvirt/libvirt-qemu.h"]) }
|
498
462
|
end
|
499
463
|
|
500
464
|
if find_header("libvirt/libvirt-lxc.h")
|
501
|
-
have_library("virt-lxc", "virDomainLxcOpenNamespace")
|
465
|
+
have_library("virt-lxc", "virDomainLxcOpenNamespace", "libvirt/libvirt-lxc.h")
|
502
466
|
libvirt_lxc_funcs.each{ |f| have_func(f, "libvirt/libvirt-lxc.h") }
|
503
467
|
end
|
504
468
|
|
data/tests/test_domain.rb
CHANGED
@@ -606,6 +606,7 @@ sleep 1
|
|
606
606
|
expect_too_many_args(newdom, "name", 1)
|
607
607
|
|
608
608
|
expect_success(newdom, "no args", "name") {|x| x == "rb-libvirt-test"}
|
609
|
+
expect_success(newdom, "is UTF-8", "name") {|x| x.encoding.name == "UTF-8"}
|
609
610
|
|
610
611
|
newdom.destroy
|
611
612
|
|
@@ -909,6 +910,7 @@ expect_too_many_args(newdom, "lookup_snapshot_by_name", 1, 2, 3)
|
|
909
910
|
expect_too_few_args(newdom, "lookup_snapshot_by_name")
|
910
911
|
expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 1)
|
911
912
|
expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 'foo', 'bar')
|
913
|
+
expect_utf8_exception_msg(newdom, Libvirt::RetrieveError, "lookup_snapshot_by_name", "__non_existing_snapshot")
|
912
914
|
|
913
915
|
expect_success(newdom, "name arg", "lookup_snapshot_by_name", "foo")
|
914
916
|
|
data/tests/test_utils.rb
CHANGED
@@ -166,6 +166,24 @@ def expect_fail(object, errtype, errmsg, func, *args)
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
+
def expect_utf8_exception_msg(object, errtype, func, *args)
|
170
|
+
begin
|
171
|
+
object.__send__(func, *args)
|
172
|
+
rescue NoMethodError
|
173
|
+
puts_skipped "#{$test_object}.#{func} does not exist"
|
174
|
+
rescue errtype => e
|
175
|
+
if e.message.encoding.name == 'UTF-8'
|
176
|
+
puts_ok "#{$test_object}.#{func} threw #{errtype.to_s} with UTF-8 encoding"
|
177
|
+
else
|
178
|
+
puts_fail "#{$test_object}.#{func} threw #{errtype.to_s} with #{e.message.encoding.name} encoding"
|
179
|
+
end
|
180
|
+
rescue => e
|
181
|
+
puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but instead threw #{e.class.to_s}: #{e.to_s}"
|
182
|
+
else
|
183
|
+
puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but threw nothing"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
169
187
|
def expect_too_many_args(object, func, *args)
|
170
188
|
expect_fail(object, ArgumentError, "too many args", func, *args)
|
171
189
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lutterkort, Chris Lalancette
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby bindings for libvirt.
|
14
14
|
email: libvir-list@redhat.com
|
@@ -59,9 +59,9 @@ files:
|
|
59
59
|
- tests/test_utils.rb
|
60
60
|
homepage: http://libvirt.org/ruby/
|
61
61
|
licenses:
|
62
|
-
-
|
62
|
+
- LGPL-2.1-or-later
|
63
63
|
metadata: {}
|
64
|
-
post_install_message:
|
64
|
+
post_install_message:
|
65
65
|
rdoc_options: []
|
66
66
|
require_paths:
|
67
67
|
- lib
|
@@ -76,9 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
|
80
|
-
|
81
|
-
signing_key:
|
79
|
+
rubygems_version: 3.2.22
|
80
|
+
signing_key:
|
82
81
|
specification_version: 4
|
83
82
|
summary: Ruby bindings for LIBVIRT
|
84
83
|
test_files: []
|