rbovirt 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ovirt/interface.rb +9 -1
- data/lib/ovirt/version.rb +1 -1
- data/lib/rbovirt.rb +1 -1
- data/spec/endpoint.yml.example +1 -0
- data/spec/integration/vm_crud_spec.rb +1 -1
- data/spec/lib/endpoint.rb +11 -4
- data/spec/unit/vm_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf4809e79266592a914373c43ca2c7320f9c30c
|
4
|
+
data.tar.gz: f512616ec7f997cc16e4eb9a5ea88ade0f55dd85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c02b15dde847438cdc88e88fb718afadbd4c8fda3bc68dc40630a25c6ac3732e929afada3c0426b07cf2aeebe8d8a3d06338f6f01378db3a8229e8ba5d77473f
|
7
|
+
data.tar.gz: 417a0b4156d1a9d5c7bfa4cdbe9c7927aa5f0a64afb6572b95ba357811fa524e25ea666c7c57807c08b5ff594bfc6f21c4b588926fe9f669837b7dee7b5ab69d
|
data/lib/ovirt/interface.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module OVIRT
|
2
2
|
|
3
3
|
class Interface < BaseObject
|
4
|
-
attr_reader :name, :mac, :interface, :network, :vm
|
4
|
+
attr_reader :name, :mac, :interface, :network, :vm, :plugged, :linked
|
5
5
|
|
6
6
|
def initialize(client=nil, xml={})
|
7
7
|
if xml.is_a?(Hash)
|
8
8
|
super(client, xml[:id], xml[:href], xml[:name])
|
9
9
|
@network = xml[:network]
|
10
10
|
@persisted = xml[:persisted]
|
11
|
+
@interface = xml[:interface]
|
12
|
+
@plugged = xml[:plugged]
|
13
|
+
@linked = xml[:linked]
|
11
14
|
else
|
12
15
|
super(client, xml[:id], xml[:href], (xml/'name').first.text)
|
13
16
|
parse_xml_attributes!(xml)
|
@@ -24,6 +27,9 @@ module OVIRT
|
|
24
27
|
else
|
25
28
|
network{ name_(opts[:network_name] || 'ovirtmgmt') }
|
26
29
|
end
|
30
|
+
interface_(opts[:interface]) if opts[:interface]
|
31
|
+
plugged_(opts[:plugged]) if opts[:plugged]
|
32
|
+
linked_(opts[:linked]) if opts[:linked]
|
27
33
|
}
|
28
34
|
end
|
29
35
|
Nokogiri::XML(builder.to_xml).root.to_s
|
@@ -37,6 +43,8 @@ module OVIRT
|
|
37
43
|
@mac = (xml/'mac').first[:address] rescue nil #template interfaces doesn't have MAC address.
|
38
44
|
@interface = (xml/'interface').first.text
|
39
45
|
@network = ((xml/'network').first[:id] rescue nil)
|
46
|
+
@plugged = (xml/'plugged').first.text
|
47
|
+
@linked = (xml/'linked').first.text
|
40
48
|
@vm = Link::new(@client, (xml/'vm').first[:id], (xml/'vm').first[:href]) if (xml/'vm') rescue nil
|
41
49
|
@template = Link::new(@client, (xml/'template').first[:id], (xml/'template').first[:href]) rescue nil
|
42
50
|
end
|
data/lib/ovirt/version.rb
CHANGED
data/lib/rbovirt.rb
CHANGED
@@ -172,7 +172,7 @@ module OVIRT
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def handle_fault(f)
|
175
|
-
if f.is_a?(RestClient::BadRequest)
|
175
|
+
if f.is_a?(RestClient::BadRequest) || f.is_a?(RestClient::Conflict)
|
176
176
|
fault = (Nokogiri::XML(f.http_body)/'//fault/detail')
|
177
177
|
fault = fault.text.gsub(/\[|\]/, '') if fault
|
178
178
|
end
|
data/spec/endpoint.yml.example
CHANGED
@@ -8,7 +8,7 @@ shared_examples_for "Basic VM Life cycle" do
|
|
8
8
|
name = 'vm-'+Time.now.to_i.to_s
|
9
9
|
@vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
|
10
10
|
@client.add_volume(@vm.id)
|
11
|
-
@client.add_interface(@vm.id, :network_name =>
|
11
|
+
@client.add_interface(@vm.id, :network_name => network_name)
|
12
12
|
while !@client.vm(@vm.id).ready? do
|
13
13
|
end
|
14
14
|
end
|
data/spec/lib/endpoint.rb
CHANGED
@@ -1,13 +1,20 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
module OVIRT::RSpec::Endpoint
|
2
3
|
|
3
4
|
def endpoint
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
return config['user'], config['password'], config['url'] , config['datacenter']
|
6
|
+
end
|
7
|
+
|
8
|
+
def network_name
|
9
|
+
config['network'] || 'ovirtmgmt'
|
7
10
|
end
|
8
11
|
|
9
12
|
def support_user_level_api
|
10
|
-
|
13
|
+
config['version'] && config['version'] > 3.1
|
14
|
+
end
|
15
|
+
|
16
|
+
def config
|
17
|
+
@config ||= YAML.load(File.read(File.expand_path("../endpoint.yml", File.dirname(__FILE__))))
|
11
18
|
end
|
12
19
|
|
13
20
|
end
|
data/spec/unit/vm_spec.rb
CHANGED
@@ -245,6 +245,8 @@ END_HEREDOC
|
|
245
245
|
interface.name.should eql('nic1')
|
246
246
|
interface.mac.should eql('00:11:22:33:44:55')
|
247
247
|
interface.interface.should eql('virtio')
|
248
|
+
interface.plugged.should eql('true')
|
249
|
+
interface.linked.should eql('true')
|
248
250
|
end
|
249
251
|
|
250
252
|
it "should have one volume" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbovirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amos Benari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|