ruby-libvirt 0.8.2 → 0.8.4
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 +4 -4
- data/NEWS.rst +235 -0
- data/README.rst +45 -0
- data/Rakefile +114 -93
- data/ext/libvirt/common.c +11 -0
- data/ext/libvirt/common.h +2 -0
- data/ext/libvirt/connect.c +3 -0
- data/ext/libvirt/domain.c +7 -0
- data/ext/libvirt/extconf.rb +0 -4
- data/ext/libvirt/interface.c +4 -0
- data/ext/libvirt/network.c +4 -0
- data/ext/libvirt/nodedevice.c +3 -0
- data/ext/libvirt/nwfilter.c +4 -0
- data/ext/libvirt/secret.c +3 -0
- data/ext/libvirt/storage.c +6 -0
- data/ext/libvirt/stream.c +3 -0
- data/tests/test_conn.rb +140 -125
- data/tests/test_domain.rb +279 -270
- data/tests/test_interface.rb +7 -5
- data/tests/test_network.rb +1 -1
- data/tests/test_nwfilter.rb +31 -21
- data/tests/test_open.rb +202 -190
- data/tests/test_secret.rb +75 -57
- data/tests/test_storage.rb +103 -88
- data/tests/test_utils.rb +16 -6
- metadata +17 -12
- data/NEWS +0 -158
- data/README +0 -219
- data/ext/libvirt/extconf.h +0 -3
- /data/{README.rdoc → doc/main.rdoc} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39fda947f631865aa0b6f0583aad469746de1bde687a106f08e9cc40167bb78c
|
4
|
+
data.tar.gz: 010a9b66860d55d01ea1220a896a267151bb0c773261c37076101fb7dcae439e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc4db18a21728f16e913fd1f23a2b9de39c46e17a9936f72c4cf9d4da7d6f9051a95a55cb750504640e8bc9ba12055d4a505f441c73ccadb32024983dd326e67
|
7
|
+
data.tar.gz: cb461a77f74fe3a69ac5ae4e52ba46a2b2bbaebf759dd4b8301296842c378501e0e3801e506ffd9a0b4d14f560dabe9e7cd3e6c49d77d3b93083b19bff9cdfaa
|
data/NEWS.rst
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
=====================
|
2
|
+
ruby-libvirt releases
|
3
|
+
=====================
|
4
|
+
|
5
|
+
|
6
|
+
0.8.4 (2024-08-01)
|
7
|
+
==================
|
8
|
+
|
9
|
+
* Explicitly disallow use of ``new`` for wrapper classes
|
10
|
+
|
11
|
+
|
12
|
+
0.8.3 (2024-05-13)
|
13
|
+
==================
|
14
|
+
|
15
|
+
* Fix runtime warnings with Ruby >= 3.2
|
16
|
+
* Improve build system
|
17
|
+
* Improve website
|
18
|
+
|
19
|
+
|
20
|
+
0.8.2 (2024-02-09)
|
21
|
+
==================
|
22
|
+
|
23
|
+
* Fix ``StoragePool#list_all_volumes``
|
24
|
+
* Fix regression in ``Domain#attach_device`` and ``Domain#detach_device``
|
25
|
+
|
26
|
+
|
27
|
+
0.8.1 (2024-02-08)
|
28
|
+
==================
|
29
|
+
|
30
|
+
* Add missing ``virDomainUndefineFlagsValues`` constants
|
31
|
+
* Require libvirt 2.0.0
|
32
|
+
* Always use pkg-config for detecting libvirt
|
33
|
+
* Drop most compile-time feature checks
|
34
|
+
|
35
|
+
|
36
|
+
0.8.0 (2021-11-15)
|
37
|
+
==================
|
38
|
+
|
39
|
+
* Fix default values for ``node_cpu_stats`` and ``node_memory_stats``
|
40
|
+
* Fix cpumap allocation for ``virDomainGetVcpus``
|
41
|
+
* Enforce UTF8 for strings and exceptions
|
42
|
+
* Drop local ``have_const``
|
43
|
+
* Use sensible default for ``libvirt_domain_qemu_agent_command``
|
44
|
+
|
45
|
+
|
46
|
+
0.7.1 (2018-02-18)
|
47
|
+
==================
|
48
|
+
|
49
|
+
* Fix a bad bug in block_resize (Marius Rieder)
|
50
|
+
* Fix up some problems pointed out by clang
|
51
|
+
* Fix up the tests for small semantic differences in how libvirt works
|
52
|
+
|
53
|
+
|
54
|
+
0.7.0 (2016-09-22)
|
55
|
+
==================
|
56
|
+
|
57
|
+
* Fix network lease API to allow arguments that libvirt allows
|
58
|
+
* Implement ``VIRT_STORAGE_POOL_CREATE`` flags
|
59
|
+
* Implement more ``VIR_STORAGE_VOL`` flags
|
60
|
+
* Implement ``VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN``
|
61
|
+
* Implement ``virDomainDefineXMLFlags``
|
62
|
+
* Implement ``virDomainRename``
|
63
|
+
* Implement ``virDomainSetUserPassword``
|
64
|
+
* Implement ``VIR_DOMAIN_TIME_SYNC``
|
65
|
+
* Fix the return value from ``virStreamSourceFunc`` so volume upload works
|
66
|
+
|
67
|
+
|
68
|
+
0.6.0 (2015-11-20)
|
69
|
+
==================
|
70
|
+
|
71
|
+
* Fix possible buffer overflow
|
72
|
+
* Fix storage volume creation error messages
|
73
|
+
* Add additional storage pool defines
|
74
|
+
* Implement ``Network#dhcp_leases`` method
|
75
|
+
* Implement ``Connect#node_alloc_pages`` method
|
76
|
+
* Implement ``Domain#time`` method
|
77
|
+
* Implement ``Connect#domain_capabilities`` method
|
78
|
+
* Implement ``Domain#core_dump_with_format`` method
|
79
|
+
* Implement ``Domain#fs_freeze`` method
|
80
|
+
* Implement ``Domain#fs_info`` method
|
81
|
+
* Implement ``Connect#node_free_pages`` method
|
82
|
+
|
83
|
+
|
84
|
+
0.5.2 (2014-01-08)
|
85
|
+
==================
|
86
|
+
|
87
|
+
* Fix to make sure we don't free more entires than retrieved
|
88
|
+
|
89
|
+
|
90
|
+
0.5.1 (2013-12-15)
|
91
|
+
==================
|
92
|
+
|
93
|
+
* Fixes to compile against older libvirt
|
94
|
+
* Fixes to compile against ruby 1.8
|
95
|
+
|
96
|
+
|
97
|
+
0.5.0 (2013-12-09)
|
98
|
+
==================
|
99
|
+
|
100
|
+
* Updated ``Network`` class, implementing almost all libvirt APIs
|
101
|
+
* Updated ``Domain`` class, implementing almost all libvirt APIs
|
102
|
+
* Updated ``Connection`` class, implementing almost all libvirt APIs
|
103
|
+
* Updated ``DomainSnapshot`` class, implementing almost all libvirt APIs
|
104
|
+
* Updated ``NodeDevice`` class, implementing almost all libvirt APIs
|
105
|
+
* Updated ``Storage`` class, implementing almost all libvirt APIs
|
106
|
+
* Add constants for almost all libvirt defines
|
107
|
+
* Improved performance in the library by using alloca
|
108
|
+
|
109
|
+
|
110
|
+
0.4.0 (2011-07-27)
|
111
|
+
==================
|
112
|
+
|
113
|
+
* Updated ``Domain`` class, implementing ``dom.memory_parameters=``,
|
114
|
+
``dom.memory_parameters``, ``dom.updated?``, ``dom.migrate2``,
|
115
|
+
``dom.migrate_to_uri2``, ``dom.migrate_set_max_speed``,
|
116
|
+
``dom.qemu_monitor_command``, ``dom.blkio_parameters``,
|
117
|
+
``dom.blkio_parameters=``, ``dom.state``, ``dom.open_console``,
|
118
|
+
``dom.screenshot`` and ``dom.inject_nmi``
|
119
|
+
* Implementation of the ``Stream`` class, which covers the libvirt
|
120
|
+
``virStream`` APIs
|
121
|
+
* Add the ability to build against non-system libvirt libraries
|
122
|
+
* Updated ``Error`` object, which now includes the libvirt code, component and
|
123
|
+
level of the error, as well as all of the error constants from ``libvirt.h``
|
124
|
+
* Updated ``Connect`` class, implementing ``conn.sys_info``, ``conn.stream``,
|
125
|
+
``conn.interface_change_begin``, ``conn.interface_change_commit`` and
|
126
|
+
``conn.interface_change_rollback``
|
127
|
+
* Updated ``StorageVol`` class, implementing ``vol.download`` and
|
128
|
+
``vol.upload``
|
129
|
+
* Various bugfixes
|
130
|
+
|
131
|
+
|
132
|
+
0.3.0 (2010-12-12)
|
133
|
+
==================
|
134
|
+
|
135
|
+
* Implementation of ``Libvirt::open_auth``, ``Libvirt::event_register_impl``
|
136
|
+
* Updated ``Connect`` class, implementing ``conn.compare_cpu``,
|
137
|
+
``conn.baseline_cpu``, ``conn.domain_event_register_any``,
|
138
|
+
``conn.domain_event_deregister_any``, ``conn.domain_event_register``,
|
139
|
+
``conn.domain_event_deregister`` and ``conn.create_domain_xml``
|
140
|
+
* Updated ``Domain`` class, implementing ``dom.get_vcpus``,
|
141
|
+
``dom.update_device``, ``dom.scheduler_type``, ``dom.scheduler_parameters``,
|
142
|
+
``dom.scheduler_parameters=``, ``dom.num_vcpus``, ``dom.vcpus_flags=`` and
|
143
|
+
``dom.qemu_monitor_command``
|
144
|
+
* Updated ``Interface`` class, implementing ``interface.free``
|
145
|
+
* Many potential memory leaks have been fixed
|
146
|
+
* Many bugfixes
|
147
|
+
* Documentation update of many methods, including all of the lookup methods
|
148
|
+
that were missing before
|
149
|
+
|
150
|
+
|
151
|
+
0.2.0 (2010-07-01)
|
152
|
+
==================
|
153
|
+
|
154
|
+
* Updated ``Storage`` class, implementing ``pool.active?``,
|
155
|
+
``pool.persistent?`` and ``pool.vol_create_xml_from``
|
156
|
+
* Updated ``Connect`` class, implementing ``conn.node_free_memory``,
|
157
|
+
``conn.node_cells_free_memory``, ``conn.node_get_security_model``,
|
158
|
+
``conn.encrypted?``, ``conn.libversion`` and ``conn.secure?``
|
159
|
+
* Updated ``Network`` class, implementing ``net.active?`` and
|
160
|
+
``net.persistent?``
|
161
|
+
* Update ``Domain`` class, implementing ``conn.domain_xml_from_native``,
|
162
|
+
``conn.domain_xml_to_native``, ``dom.migrate_to_uri``,
|
163
|
+
``dom.migrate_set_max_downtime``, ``dom.managed_save``,
|
164
|
+
``dom.has_managed_save?``, ``dom.managed_save_remove``,
|
165
|
+
``dom.security_label``, ``dom.block_stats``, ``dom.memory_stats``,
|
166
|
+
``dom.blockinfo``, ``dom.block_peek``, ``dom.memory_peek``, ``dom.active?``,
|
167
|
+
``dom.persistent?``, ``dom.snapshot_create_xml``, ``dom.num_of_snapshots``,
|
168
|
+
``dom.list_snapshots``, ``dom.lookup_snapshot_by_name``,
|
169
|
+
``dom.has_current_snapshot?``, ``dom.revert_to_snapshot``,
|
170
|
+
``dom.current_snapshot``, ``snapshot.xml_desc``, ``snapshot.delete``,
|
171
|
+
``dom.job_info`` and ``dom.abort_job``
|
172
|
+
* Implementation of the ``NodeDevice`` class
|
173
|
+
* Implementation of the ``Secret`` class
|
174
|
+
* Implementation of the ``NWFilter`` class
|
175
|
+
* Implementation of the ``Interface`` class
|
176
|
+
* Conversion of the development tree to git
|
177
|
+
* New maintainer (Chris Lalancette). David Lutterkort has agreed to transfer
|
178
|
+
maintainership since he is not actively involved in their development
|
179
|
+
anymore
|
180
|
+
|
181
|
+
|
182
|
+
0.1.0 (2008-11-18)
|
183
|
+
==================
|
184
|
+
|
185
|
+
* Add binding for ``virConnectFindStoragePoolSources`` (Chris Lalancette)
|
186
|
+
* Fix ``dom_migrate`` (Chris Lalancette)
|
187
|
+
* Add the ``MIGRATE_LIVE`` (``enum virDomainMigrateFlags``) flag
|
188
|
+
* Slight improvements of the unit tests
|
189
|
+
|
190
|
+
|
191
|
+
0.0.7 (2008-04-15)
|
192
|
+
==================
|
193
|
+
|
194
|
+
* Binding for ``virDomainMigrate``
|
195
|
+
* Fix crash caused by using ``virResetError``
|
196
|
+
* More sensible message included in exceptions
|
197
|
+
|
198
|
+
|
199
|
+
0.0.6 (2008-04-02)
|
200
|
+
==================
|
201
|
+
|
202
|
+
* Fix test failure exposed by the Fedora builders
|
203
|
+
|
204
|
+
|
205
|
+
0.0.5 (2008-04-02)
|
206
|
+
==================
|
207
|
+
|
208
|
+
* Explicit free methods for various objects (based on a patch by Vadim Zaliva)
|
209
|
+
* Make the FLAGS argument for various calls optional, and default it to 0
|
210
|
+
(Chris Lalancette)
|
211
|
+
* More finegrained exceptions on errors, containing libvirt error message
|
212
|
+
(Mohammed Morsi)
|
213
|
+
|
214
|
+
|
215
|
+
0.0.4 (2008-04-01)
|
216
|
+
==================
|
217
|
+
|
218
|
+
* Bindings for the libvirt storage API (requires libvirt 0.4.1)
|
219
|
+
* Suppress some bindings if the underlying libvirt doesn't support it
|
220
|
+
* Bindings for ``virDomainSetMemory``, ``virDomainPinVcpu`` and
|
221
|
+
``virDomainSetVcpus`` (Vadim Zaliva)
|
222
|
+
|
223
|
+
|
224
|
+
0.0.2 (2007-12-06)
|
225
|
+
==================
|
226
|
+
|
227
|
+
* Add ``virNodeGetInfo`` binding
|
228
|
+
* Convert Ruby API from StudlyCaps to under_score_separation, since that's
|
229
|
+
the Ruby convention
|
230
|
+
|
231
|
+
|
232
|
+
0.0.1 (2007-11-19)
|
233
|
+
==================
|
234
|
+
|
235
|
+
* Initial release
|
data/README.rst
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
============
|
2
|
+
ruby-libvirt
|
3
|
+
============
|
4
|
+
|
5
|
+
Ruby bindings for `libvirt <https://libvirt.org/>`__.
|
6
|
+
|
7
|
+
|
8
|
+
Usage
|
9
|
+
=====
|
10
|
+
|
11
|
+
Add ``require 'libvirt'`` to your program, then call
|
12
|
+
``Libvirt::open`` or ``Libvirt::open_read_only`` to obtain a
|
13
|
+
connection.
|
14
|
+
|
15
|
+
See ``examples/*.rb`` and ``tests/*.rb`` for more examples.
|
16
|
+
|
17
|
+
|
18
|
+
Hacking
|
19
|
+
=======
|
20
|
+
|
21
|
+
On a Fedora machine, run
|
22
|
+
|
23
|
+
::
|
24
|
+
|
25
|
+
$ yum install libvirt-devel ruby-devel rubygem-rake
|
26
|
+
|
27
|
+
followed by
|
28
|
+
|
29
|
+
::
|
30
|
+
|
31
|
+
$ rake build
|
32
|
+
|
33
|
+
To run code against the bindings without having to install them
|
34
|
+
first, ``$RUBYLIB`` needs to be set appropriately. For example:
|
35
|
+
|
36
|
+
::
|
37
|
+
|
38
|
+
$ export RUBYLIB="lib:ext/libvirt"
|
39
|
+
$ ruby -rlibvirt -e 'puts Libvirt::version[0]'
|
40
|
+
|
41
|
+
|
42
|
+
Contributing
|
43
|
+
============
|
44
|
+
|
45
|
+
See `CONTRIBUTING.rst <CONTRIBUTING.rst>`__.
|
data/Rakefile
CHANGED
@@ -11,75 +11,96 @@
|
|
11
11
|
|
12
12
|
# Rakefile for ruby-rpm -*- ruby -*-
|
13
13
|
require 'rake/clean'
|
14
|
-
begin
|
15
|
-
require 'rdoc/task'
|
16
|
-
rescue LoadError
|
17
|
-
require 'rake/rdoctask'
|
18
|
-
end
|
19
14
|
require 'rake/testtask'
|
15
|
+
require 'rdoc/task'
|
20
16
|
require 'rubygems/package_task'
|
21
|
-
require 'rbconfig'
|
22
17
|
|
23
18
|
PKG_NAME='ruby-libvirt'
|
24
|
-
PKG_VERSION='0.8.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
19
|
+
PKG_VERSION='0.8.4'
|
20
|
+
|
21
|
+
EXT_DIR = "ext/libvirt"
|
22
|
+
EXTCONF = "#{EXT_DIR}/extconf.rb"
|
23
|
+
MAKEFILE = "#{EXT_DIR}/Makefile"
|
24
|
+
LIBVIRT_MODULE = "#{EXT_DIR}/_libvirt.so"
|
25
|
+
SPEC_FILE = "#{PKG_NAME}.spec"
|
26
|
+
SRC_FILES = FileList[
|
27
|
+
"#{EXT_DIR}/_libvirt.c",
|
28
|
+
"#{EXT_DIR}/common.c",
|
29
|
+
"#{EXT_DIR}/common.h",
|
30
|
+
"#{EXT_DIR}/connect.c",
|
31
|
+
"#{EXT_DIR}/connect.h",
|
32
|
+
"#{EXT_DIR}/domain.c",
|
33
|
+
"#{EXT_DIR}/domain.h",
|
34
|
+
"#{EXT_DIR}/interface.c",
|
35
|
+
"#{EXT_DIR}/interface.h",
|
36
|
+
"#{EXT_DIR}/network.c",
|
37
|
+
"#{EXT_DIR}/network.h",
|
38
|
+
"#{EXT_DIR}/nodedevice.c",
|
39
|
+
"#{EXT_DIR}/nodedevice.h",
|
40
|
+
"#{EXT_DIR}/nwfilter.c",
|
41
|
+
"#{EXT_DIR}/nwfilter.h",
|
42
|
+
"#{EXT_DIR}/secret.c",
|
43
|
+
"#{EXT_DIR}/secret.h",
|
44
|
+
"#{EXT_DIR}/storage.c",
|
45
|
+
"#{EXT_DIR}/storage.h",
|
46
|
+
"#{EXT_DIR}/stream.c",
|
47
|
+
"#{EXT_DIR}/stream.h",
|
48
|
+
]
|
49
|
+
LIB_FILES = FileList[
|
50
|
+
"lib/libvirt.rb",
|
51
|
+
]
|
52
|
+
GEN_FILES = FileList[
|
53
|
+
MAKEFILE,
|
54
|
+
"#{EXT_DIR}/extconf.h",
|
55
|
+
]
|
32
56
|
|
33
57
|
#
|
34
58
|
# Additional files for clean/clobber
|
35
59
|
#
|
36
60
|
|
37
|
-
CLEAN.include [ "
|
38
|
-
|
39
|
-
|
40
|
-
CLOBBER.include [ "ext/**/mkmf.log", "ext/**/extconf.h", MAKEFILE ]
|
41
|
-
|
42
|
-
task :default => :build
|
61
|
+
CLEAN.include [ "#{EXT_DIR}/*.o", LIBVIRT_MODULE ]
|
62
|
+
CLOBBER.include [ "#{EXT_DIR}/mkmf.log" ] + GEN_FILES
|
43
63
|
|
44
64
|
#
|
45
65
|
# Build locally
|
46
66
|
#
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
extra += " " + args[0].chomp unless args.empty?
|
54
|
-
|
55
|
-
unless sh "ruby #{File::basename(EXT_CONF)} #{extra}"
|
56
|
-
$stderr.puts "Failed to run extconf"
|
57
|
-
break
|
58
|
-
end
|
67
|
+
|
68
|
+
task :default => :build
|
69
|
+
|
70
|
+
file MAKEFILE => EXTCONF do |t|
|
71
|
+
Dir::chdir(File::dirname(EXTCONF)) do
|
72
|
+
sh "ruby #{File::basename(EXTCONF)}"
|
59
73
|
end
|
60
74
|
end
|
61
|
-
file LIBVIRT_MODULE =>
|
62
|
-
Dir::chdir(File::dirname(
|
63
|
-
|
64
|
-
|
65
|
-
break
|
66
|
-
end
|
67
|
-
end
|
75
|
+
file LIBVIRT_MODULE => SRC_FILES + [ MAKEFILE ] do |t|
|
76
|
+
Dir::chdir(File::dirname(EXTCONF)) do
|
77
|
+
sh "make"
|
78
|
+
end
|
68
79
|
end
|
69
80
|
desc "Build the native library"
|
70
81
|
task :build => LIBVIRT_MODULE
|
71
82
|
|
72
83
|
#
|
73
|
-
# Test
|
84
|
+
# Test tasks
|
74
85
|
#
|
75
86
|
|
87
|
+
TEST_FILES = FileList[
|
88
|
+
"tests/test_conn.rb",
|
89
|
+
"tests/test_domain.rb",
|
90
|
+
"tests/test_interface.rb",
|
91
|
+
"tests/test_network.rb",
|
92
|
+
"tests/test_nodedevice.rb",
|
93
|
+
"tests/test_nwfilter.rb",
|
94
|
+
"tests/test_open.rb",
|
95
|
+
"tests/test_secret.rb",
|
96
|
+
"tests/test_storage.rb",
|
97
|
+
"tests/test_stream.rb",
|
98
|
+
"tests/test_utils.rb",
|
99
|
+
]
|
100
|
+
|
76
101
|
Rake::TestTask.new(:test) do |t|
|
77
|
-
t.test_files =
|
78
|
-
|
79
|
-
'tests/test_nodedevice.rb', 'tests/test_nwfilter.rb',
|
80
|
-
'tests/test_open.rb', 'tests/test_secret.rb',
|
81
|
-
'tests/test_storage.rb', 'tests/test_stream.rb' ]
|
82
|
-
t.libs = [ 'lib', 'ext/libvirt' ]
|
102
|
+
t.test_files = TEST_FILES
|
103
|
+
t.libs << EXT_DIR
|
83
104
|
end
|
84
105
|
task :test => :build
|
85
106
|
|
@@ -87,65 +108,55 @@ task :test => :build
|
|
87
108
|
# Documentation tasks
|
88
109
|
#
|
89
110
|
|
90
|
-
|
91
|
-
|
92
|
-
"ext/libvirt/domain.c", "ext/libvirt/interface.c",
|
93
|
-
"ext/libvirt/network.c", "ext/libvirt/nodedevice.c",
|
94
|
-
"ext/libvirt/nwfilter.c", "ext/libvirt/secret.c",
|
95
|
-
"ext/libvirt/storage.c", "ext/libvirt/stream.c" ]
|
111
|
+
RDOC_MAIN = "doc/main.rdoc"
|
112
|
+
RDOC_FILES = FileList[ RDOC_MAIN ] + SRC_FILES + LIB_FILES
|
96
113
|
|
97
|
-
|
98
|
-
rd.main =
|
114
|
+
RDoc::Task.new do |rd|
|
115
|
+
rd.main = RDOC_MAIN
|
99
116
|
rd.rdoc_dir = "doc/site/api"
|
100
117
|
rd.rdoc_files.include(RDOC_FILES)
|
101
118
|
end
|
102
119
|
|
103
|
-
|
104
|
-
rd.main =
|
120
|
+
RDoc::Task.new(:ri) do |rd|
|
121
|
+
rd.main = RDOC_MAIN
|
105
122
|
rd.rdoc_dir = "doc/ri"
|
106
123
|
rd.options << "--ri-system"
|
107
124
|
rd.rdoc_files.include(RDOC_FILES)
|
108
125
|
end
|
109
126
|
|
110
|
-
#
|
111
|
-
# Splint task
|
112
|
-
#
|
113
|
-
|
114
|
-
task :splint => [ MAKEFILE ] do |t|
|
115
|
-
Dir::chdir(File::dirname(EXT_CONF)) do
|
116
|
-
unless sh "splint -I" + Config::CONFIG['vendorarchdir'] + " *.c"
|
117
|
-
$stderr.puts "Failed to run splint"
|
118
|
-
break
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
127
|
#
|
124
128
|
# Package tasks
|
125
129
|
#
|
126
130
|
|
127
|
-
PKG_FILES = FileList[
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
PKG_FILES = FileList[
|
132
|
+
"Rakefile",
|
133
|
+
"COPYING",
|
134
|
+
"README.rst",
|
135
|
+
"NEWS.rst",
|
136
|
+
EXTCONF,
|
137
|
+
RDOC_MAIN,
|
138
|
+
] + SRC_FILES + LIB_FILES + TEST_FILES
|
135
139
|
|
136
140
|
SPEC = Gem::Specification.new do |s|
|
137
141
|
s.name = PKG_NAME
|
138
142
|
s.version = PKG_VERSION
|
139
|
-
s.email = "libvir-list@redhat.com"
|
140
|
-
s.homepage = "https://ruby.libvirt.org/"
|
141
|
-
s.summary = "Ruby bindings for LIBVIRT"
|
142
143
|
s.files = PKG_FILES
|
143
|
-
s.
|
144
|
-
s.
|
145
|
-
s.
|
146
|
-
s.
|
147
|
-
|
144
|
+
s.extensions = EXTCONF
|
145
|
+
s.required_ruby_version = ">= 1.8.1"
|
146
|
+
s.summary = "Ruby bindings for libvirt"
|
147
|
+
s.description = <<~EOF
|
148
|
+
ruby-libvirt allows applications written in Ruby to use the
|
149
|
+
libvirt API.
|
150
|
+
EOF
|
151
|
+
s.authors = ["David Lutterkort", "Chris Lalancette"]
|
148
152
|
s.license = "LGPL-2.1-or-later"
|
153
|
+
s.email = "devel@lists.libvirt.org"
|
154
|
+
s.homepage = "https://ruby.libvirt.org/"
|
155
|
+
s.metadata = {
|
156
|
+
"source_code_uri" => "https://gitlab.com/libvirt/libvirt-ruby",
|
157
|
+
"bug_tracker_uri" => "https://gitlab.com/libvirt/libvirt-ruby/-/issues",
|
158
|
+
"documentation_uri" => "https://ruby.libvirt.org/api/index.html",
|
159
|
+
}
|
149
160
|
end
|
150
161
|
|
151
162
|
Gem::PackageTask.new(SPEC) do |pkg|
|
@@ -155,12 +166,22 @@ end
|
|
155
166
|
|
156
167
|
desc "Build (S)RPM for #{PKG_NAME}"
|
157
168
|
task :rpm => [ :package ] do |t|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
169
|
+
pkg_dir = File::expand_path("pkg")
|
170
|
+
sed = [
|
171
|
+
"sed",
|
172
|
+
"-e", "'s/@VERSION@/#{PKG_VERSION}/'",
|
173
|
+
"#{SPEC_FILE}.in", ">#{pkg_dir}/#{SPEC_FILE}",
|
174
|
+
]
|
175
|
+
sh sed.join(" ")
|
176
|
+
rpmbuild = [
|
177
|
+
"rpmbuild",
|
178
|
+
"--clean",
|
179
|
+
"--define", "'_topdir #{pkg_dir}'",
|
180
|
+
"--define", "'_sourcedir #{pkg_dir}'",
|
181
|
+
"--define", "'_srcrpmdir #{pkg_dir}'",
|
182
|
+
"--define", "'_rpmdir #{pkg_dir}'",
|
183
|
+
"--define", "'_builddir #{pkg_dir}'",
|
184
|
+
"-ba", "#{pkg_dir}/#{SPEC_FILE}",
|
185
|
+
]
|
186
|
+
sh rpmbuild.join(" ")
|
166
187
|
end
|
data/ext/libvirt/common.c
CHANGED
@@ -491,3 +491,14 @@ int ruby_libvirt_get_maxcpus(virConnectPtr conn)
|
|
491
491
|
|
492
492
|
return maxcpu;
|
493
493
|
}
|
494
|
+
|
495
|
+
/* For classes where Ruby objects are just wrappers around C pointers,
|
496
|
+
* the only acceptable way to create new instances is to use
|
497
|
+
* Connect.create_domain_xml and similar. The use of Domain.new and
|
498
|
+
* friends is explicitly disallowed by providing this functions as
|
499
|
+
* implementation when defining the class
|
500
|
+
*/
|
501
|
+
VALUE ruby_libvirt_new_not_allowed(int argc, VALUE *argv, VALUE obj)
|
502
|
+
{
|
503
|
+
rb_raise(rb_eTypeError, "Not allowed for this class");
|
504
|
+
}
|
data/ext/libvirt/common.h
CHANGED
@@ -268,6 +268,8 @@ struct ruby_libvirt_str_new2_and_ary_store_arg {
|
|
268
268
|
};
|
269
269
|
VALUE ruby_libvirt_str_new2_and_ary_store_wrap(VALUE arg);
|
270
270
|
|
271
|
+
VALUE ruby_libvirt_new_not_allowed(int argc, VALUE *argv, VALUE obj);
|
272
|
+
|
271
273
|
#ifndef RARRAY_LEN
|
272
274
|
#define RARRAY_LEN(ar) (RARRAY(ar)->len)
|
273
275
|
#endif
|
data/ext/libvirt/connect.c
CHANGED
@@ -2741,6 +2741,9 @@ static VALUE libvirt_connect_node_free_pages(int argc, VALUE *argv, VALUE c)
|
|
2741
2741
|
void ruby_libvirt_connect_init(void)
|
2742
2742
|
{
|
2743
2743
|
c_connect = rb_define_class_under(m_libvirt, "Connect", rb_cObject);
|
2744
|
+
rb_undef_alloc_func(c_connect);
|
2745
|
+
rb_define_singleton_method(c_connect, "new",
|
2746
|
+
ruby_libvirt_new_not_allowed, -1);
|
2744
2747
|
|
2745
2748
|
/*
|
2746
2749
|
* Class Libvirt::Connect::Nodeinfo
|
data/ext/libvirt/domain.c
CHANGED
@@ -4063,6 +4063,9 @@ static VALUE libvirt_domain_user_password_equal(VALUE d, VALUE in)
|
|
4063
4063
|
void ruby_libvirt_domain_init(void)
|
4064
4064
|
{
|
4065
4065
|
c_domain = rb_define_class_under(m_libvirt, "Domain", rb_cObject);
|
4066
|
+
rb_undef_alloc_func(c_domain);
|
4067
|
+
rb_define_singleton_method(c_domain, "new",
|
4068
|
+
ruby_libvirt_new_not_allowed, -1);
|
4066
4069
|
|
4067
4070
|
rb_define_const(c_domain, "NOSTATE", INT2NUM(VIR_DOMAIN_NOSTATE));
|
4068
4071
|
rb_define_const(c_domain, "RUNNING", INT2NUM(VIR_DOMAIN_RUNNING));
|
@@ -4388,6 +4391,10 @@ void ruby_libvirt_domain_init(void)
|
|
4388
4391
|
* Class Libvirt::Domain::Snapshot
|
4389
4392
|
*/
|
4390
4393
|
c_domain_snapshot = rb_define_class_under(c_domain, "Snapshot", rb_cObject);
|
4394
|
+
rb_undef_alloc_func(c_domain_snapshot);
|
4395
|
+
rb_define_singleton_method(c_domain_snapshot, "new",
|
4396
|
+
ruby_libvirt_new_not_allowed, -1);
|
4397
|
+
|
4391
4398
|
rb_define_const(c_domain_snapshot, "DELETE_CHILDREN",
|
4392
4399
|
INT2NUM(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN));
|
4393
4400
|
rb_define_method(c_domain_snapshot, "xml_desc",
|
data/ext/libvirt/extconf.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
4
|
-
RbConfig::MAKEFILE_CONFIG['CCDLFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
|
5
|
-
RbConfig::MAKEFILE_CONFIG['EXTDLDFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
|
6
|
-
|
7
3
|
extension_name = '_libvirt'
|
8
4
|
|
9
5
|
unless pkg_config("libvirt")
|
data/ext/libvirt/interface.c
CHANGED
@@ -174,6 +174,10 @@ static VALUE libvirt_interface_free(VALUE i)
|
|
174
174
|
void ruby_libvirt_interface_init(void)
|
175
175
|
{
|
176
176
|
c_interface = rb_define_class_under(m_libvirt, "Interface", rb_cObject);
|
177
|
+
rb_undef_alloc_func(c_interface);
|
178
|
+
rb_define_singleton_method(c_interface, "new",
|
179
|
+
ruby_libvirt_new_not_allowed, -1);
|
180
|
+
|
177
181
|
rb_define_const(c_interface, "XML_INACTIVE",
|
178
182
|
INT2NUM(VIR_INTERFACE_XML_INACTIVE));
|
179
183
|
rb_define_attr(c_interface, "connection", 1, 0);
|
data/ext/libvirt/network.c
CHANGED
@@ -329,6 +329,10 @@ static VALUE libvirt_network_get_dhcp_leases(int argc, VALUE *argv, VALUE n)
|
|
329
329
|
void ruby_libvirt_network_init(void)
|
330
330
|
{
|
331
331
|
c_network = rb_define_class_under(m_libvirt, "Network", rb_cObject);
|
332
|
+
rb_undef_alloc_func(c_network);
|
333
|
+
rb_define_singleton_method(c_network, "new",
|
334
|
+
ruby_libvirt_new_not_allowed, -1);
|
335
|
+
|
332
336
|
rb_define_attr(c_network, "connection", 1, 0);
|
333
337
|
|
334
338
|
rb_define_method(c_network, "undefine", libvirt_network_undefine, 0);
|
data/ext/libvirt/nodedevice.c
CHANGED
@@ -260,6 +260,9 @@ static VALUE libvirt_nodedevice_lookup_scsi_host_by_wwn(int argc, VALUE *argv,
|
|
260
260
|
void ruby_libvirt_nodedevice_init(void)
|
261
261
|
{
|
262
262
|
c_nodedevice = rb_define_class_under(m_libvirt, "NodeDevice", rb_cObject);
|
263
|
+
rb_undef_alloc_func(c_nodedevice);
|
264
|
+
rb_define_singleton_method(c_nodedevice, "new",
|
265
|
+
ruby_libvirt_new_not_allowed, -1);
|
263
266
|
|
264
267
|
rb_define_attr(c_nodedevice, "connection", 1, 0);
|
265
268
|
|
data/ext/libvirt/nwfilter.c
CHANGED
@@ -123,6 +123,10 @@ static VALUE libvirt_nwfilter_free(VALUE n)
|
|
123
123
|
void ruby_libvirt_nwfilter_init(void)
|
124
124
|
{
|
125
125
|
c_nwfilter = rb_define_class_under(m_libvirt, "NWFilter", rb_cObject);
|
126
|
+
rb_undef_alloc_func(c_nwfilter);
|
127
|
+
rb_define_singleton_method(c_nwfilter, "new",
|
128
|
+
ruby_libvirt_new_not_allowed, -1);
|
129
|
+
|
126
130
|
rb_define_attr(c_nwfilter, "connection", 1, 0);
|
127
131
|
|
128
132
|
/* NWFilter object methods */
|