libvirt_ffi 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'libvirt'
6
- require 'logger'
7
- require 'active_support/all'
8
- require 'async'
9
-
10
- require_relative 'support/libvirt_async'
11
- require_relative 'support/log_formatter'
12
-
13
- require 'libvirt/xml'
14
-
15
- Libvirt.logger = Logger.new(STDOUT, formatter: LogFormatter.new)
16
- Libvirt.logger.level = ENV['DEBUG'] ? :debug : :info
17
-
18
- IMPL = LibvirtAsync::Implementations.new
19
-
20
- Async do
21
- ASYNC_REACTOR = Async::Task.current.reactor
22
-
23
- puts "Lib version #{Libvirt.lib_version}"
24
- puts "Gem version #{Libvirt::VERSION}"
25
-
26
- IMPL.start
27
-
28
- conn = Libvirt::Connection.new('qemu+tcp://localhost:16510/system')
29
- conn.open
30
-
31
- puts "Connection version #{conn.version.inspect}"
32
- puts "Connection lib_version #{conn.lib_version.inspect}"
33
- puts "Connection hostname #{conn.hostname.inspect}"
34
-
35
- pools = conn.list_all_storage_pools
36
- puts "Connection storage pools qty #{pools.size}"
37
-
38
- pools.each.with_index do |pool, i|
39
- puts "Storage pool #{i} info", pool.info.to_h
40
- puts "Storage pool #{i} xml", Libvirt::Xml::StoragePool.load(pool.xml_desc).to_h
41
- end
42
-
43
- pools.each.with_index do |pool, i|
44
- volumes = pool.list_all_volumes
45
- puts "Storage pool #{i} volumes qty #{volumes.size}"
46
-
47
- volumes.each.with_index do |vol, j|
48
- puts "Storage pool #{i} volume #{j} info", vol.info.to_h
49
- puts "Storage pool #{i} volume #{j} xml", Libvirt::Xml::StorageVolume.load(vol.xml_desc).to_h
50
- end
51
- end
52
- end