libvirt_ffi 0.4.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +78 -0
- data/Gemfile +7 -3
- data/Rakefile +6 -1
- data/bin/console +1 -0
- data/exe/libvirt +1 -0
- data/lib/libvirt.rb +12 -12
- data/lib/libvirt/base_info.rb +34 -0
- data/lib/libvirt/connection.rb +111 -38
- data/lib/libvirt/domain.rb +113 -8
- data/lib/libvirt/domain_callback_storage.rb +20 -16
- data/lib/libvirt/errors.rb +65 -0
- data/lib/libvirt/event.rb +36 -28
- data/lib/libvirt/ffi.rb +17 -0
- data/lib/libvirt/ffi/common.rb +8 -1
- data/lib/libvirt/ffi/domain.rb +530 -196
- data/lib/libvirt/ffi/error.rb +243 -0
- data/lib/libvirt/ffi/event.rb +30 -36
- data/lib/libvirt/ffi/helpers.rb +17 -0
- data/lib/libvirt/ffi/host.rb +127 -0
- data/lib/libvirt/ffi/storage.rb +149 -0
- data/lib/libvirt/ffi/stream.rb +19 -17
- data/lib/libvirt/node_info.rb +2 -41
- data/lib/libvirt/storage_pool.rb +70 -0
- data/lib/libvirt/storage_pool_info.rb +7 -0
- data/lib/libvirt/storage_volume.rb +51 -0
- data/lib/libvirt/storage_volume_info.rb +7 -0
- data/lib/libvirt/stream.rb +33 -14
- data/lib/libvirt/util.rb +61 -8
- data/lib/libvirt/version.rb +1 -1
- data/lib/libvirt/xml.rb +23 -0
- data/lib/libvirt/xml/disk.rb +59 -0
- data/lib/libvirt/xml/domain.rb +76 -0
- data/lib/libvirt/xml/generic.rb +252 -0
- data/lib/libvirt/xml/graphics.rb +14 -0
- data/lib/libvirt/xml/max_vcpu.rb +12 -0
- data/lib/libvirt/xml/memory.rb +14 -0
- data/lib/libvirt/xml/storage_pool.rb +24 -0
- data/lib/libvirt/xml/storage_volume.rb +32 -0
- data/lib/libvirt/xml/vcpu.rb +12 -0
- data/lib/libvirt_ffi.rb +2 -0
- data/libvirt.gemspec +5 -1
- data/test_usage/support/libvirt_async.rb +27 -35
- data/test_usage/support/log_formatter.rb +5 -10
- data/test_usage/test_domain.rb +43 -0
- data/test_usage/test_event_loop.rb +115 -39
- data/test_usage/test_libvirtd_restart.rb +63 -0
- data/test_usage/test_metadata.rb +104 -0
- data/test_usage/test_screenshot.rb +14 -13
- data/test_usage/test_storage.rb +52 -0
- metadata +42 -6
- data/lib/libvirt/error.rb +0 -6
- data/lib/libvirt/ffi/connection.rb +0 -94
- data/lib/libvirt/ffi/libvirt.rb +0 -17
- data/lib/libvirt/ffi/node_info.rb +0 -37
data/lib/libvirt/ffi/libvirt.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Libvirt
|
4
|
-
module FFI
|
5
|
-
module Libvirt
|
6
|
-
extend ::FFI::Library
|
7
|
-
ffi_lib Util.library_path
|
8
|
-
|
9
|
-
# int virGetVersion (
|
10
|
-
# unsigned long *libVer,
|
11
|
-
# const char *type,
|
12
|
-
# unsigned long *typeVer
|
13
|
-
# )
|
14
|
-
attach_function :virGetVersion, [:pointer, :string, :pointer], :int
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Libvirt
|
4
|
-
module FFI
|
5
|
-
module NodeInfo
|
6
|
-
extend ::FFI::Library
|
7
|
-
ffi_lib Util.library_path
|
8
|
-
|
9
|
-
# struct virNodeInfo {
|
10
|
-
#
|
11
|
-
# char model[32] model - string indicating the CPU model
|
12
|
-
# unsigned long memory - memory size in kilobytes
|
13
|
-
# unsigned int cpus - the number of active CPUs
|
14
|
-
# unsigned int mhz - expected CPU frequency, 0 if not known or on unusual architectures
|
15
|
-
# unsigned int nodes - the number of NUMA cell, 1 for unusual NUMA topologies or uniform memory access;
|
16
|
-
# check capabilities XML for the actual NUMA topology
|
17
|
-
# unsigned int sockets - number of CPU sockets per node if nodes > 1, 1 in case of unusual NUMA topology
|
18
|
-
# unsigned int cores - number of cores per socket, total number of processors in case of unusual NUMA topolog
|
19
|
-
# unsigned int threads - number of threads per core, 1 in case of unusual numa topology
|
20
|
-
# }
|
21
|
-
class Struct < ::FFI::Struct
|
22
|
-
layout :model, [:char, 32],
|
23
|
-
:memory, :ulong,
|
24
|
-
:cpus, :uint,
|
25
|
-
:mhz, :uint,
|
26
|
-
:nodes, :uint,
|
27
|
-
:sockets, :uint,
|
28
|
-
:cores, :uint,
|
29
|
-
:threads, :uint
|
30
|
-
end
|
31
|
-
|
32
|
-
# int virNodeGetInfo (virConnectPtr conn,
|
33
|
-
# virNodeInfoPtr info)
|
34
|
-
attach_function :virNodeGetInfo, [:pointer, :pointer], :int
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|