libvirt_ffi 0.4.0 → 0.5.3

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +78 -0
  3. data/Gemfile +7 -3
  4. data/Rakefile +6 -1
  5. data/bin/console +1 -0
  6. data/exe/libvirt +1 -0
  7. data/lib/libvirt.rb +12 -12
  8. data/lib/libvirt/base_info.rb +34 -0
  9. data/lib/libvirt/connection.rb +111 -38
  10. data/lib/libvirt/domain.rb +113 -8
  11. data/lib/libvirt/domain_callback_storage.rb +20 -16
  12. data/lib/libvirt/errors.rb +65 -0
  13. data/lib/libvirt/event.rb +36 -28
  14. data/lib/libvirt/ffi.rb +17 -0
  15. data/lib/libvirt/ffi/common.rb +8 -1
  16. data/lib/libvirt/ffi/domain.rb +530 -196
  17. data/lib/libvirt/ffi/error.rb +243 -0
  18. data/lib/libvirt/ffi/event.rb +30 -36
  19. data/lib/libvirt/ffi/helpers.rb +17 -0
  20. data/lib/libvirt/ffi/host.rb +127 -0
  21. data/lib/libvirt/ffi/storage.rb +149 -0
  22. data/lib/libvirt/ffi/stream.rb +19 -17
  23. data/lib/libvirt/node_info.rb +2 -41
  24. data/lib/libvirt/storage_pool.rb +70 -0
  25. data/lib/libvirt/storage_pool_info.rb +7 -0
  26. data/lib/libvirt/storage_volume.rb +51 -0
  27. data/lib/libvirt/storage_volume_info.rb +7 -0
  28. data/lib/libvirt/stream.rb +33 -14
  29. data/lib/libvirt/util.rb +61 -8
  30. data/lib/libvirt/version.rb +1 -1
  31. data/lib/libvirt/xml.rb +23 -0
  32. data/lib/libvirt/xml/disk.rb +59 -0
  33. data/lib/libvirt/xml/domain.rb +76 -0
  34. data/lib/libvirt/xml/generic.rb +252 -0
  35. data/lib/libvirt/xml/graphics.rb +14 -0
  36. data/lib/libvirt/xml/max_vcpu.rb +12 -0
  37. data/lib/libvirt/xml/memory.rb +14 -0
  38. data/lib/libvirt/xml/storage_pool.rb +24 -0
  39. data/lib/libvirt/xml/storage_volume.rb +32 -0
  40. data/lib/libvirt/xml/vcpu.rb +12 -0
  41. data/lib/libvirt_ffi.rb +2 -0
  42. data/libvirt.gemspec +5 -1
  43. data/test_usage/support/libvirt_async.rb +27 -35
  44. data/test_usage/support/log_formatter.rb +5 -10
  45. data/test_usage/test_domain.rb +43 -0
  46. data/test_usage/test_event_loop.rb +115 -39
  47. data/test_usage/test_libvirtd_restart.rb +63 -0
  48. data/test_usage/test_metadata.rb +104 -0
  49. data/test_usage/test_screenshot.rb +14 -13
  50. data/test_usage/test_storage.rb +52 -0
  51. metadata +42 -6
  52. data/lib/libvirt/error.rb +0 -6
  53. data/lib/libvirt/ffi/connection.rb +0 -94
  54. data/lib/libvirt/ffi/libvirt.rb +0 -17
  55. data/lib/libvirt/ffi/node_info.rb +0 -37
@@ -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