ruby-libvirt-catphish 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +0 -2
- data/ext/libvirt/domain.c +14 -10
- data/ext/libvirt/extconf.h +3 -0
- data/ext/libvirt/extconf.rb +12 -46
- data/tests/test_domain.rb +2 -0
- data/tests/test_utils.rb +18 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd73b727d23f32250891c19ce05616436fef999b7533def9b6d36d252f6902ea
|
4
|
+
data.tar.gz: bc79e978eeee61d1f68bed0e9aed32dd0cc03524030ed1d030b7839aee1eab30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6684c55b663323a40b53c74b6971fa1b9f69cbdc687b1faa2eff7e441a771ef75cd9d4d05980aad28dfd8a603505908f3b06790a64f3d8301719e12b7f546b7
|
7
|
+
data.tar.gz: f36b0a73e4c452c36bba28bcd73eca96446c07e51860ee515368286883f589a55bb780206047078a93468560ca05a53aeee8911d438b0e4f79075ade1c364f87
|
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-catphish'
|
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
@@ -2290,9 +2290,7 @@ static struct ruby_libvirt_typed_param memory_allowed[] = {
|
|
2290
2290
|
{VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED, VIR_TYPED_PARAM_ULLONG},
|
2291
2291
|
{VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE, VIR_TYPED_PARAM_ULLONG},
|
2292
2292
|
{VIR_NODE_MEMORY_SHARED_FULL_SCANS, VIR_TYPED_PARAM_ULLONG},
|
2293
|
-
#if HAVE_CONST_VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
|
2294
2293
|
{VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, VIR_TYPED_PARAM_UINT},
|
2295
|
-
#endif
|
2296
2294
|
};
|
2297
2295
|
|
2298
2296
|
/*
|
data/ext/libvirt/domain.c
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
#include <ruby.h>
|
25
25
|
#include <ruby/thread.h>
|
26
26
|
/* we need to include st.h since ruby 1.8 needs it for RHash */
|
27
|
-
#include <st.h>
|
27
|
+
#include <ruby/st.h>
|
28
28
|
#include <libvirt/libvirt.h>
|
29
29
|
#if HAVE_VIRDOMAINQEMUMONITORCOMMAND
|
30
30
|
#include <libvirt/libvirt-qemu.h>
|
@@ -1972,12 +1972,8 @@ static struct ruby_libvirt_typed_param domain_scheduler_allowed[] = {
|
|
1972
1972
|
{VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG},
|
1973
1973
|
{VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, VIR_TYPED_PARAM_ULLONG},
|
1974
1974
|
{VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_TYPED_PARAM_LLONG},
|
1975
|
-
#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD
|
1976
1975
|
{VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, VIR_TYPED_PARAM_ULLONG},
|
1977
|
-
#endif
|
1978
|
-
#if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA
|
1979
1976
|
{VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, VIR_TYPED_PARAM_LLONG},
|
1980
|
-
#endif
|
1981
1977
|
{VIR_DOMAIN_SCHEDULER_WEIGHT, VIR_TYPED_PARAM_UINT},
|
1982
1978
|
{VIR_DOMAIN_SCHEDULER_CAP, VIR_TYPED_PARAM_UINT},
|
1983
1979
|
{VIR_DOMAIN_SCHEDULER_RESERVATION, VIR_TYPED_PARAM_LLONG},
|
@@ -3286,9 +3282,7 @@ static struct ruby_libvirt_typed_param iotune_allowed[] = {
|
|
3286
3282
|
{VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3287
3283
|
{VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3288
3284
|
{VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3289
|
-
#if HAVE_CONST_VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC
|
3290
3285
|
{VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, VIR_TYPED_PARAM_ULLONG},
|
3291
|
-
#endif
|
3292
3286
|
};
|
3293
3287
|
|
3294
3288
|
/*
|
@@ -3799,6 +3793,10 @@ static VALUE libvirt_domain_qemu_agent_command(int argc, VALUE *argv, VALUE d)
|
|
3799
3793
|
|
3800
3794
|
rb_scan_args(argc, argv, "12", &command, &timeout, &flags);
|
3801
3795
|
|
3796
|
+
if (NIL_P(timeout)) {
|
3797
|
+
timeout = INT2NUM(VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT);
|
3798
|
+
}
|
3799
|
+
|
3802
3800
|
ret = virDomainQemuAgentCommand(ruby_libvirt_domain_get(d),
|
3803
3801
|
StringValueCStr(command),
|
3804
3802
|
ruby_libvirt_value_to_int(timeout),
|
@@ -3890,16 +3888,14 @@ static struct ruby_libvirt_typed_param migrate3_allowed[] = {
|
|
3890
3888
|
{VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING},
|
3891
3889
|
{VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG},
|
3892
3890
|
{VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING},
|
3893
|
-
#if HAVE_CONST_VIR_MIGRATE_PARAM_LISTEN_ADDRESS
|
3894
3891
|
{VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING},
|
3895
|
-
#endif
|
3896
3892
|
};
|
3897
3893
|
|
3898
3894
|
/*
|
3899
3895
|
* call-seq:
|
3900
3896
|
* dom.migrate3(dconn, Hash=nil, flags=0) -> Libvirt::Domain
|
3901
3897
|
*
|
3902
|
-
* Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#
|
3898
|
+
* Call virDomainMigrate3[http://www.libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate3]
|
3903
3899
|
* to migrate a domain from the host on this connection to the connection
|
3904
3900
|
* referenced in dconn.
|
3905
3901
|
*/
|
@@ -4566,6 +4562,14 @@ void ruby_libvirt_domain_init(void)
|
|
4566
4562
|
#if HAVE_CONST_VIR_DOMAIN_UNDEFINE_NVRAM
|
4567
4563
|
rb_define_const(c_domain, "UNDEFINE_NVRAM",
|
4568
4564
|
INT2NUM(VIR_DOMAIN_UNDEFINE_NVRAM));
|
4565
|
+
#endif
|
4566
|
+
#if HAVE_CONST_VIR_DOMAIN_UNDEFINE_KEEP_NVRAM
|
4567
|
+
rb_define_const(c_domain, "UNDEFINE_KEEP_NVRAM",
|
4568
|
+
INT2NUM(VIR_DOMAIN_UNDEFINE_KEEP_NVRAM));
|
4569
|
+
#endif
|
4570
|
+
#if HAVE_CONST_VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA
|
4571
|
+
rb_define_const(c_domain, "UNDEFINE_CHECKPOINTS_METADATA",
|
4572
|
+
INT2NUM(VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA));
|
4569
4573
|
#endif
|
4570
4574
|
rb_define_attr(c_domain, "connection", 1, 0);
|
4571
4575
|
|
data/ext/libvirt/extconf.h
CHANGED
@@ -345,6 +345,8 @@
|
|
345
345
|
#define HAVE_CONST_VIR_DOMAIN_DEFINE_VALIDATE 1
|
346
346
|
#define HAVE_CONST_VIR_DOMAIN_PASSWORD_ENCRYPTED 1
|
347
347
|
#define HAVE_CONST_VIR_DOMAIN_TIME_SYNC 1
|
348
|
+
#define HAVE_CONST_VIR_DOMAIN_UNDEFINE_KEEP_NVRAM 1
|
349
|
+
#define HAVE_CONST_VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA 1
|
348
350
|
#define HAVE_CONST_VIR_FROM_VMWARE 1
|
349
351
|
#define HAVE_CONST_VIR_FROM_AUDIT 1
|
350
352
|
#define HAVE_CONST_VIR_FROM_SYSINFO 1
|
@@ -381,6 +383,7 @@
|
|
381
383
|
#define HAVE_VIRDOMAINQEMUMONITORCOMMAND 1
|
382
384
|
#define HAVE_VIRDOMAINQEMUATTACH 1
|
383
385
|
#define HAVE_VIRDOMAINQEMUAGENTCOMMAND 1
|
386
|
+
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN 1
|
384
387
|
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK 1
|
385
388
|
#define HAVE_CONST_VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT 1
|
386
389
|
#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,17 +395,17 @@ 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',
|
407
|
+
'VIR_DOMAIN_UNDEFINE_KEEP_NVRAM',
|
408
|
+
'VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA',
|
444
409
|
]
|
445
410
|
|
446
411
|
virterror_consts = [
|
@@ -480,6 +445,7 @@ virterror_consts = [
|
|
480
445
|
]
|
481
446
|
|
482
447
|
libvirt_qemu_consts = [
|
448
|
+
'VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN',
|
483
449
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK',
|
484
450
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT',
|
485
451
|
'VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT',
|
@@ -492,13 +458,13 @@ libvirt_funcs.each { |f| have_func(f, "libvirt/libvirt.h") }
|
|
492
458
|
libvirt_consts.each { |c| have_const(c, ["libvirt/libvirt.h"]) }
|
493
459
|
virterror_consts.each { |c| have_const(c, ["libvirt/virterror.h"]) }
|
494
460
|
if find_header("libvirt/libvirt-qemu.h")
|
495
|
-
have_library("virt-qemu", "virDomainQemuMonitorCommand")
|
461
|
+
have_library("virt-qemu", "virDomainQemuMonitorCommand", "libvirt/libvirt-qemu.h")
|
496
462
|
libvirt_qemu_funcs.each { |f| have_func(f, "libvirt/libvirt-qemu.h") }
|
497
463
|
libvirt_qemu_consts.each { |c| have_const(c, ["libvirt/libvirt-qemu.h"]) }
|
498
464
|
end
|
499
465
|
|
500
466
|
if find_header("libvirt/libvirt-lxc.h")
|
501
|
-
have_library("virt-lxc", "virDomainLxcOpenNamespace")
|
467
|
+
have_library("virt-lxc", "virDomainLxcOpenNamespace", "libvirt/libvirt-lxc.h")
|
502
468
|
libvirt_lxc_funcs.each{ |f| have_func(f, "libvirt/libvirt-lxc.h") }
|
503
469
|
end
|
504
470
|
|
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-catphish
|
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: 2022-02-02 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,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
80
|
-
signing_key:
|
79
|
+
rubygems_version: 3.2.32
|
80
|
+
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Ruby bindings for LIBVIRT
|
83
83
|
test_files: []
|