virt 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/virt.rb +4 -2
- data/lib/virt/connection.rb +27 -5
- data/lib/virt/guest.rb +3 -11
- data/lib/virt/host.rb +15 -24
- data/lib/virt/interface.rb +5 -12
- data/lib/virt/kvm.rb +6 -0
- data/lib/virt/kvm/guest.rb +22 -0
- data/lib/virt/kvm/host.rb +28 -0
- data/lib/virt/kvm/interface.rb +25 -0
- data/lib/virt/kvm/volume.rb +23 -0
- data/lib/virt/util.rb +4 -0
- data/lib/virt/vmware.rb +6 -0
- data/lib/virt/vmware/guest.rb +17 -0
- data/lib/virt/vmware/host.rb +28 -0
- data/lib/virt/vmware/interface.rb +25 -0
- data/lib/virt/vmware/volume.rb +32 -0
- data/lib/virt/volume.rb +22 -20
- data/templates/{guest.xml.erb → kvm/guest.xml.erb} +0 -0
- data/templates/{volume.xml.erb → kvm/volume.xml.erb} +0 -0
- data/templates/vmware/guest.xml.erb +41 -0
- data/templates/vmware/volume.xml.erb +14 -0
- data/test/guest_test.rb +4 -4
- data/test/volume_test.rb +1 -1
- data/virt.gemspec +20 -5
- metadata +48 -22
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/virt.rb
CHANGED
@@ -7,10 +7,12 @@ require 'virt/volume'
|
|
7
7
|
require 'virt/interface'
|
8
8
|
module Virt
|
9
9
|
|
10
|
+
autoload :KVM, "virt/kvm"
|
11
|
+
autoload :VMWare, "virt/vmware"
|
10
12
|
class << self
|
11
13
|
|
12
|
-
def connect uri
|
13
|
-
@connection = Virt::Connection.new uri
|
14
|
+
def connect uri, options = {}
|
15
|
+
@connection = Virt::Connection.new uri, options
|
14
16
|
end
|
15
17
|
|
16
18
|
def connection
|
data/lib/virt/connection.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
require 'libvirt'
|
2
2
|
module Virt
|
3
3
|
class Connection
|
4
|
-
attr_reader :connection
|
4
|
+
attr_reader :connection, :type
|
5
5
|
|
6
|
-
def initialize uri
|
7
|
-
raise("Must provide a
|
8
|
-
|
6
|
+
def initialize uri, options = {}
|
7
|
+
raise("Must provide a host to connect to") unless uri
|
8
|
+
if uri =~ /^(esx|vpx)/
|
9
|
+
raise("Must provide a username and password") unless options[:username] or options[:password]
|
10
|
+
@connection = Libvirt::open_auth(uri, [Libvirt::CRED_AUTHNAME, Libvirt::CRED_PASSPHRASE]) do |cred|
|
11
|
+
# This may only be required for ESXi connections, not sure.
|
12
|
+
@type = "VMWare"
|
13
|
+
case cred['type']
|
14
|
+
when ::Libvirt::CRED_AUTHNAME
|
15
|
+
options[:username]
|
16
|
+
when ::Libvirt::CRED_PASSPHRASE
|
17
|
+
options[:password]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
else
|
21
|
+
@type = "KVM"
|
22
|
+
@connection = Libvirt::open uri
|
23
|
+
end
|
9
24
|
end
|
10
25
|
|
11
26
|
def closed?
|
@@ -25,7 +40,14 @@ module Virt
|
|
25
40
|
end
|
26
41
|
|
27
42
|
def host
|
28
|
-
|
43
|
+
case type
|
44
|
+
when "KVM"
|
45
|
+
KVM::Host.new
|
46
|
+
when "VMWare"
|
47
|
+
VMWare::Host.new
|
48
|
+
else
|
49
|
+
raise "Non supported hypervisor"
|
50
|
+
end
|
29
51
|
end
|
30
52
|
|
31
53
|
end
|
data/lib/virt/guest.rb
CHANGED
@@ -15,8 +15,6 @@ module Virt
|
|
15
15
|
@arch ||= options[:arch] || default_arch
|
16
16
|
|
17
17
|
@template_path = options[:template_path] || default_template_path
|
18
|
-
@volume = Volume.new options
|
19
|
-
@interface ||= Interface.new options
|
20
18
|
end
|
21
19
|
|
22
20
|
def new?
|
@@ -79,10 +77,6 @@ module Virt
|
|
79
77
|
@domain.uuid unless new?
|
80
78
|
end
|
81
79
|
|
82
|
-
def arch= value
|
83
|
-
@arch = value == "i386" ? "i686" : value
|
84
|
-
end
|
85
|
-
|
86
80
|
def to_s
|
87
81
|
name.to_s
|
88
82
|
end
|
@@ -91,7 +85,7 @@ module Virt
|
|
91
85
|
self.name <=> other.name
|
92
86
|
end
|
93
87
|
|
94
|
-
|
88
|
+
protected
|
95
89
|
|
96
90
|
def fetch_guest
|
97
91
|
@domain = @connection.connection.lookup_domain_by_name(name)
|
@@ -108,7 +102,7 @@ module Virt
|
|
108
102
|
@vcpu = document("domain/vcpu")
|
109
103
|
@arch = document("domain/os/type", "arch")
|
110
104
|
@machine = document("domain/os/type", "machine")
|
111
|
-
@boot_device = document("domain/os/boot", "dev")
|
105
|
+
@boot_device = document("domain/os/boot", "dev") rescue nil
|
112
106
|
|
113
107
|
# do we have a NIC?
|
114
108
|
network_type = document("domain/devices/interface", "type") rescue nil
|
@@ -134,8 +128,6 @@ module Virt
|
|
134
128
|
"x86_64"
|
135
129
|
end
|
136
130
|
|
137
|
-
def default_template_path
|
138
|
-
"guest.xml.erb"
|
139
|
-
end
|
131
|
+
def default_template_path; end
|
140
132
|
end
|
141
133
|
end
|
data/lib/virt/host.rb
CHANGED
@@ -26,32 +26,13 @@ module Virt
|
|
26
26
|
find_guest_by_name domain
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
# Available libvirt interfaces, excluding lo
|
31
|
-
def interfaces
|
32
|
-
connection.list_interfaces.delete_if{|i| i == "lo"}.sort
|
33
|
-
rescue => e
|
34
|
-
raise "This function is not supported by the hypervisor: #{e}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def interface iface
|
38
|
-
connection.lookup_interface_by_name(iface)
|
39
|
-
end
|
40
|
-
|
41
|
-
# libvirt internal networks
|
42
|
-
def networks
|
43
|
-
connection.list_networks.map do |network|
|
44
|
-
connection.lookup_network_by_name(network).bridge_name
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
29
|
def storage_pools
|
49
|
-
connection.list_storage_pools.map {|p|
|
30
|
+
connection.list_storage_pools.map {|p| create_pool({:name => p})}
|
50
31
|
end
|
51
32
|
|
52
33
|
# Returns a Virt::Pool object based on the pool name
|
53
34
|
def storage_pool pool
|
54
|
-
|
35
|
+
create_pool({:name => pool.is_a?(Libvirt::StoragePool) ? pool.name : pool })
|
55
36
|
rescue Libvirt::RetrieveError
|
56
37
|
end
|
57
38
|
|
@@ -66,15 +47,25 @@ module Virt
|
|
66
47
|
|
67
48
|
def find_guest_by_name name
|
68
49
|
if connection.lookup_domain_by_name name
|
69
|
-
return
|
50
|
+
return create_guest({:name => name})
|
70
51
|
end
|
71
52
|
end
|
72
53
|
|
73
54
|
def find_guest_by_id id
|
74
|
-
id.
|
75
|
-
return
|
55
|
+
Array(id).map do |did|
|
56
|
+
return create_guest({:name => connection.lookup_domain_by_id(did).name})
|
76
57
|
end
|
77
58
|
end
|
78
59
|
|
60
|
+
protected
|
61
|
+
|
62
|
+
def create_guest opts
|
63
|
+
Virt::Guest.new opts
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_pool opts
|
67
|
+
Virt::Pool.new opts
|
68
|
+
end
|
69
|
+
|
79
70
|
end
|
80
71
|
end
|
data/lib/virt/interface.rb
CHANGED
@@ -15,21 +15,14 @@ module Virt
|
|
15
15
|
mac.nil?
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
protected
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
rescue
|
23
|
-
"br0"
|
24
|
-
end
|
20
|
+
# Abstracted methods
|
21
|
+
def default_device; end
|
25
22
|
|
26
|
-
def default_type
|
27
|
-
"bridge"
|
28
|
-
end
|
23
|
+
def default_type; end
|
29
24
|
|
30
|
-
def default_model
|
31
|
-
"virtio"
|
32
|
-
end
|
25
|
+
def default_model; end
|
33
26
|
|
34
27
|
end
|
35
28
|
end
|
data/lib/virt/kvm.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Virt::KVM
|
2
|
+
class Guest < Virt::Guest
|
3
|
+
|
4
|
+
def initialize options = {}
|
5
|
+
super(options)
|
6
|
+
@volume = Volume.new options
|
7
|
+
@interface ||= Interface.new options
|
8
|
+
end
|
9
|
+
|
10
|
+
def arch= value
|
11
|
+
@arch = value == "i386" ? "i686" : value
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def default_template_path
|
18
|
+
"kvm/guest.xml.erb"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Virt::KVM
|
2
|
+
class Host < Virt::Host
|
3
|
+
|
4
|
+
# Available libvirt interfaces, excluding lo
|
5
|
+
def interfaces
|
6
|
+
connection.list_interfaces.delete_if{|i| i == "lo"}.sort
|
7
|
+
rescue => e
|
8
|
+
raise "This function is not supported by the hypervisor: #{e}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def interface iface
|
12
|
+
connection.lookup_interface_by_name(iface)
|
13
|
+
end
|
14
|
+
|
15
|
+
# libvirt internal networks
|
16
|
+
def networks
|
17
|
+
connection.list_networks.map do |network|
|
18
|
+
connection.lookup_network_by_name(network).bridge_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_guest opts
|
23
|
+
Virt::KVM::Guest.new opts
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Virt::KVM
|
2
|
+
class Interface < Virt::Interface
|
3
|
+
|
4
|
+
protected
|
5
|
+
|
6
|
+
def default_template_path
|
7
|
+
"kvm/guest.xml.erb"
|
8
|
+
end
|
9
|
+
|
10
|
+
def default_device
|
11
|
+
@connection.host.interfaces.first
|
12
|
+
rescue
|
13
|
+
"br0"
|
14
|
+
end
|
15
|
+
|
16
|
+
def default_type
|
17
|
+
"bridge"
|
18
|
+
end
|
19
|
+
|
20
|
+
def default_model
|
21
|
+
"virtio"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Virt::KVM
|
2
|
+
class Volume < Virt::Volume
|
3
|
+
|
4
|
+
def default_type
|
5
|
+
"raw"
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_template_path
|
9
|
+
"kvm/volume.xml.erb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
"#{pool.path}/#{name}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def name= name
|
17
|
+
super name
|
18
|
+
@name += ".img" unless name.match(/.*\.img$/)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/virt/util.rb
CHANGED
data/lib/virt/vmware.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Virt::VMWare
|
2
|
+
class Guest < Virt::Guest
|
3
|
+
|
4
|
+
def initialize options = {}
|
5
|
+
super(options)
|
6
|
+
@volume = Volume.new options
|
7
|
+
@interface ||= Interface.new options
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def default_template_path
|
13
|
+
"vmware/guest.xml.erb"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Virt::VMWare
|
2
|
+
class Host < Virt::Host
|
3
|
+
|
4
|
+
# Available libvirt interfaces, excluding lo
|
5
|
+
def interfaces
|
6
|
+
connection.list_interfaces.delete_if{|i| i == "lo"}.sort
|
7
|
+
rescue => e
|
8
|
+
raise "This function is not supported by the hypervisor: #{e}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def interface iface
|
12
|
+
connection.lookup_interface_by_name(iface)
|
13
|
+
end
|
14
|
+
|
15
|
+
# libvirt internal networks
|
16
|
+
def networks
|
17
|
+
connection.list_networks.map do |network|
|
18
|
+
connection.lookup_network_by_name(network).bridge_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_guest opts
|
23
|
+
Virt::VMWare::Guest.new opts
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Virt::VMWare
|
2
|
+
class Interface < Virt::Interface
|
3
|
+
|
4
|
+
protected
|
5
|
+
|
6
|
+
def default_template_path
|
7
|
+
"vmware/guest.xml.erb"
|
8
|
+
end
|
9
|
+
|
10
|
+
def default_device
|
11
|
+
@connection.host.interfaces.first
|
12
|
+
rescue
|
13
|
+
"VM Network"
|
14
|
+
end
|
15
|
+
|
16
|
+
def default_type
|
17
|
+
"bridge"
|
18
|
+
end
|
19
|
+
|
20
|
+
def default_model
|
21
|
+
"e1000"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Virt::VMWare
|
2
|
+
class Volume < Virt::Volume
|
3
|
+
|
4
|
+
def default_type
|
5
|
+
"raw"
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_template_path
|
9
|
+
"vmware/volume.xml.erb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
"[#{pool.name}] #{self}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def name= name
|
17
|
+
super name
|
18
|
+
@name += ".vmdk" unless name.match(/.*\.vmdk$/)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
"#{title}/#{name}"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def title
|
28
|
+
name.chomp(".vmdk")
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/virt/volume.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
module Virt
|
2
2
|
class Volume
|
3
3
|
include Virt::Util
|
4
|
-
attr_reader :name, :pool, :type, :allocated_size, :size, :template_path, :key
|
4
|
+
attr_reader :name, :pool, :type, :allocated_size, :size, :template_path, :key, :xml_desc
|
5
5
|
|
6
6
|
def initialize options = {}
|
7
7
|
@connection = Virt.connection
|
8
8
|
self.name = options[:name] || raise("Volume requires a name")
|
9
|
-
|
10
|
-
@
|
11
|
-
@template_path = options[:template_path] || default_template_path
|
12
|
-
@size = options[:size] || default_size
|
13
|
-
@pool = options[:pool].nil? ? @connection.host.storage_pools.first : @connection.host.storage_pool(options[:pool])
|
9
|
+
# If our volume already exists, we ignore the provided options and defaults
|
10
|
+
@pool = options[:pool].nil? ? default_pool : @connection.host.storage_pool(options[:pool])
|
14
11
|
fetch_volume
|
12
|
+
@type ||= options[:type] || default_type
|
13
|
+
@allocated_size ||= options[:allocated_size] || default_allocated_size
|
14
|
+
@template_path ||= options[:template_path] || default_template_path
|
15
|
+
@size ||= options[:size] || default_size
|
15
16
|
end
|
16
17
|
|
17
18
|
def new?
|
@@ -33,20 +34,13 @@ module Virt
|
|
33
34
|
new?
|
34
35
|
end
|
35
36
|
|
36
|
-
def path
|
37
|
-
"#{pool.path}/#{name}"
|
38
|
-
end
|
37
|
+
def path; end
|
39
38
|
|
40
|
-
|
39
|
+
protected
|
41
40
|
|
42
41
|
def name= name
|
43
42
|
raise "invalid name" if name.nil?
|
44
43
|
@name = name
|
45
|
-
@name += ".img" unless name.match(/.*\.img$/)
|
46
|
-
end
|
47
|
-
|
48
|
-
def default_type
|
49
|
-
"raw"
|
50
44
|
end
|
51
45
|
|
52
46
|
def default_allocated_size
|
@@ -57,13 +51,21 @@ module Virt
|
|
57
51
|
def default_size
|
58
52
|
8
|
59
53
|
end
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
def fetch_volume
|
55
|
+
return unless @vol = pool.find_volume_by_name(name)
|
56
|
+
@size = to_gb(@vol.info.capacity)
|
57
|
+
@allocated_size = to_gb(@vol.info.allocation)
|
63
58
|
end
|
64
59
|
|
65
|
-
def
|
66
|
-
|
60
|
+
def default_pool
|
61
|
+
# this is an expensive call on hosts with lots of pools
|
62
|
+
@connection.host.storage_pools.first
|
67
63
|
end
|
64
|
+
|
65
|
+
# abstracted methods
|
66
|
+
|
67
|
+
def default_type; end
|
68
|
+
|
69
|
+
def default_template_path; end
|
68
70
|
end
|
69
71
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<domain type='vmware'>
|
2
|
+
<name><%= name %></name>
|
3
|
+
<%- if uuid -%>
|
4
|
+
<uuid><%= uuid %></uuid>
|
5
|
+
<%- end -%>
|
6
|
+
<memory><%= memory %></memory>
|
7
|
+
<currentMemory><%= memory %></currentMemory>
|
8
|
+
<vcpu><%= vcpu %></vcpu>
|
9
|
+
<os>
|
10
|
+
<type arch='<%= arch %>'>hvm</type>
|
11
|
+
<boot dev='network'/>
|
12
|
+
<%- if volume -%>
|
13
|
+
<boot dev='hd'/>
|
14
|
+
<%- end -%>
|
15
|
+
</os>
|
16
|
+
<clock offset='utc'/>
|
17
|
+
<devices>
|
18
|
+
<%- if volume -%>
|
19
|
+
<disk type='file' device='disk'>
|
20
|
+
<source file='<%= volume.path %>'/>
|
21
|
+
<target dev='sda' bus='scsi'/>
|
22
|
+
<address type='drive' controller='0' bus='0' unit='0'/>
|
23
|
+
</disk>
|
24
|
+
<%- end -%>
|
25
|
+
<controller type='scsi' index='0' model='lsilogic'/>
|
26
|
+
<%- if interface -%>
|
27
|
+
<interface type='<%= interface.type %>'>
|
28
|
+
<%- if interface.mac -%>
|
29
|
+
<mac address='<%= interface.mac %>'/>
|
30
|
+
<%- end -%>
|
31
|
+
<source <%= interface.type %>='<%= interface.device %>'/>
|
32
|
+
<model type='<%= interface.model %>'/>
|
33
|
+
</interface>
|
34
|
+
<%- end -%>
|
35
|
+
<graphics type='vnc' port='-1' autoport='yes'>
|
36
|
+
</graphics>
|
37
|
+
<video>
|
38
|
+
<model type='vmvga' vram='32768'/>
|
39
|
+
</video>
|
40
|
+
</devices>
|
41
|
+
</domain>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<volume>
|
2
|
+
<name><%= to_s %></name>
|
3
|
+
<allocation unit="G"><%= allocated_size %></allocation>
|
4
|
+
<capacity unit="G"><%= size %></capacity>
|
5
|
+
<target>
|
6
|
+
<path><%= path %></path>
|
7
|
+
<format type='vmdk'/>
|
8
|
+
<permissions>
|
9
|
+
<mode>00</mode>
|
10
|
+
<owner>0</owner>
|
11
|
+
<group>0</group>
|
12
|
+
</permissions>
|
13
|
+
</target>
|
14
|
+
</volume>
|
data/test/guest_test.rb
CHANGED
@@ -3,10 +3,10 @@ require 'test/test_helper'
|
|
3
3
|
class Virt::GuestTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
|
-
hostname = "
|
6
|
+
hostname = "h02.sat.lab"
|
7
7
|
uri = "qemu+ssh://root@#{hostname}/system"
|
8
8
|
Virt.connect(uri)
|
9
|
-
@guest = Virt::Guest.new({:name => "test-host-#{Time.now.to_i}"})
|
9
|
+
@guest = Virt::KVM::Guest.new({:name => "test-host-#{Time.now.to_i}"})
|
10
10
|
end
|
11
11
|
|
12
12
|
def teardown
|
@@ -40,11 +40,11 @@ class Virt::GuestTest < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_should_be_able_to_save_and_start
|
43
|
-
@guest = Virt::Guest.new({:name => "test-host-#{Time.now.to_i}", :device => "br180"})
|
43
|
+
@guest = Virt::KVM::Guest.new({:name => "test-host-#{Time.now.to_i}", :device => "br180"})
|
44
44
|
assert @guest.volume.save
|
45
45
|
assert @guest.save
|
46
46
|
assert @guest.start
|
47
|
-
assert @guest.
|
47
|
+
assert @guest.poweroff
|
48
48
|
assert @guest.volume.destroy
|
49
49
|
assert @guest.destroy
|
50
50
|
end
|
data/test/volume_test.rb
CHANGED
@@ -6,7 +6,7 @@ class Virt::VolumeTest < Test::Unit::TestCase
|
|
6
6
|
hostname = "h01.sat.lab"
|
7
7
|
uri = "qemu+ssh://root@#{hostname}/system"
|
8
8
|
Virt.connect(uri)
|
9
|
-
@vol = Virt::Volume.new({:name => "mytestvol-#{Time.now}"})
|
9
|
+
@vol = Virt::KVM::Volume.new({:name => "mytestvol-#{Time.now}"})
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_should_be_new
|
data/virt.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "virt"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ohad Levy"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-22"
|
13
13
|
s.description = "Simplied interface to use ruby the libvirt ruby library"
|
14
14
|
s.email = "ohadlevy@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,11 +29,23 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/virt/guest.rb",
|
30
30
|
"lib/virt/host.rb",
|
31
31
|
"lib/virt/interface.rb",
|
32
|
+
"lib/virt/kvm.rb",
|
33
|
+
"lib/virt/kvm/guest.rb",
|
34
|
+
"lib/virt/kvm/host.rb",
|
35
|
+
"lib/virt/kvm/interface.rb",
|
36
|
+
"lib/virt/kvm/volume.rb",
|
32
37
|
"lib/virt/pool.rb",
|
33
38
|
"lib/virt/util.rb",
|
39
|
+
"lib/virt/vmware.rb",
|
40
|
+
"lib/virt/vmware/guest.rb",
|
41
|
+
"lib/virt/vmware/host.rb",
|
42
|
+
"lib/virt/vmware/interface.rb",
|
43
|
+
"lib/virt/vmware/volume.rb",
|
34
44
|
"lib/virt/volume.rb",
|
35
|
-
"templates/guest.xml.erb",
|
36
|
-
"templates/volume.xml.erb",
|
45
|
+
"templates/kvm/guest.xml.erb",
|
46
|
+
"templates/kvm/volume.xml.erb",
|
47
|
+
"templates/vmware/guest.xml.erb",
|
48
|
+
"templates/vmware/volume.xml.erb",
|
37
49
|
"test/connection_test.rb",
|
38
50
|
"test/guest_test.rb",
|
39
51
|
"test/host_test.rb",
|
@@ -46,7 +58,7 @@ Gem::Specification.new do |s|
|
|
46
58
|
s.homepage = "https://github.com/ohadlevy/virt"
|
47
59
|
s.licenses = ["GPLv3"]
|
48
60
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = "1.
|
61
|
+
s.rubygems_version = "1.8.11"
|
50
62
|
s.summary = "Simple to use ruby interface to libvirt"
|
51
63
|
s.test_files = [
|
52
64
|
"test/connection_test.rb",
|
@@ -62,17 +74,20 @@ Gem::Specification.new do |s|
|
|
62
74
|
s.specification_version = 3
|
63
75
|
|
64
76
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
77
|
+
s.add_runtime_dependency(%q<ruby-libvirt>, [">= 0"])
|
65
78
|
s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
|
66
79
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
80
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
68
81
|
s.add_development_dependency(%q<rcov>, [">= 0.9.8"])
|
69
82
|
else
|
83
|
+
s.add_dependency(%q<ruby-libvirt>, [">= 0"])
|
70
84
|
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
71
85
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
72
86
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
73
87
|
s.add_dependency(%q<rcov>, [">= 0.9.8"])
|
74
88
|
end
|
75
89
|
else
|
90
|
+
s.add_dependency(%q<ruby-libvirt>, [">= 0"])
|
76
91
|
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
77
92
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
78
93
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ohad Levy
|
@@ -15,12 +15,24 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: shoulda
|
22
|
-
type: :development
|
23
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
requirement: *id001
|
32
|
+
name: ruby-libvirt
|
33
|
+
prerelease: false
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
24
36
|
none: false
|
25
37
|
requirements:
|
26
38
|
- - ">="
|
@@ -31,12 +43,12 @@ dependencies:
|
|
31
43
|
- 11
|
32
44
|
- 3
|
33
45
|
version: 2.11.3
|
46
|
+
type: :development
|
47
|
+
requirement: *id002
|
48
|
+
name: shoulda
|
34
49
|
prerelease: false
|
35
|
-
requirement: *id001
|
36
50
|
- !ruby/object:Gem::Dependency
|
37
|
-
|
38
|
-
type: :development
|
39
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
52
|
none: false
|
41
53
|
requirements:
|
42
54
|
- - ~>
|
@@ -47,12 +59,12 @@ dependencies:
|
|
47
59
|
- 0
|
48
60
|
- 0
|
49
61
|
version: 1.0.0
|
62
|
+
type: :development
|
63
|
+
requirement: *id003
|
64
|
+
name: bundler
|
50
65
|
prerelease: false
|
51
|
-
requirement: *id002
|
52
66
|
- !ruby/object:Gem::Dependency
|
53
|
-
|
54
|
-
type: :development
|
55
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
56
68
|
none: false
|
57
69
|
requirements:
|
58
70
|
- - ~>
|
@@ -63,12 +75,12 @@ dependencies:
|
|
63
75
|
- 5
|
64
76
|
- 2
|
65
77
|
version: 1.5.2
|
78
|
+
type: :development
|
79
|
+
requirement: *id004
|
80
|
+
name: jeweler
|
66
81
|
prerelease: false
|
67
|
-
requirement: *id003
|
68
82
|
- !ruby/object:Gem::Dependency
|
69
|
-
|
70
|
-
type: :development
|
71
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
83
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
72
84
|
none: false
|
73
85
|
requirements:
|
74
86
|
- - ">="
|
@@ -79,8 +91,10 @@ dependencies:
|
|
79
91
|
- 9
|
80
92
|
- 8
|
81
93
|
version: 0.9.8
|
94
|
+
type: :development
|
95
|
+
requirement: *id005
|
96
|
+
name: rcov
|
82
97
|
prerelease: false
|
83
|
-
requirement: *id004
|
84
98
|
description: Simplied interface to use ruby the libvirt ruby library
|
85
99
|
email: ohadlevy@gmail.com
|
86
100
|
executables: []
|
@@ -103,11 +117,23 @@ files:
|
|
103
117
|
- lib/virt/guest.rb
|
104
118
|
- lib/virt/host.rb
|
105
119
|
- lib/virt/interface.rb
|
120
|
+
- lib/virt/kvm.rb
|
121
|
+
- lib/virt/kvm/guest.rb
|
122
|
+
- lib/virt/kvm/host.rb
|
123
|
+
- lib/virt/kvm/interface.rb
|
124
|
+
- lib/virt/kvm/volume.rb
|
106
125
|
- lib/virt/pool.rb
|
107
126
|
- lib/virt/util.rb
|
127
|
+
- lib/virt/vmware.rb
|
128
|
+
- lib/virt/vmware/guest.rb
|
129
|
+
- lib/virt/vmware/host.rb
|
130
|
+
- lib/virt/vmware/interface.rb
|
131
|
+
- lib/virt/vmware/volume.rb
|
108
132
|
- lib/virt/volume.rb
|
109
|
-
- templates/guest.xml.erb
|
110
|
-
- templates/volume.xml.erb
|
133
|
+
- templates/kvm/guest.xml.erb
|
134
|
+
- templates/kvm/volume.xml.erb
|
135
|
+
- templates/vmware/guest.xml.erb
|
136
|
+
- templates/vmware/volume.xml.erb
|
111
137
|
- test/connection_test.rb
|
112
138
|
- test/guest_test.rb
|
113
139
|
- test/host_test.rb
|
@@ -145,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
171
|
requirements: []
|
146
172
|
|
147
173
|
rubyforge_project:
|
148
|
-
rubygems_version: 1.
|
174
|
+
rubygems_version: 1.8.11
|
149
175
|
signing_key:
|
150
176
|
specification_version: 3
|
151
177
|
summary: Simple to use ruby interface to libvirt
|