rbovirt 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rbovirt might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/lib/ovirt/vm.rb +3 -3
- data/lib/rbovirt.rb +14 -0
- data/rbovirt.gemspec +2 -2
- data/spec/integration/vm_crud_spec.rb +9 -13
- metadata +112 -67
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/ovirt/vm.rb
CHANGED
@@ -47,11 +47,11 @@ module OVIRT
|
|
47
47
|
topology( :cores => (opts[:cores] || '1'), :sockets => '1' )
|
48
48
|
}
|
49
49
|
os{
|
50
|
-
boot(:dev=>'network')
|
51
|
-
boot(:dev=>'hd')
|
50
|
+
boot(:dev=> opts[:boot_dev1] || 'network')
|
51
|
+
boot(:dev=> opts[:boot_dev2] || 'hd')
|
52
52
|
}
|
53
53
|
display_{
|
54
|
-
type_('
|
54
|
+
type_(opts[:display] || 'spice')
|
55
55
|
}
|
56
56
|
if(opts[:user_data] && !opts[:user_data].empty?)
|
57
57
|
custom_properties {
|
data/lib/rbovirt.rb
CHANGED
@@ -95,6 +95,12 @@ module OVIRT
|
|
95
95
|
OVIRT::VM::new(self, result_xml.root)
|
96
96
|
end
|
97
97
|
|
98
|
+
def update_vm(opts)
|
99
|
+
opts[:cluster_name] ||= clusters.first.name
|
100
|
+
result_xml = http_put("/vms/%s" % opts[:id], OVIRT::VM.to_xml(opts))
|
101
|
+
OVIRT::VM::new(self, result_xml.root)
|
102
|
+
end
|
103
|
+
|
98
104
|
def add_volume(vm_id, opts={})
|
99
105
|
storage_domain_id = opts[:storage_domain] || storagedomains.first.id
|
100
106
|
result_xml = http_post("/vms/%s/disks" % vm_id, OVIRT::Volume.to_xml(storage_domain_id, opts))
|
@@ -214,6 +220,14 @@ module OVIRT
|
|
214
220
|
end
|
215
221
|
end
|
216
222
|
|
223
|
+
def http_put(suburl, body, headers={})
|
224
|
+
begin
|
225
|
+
Nokogiri::XML(RestClient::Resource.new(@api_entrypoint)[suburl].put(body, http_headers(headers)))
|
226
|
+
rescue
|
227
|
+
handle_fault $!
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
217
231
|
def http_delete(suburl)
|
218
232
|
begin
|
219
233
|
headers = {:accept => 'application/xml'}.merge(auth_header)
|
data/rbovirt.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rbovirt}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Amos Benari"]
|
12
|
-
s.date = %q{2012-02-
|
12
|
+
s.date = %q{2012-02-20}
|
13
13
|
s.description = %q{A Ruby client for oVirt REST API}
|
14
14
|
s.email = %q{abenari@redhat.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -5,7 +5,7 @@ describe "VM Life cycle" do
|
|
5
5
|
before(:all) do
|
6
6
|
user="admin@internal"
|
7
7
|
password="123123"
|
8
|
-
hostname = "
|
8
|
+
hostname = "covirt.sat.lab.tlv.redhat.com"
|
9
9
|
port = "8080"
|
10
10
|
url = "http://#{hostname}:#{port}/api"
|
11
11
|
@blank_template_id = "00000000-0000-0000-0000-000000000000"
|
@@ -16,10 +16,7 @@ describe "VM Life cycle" do
|
|
16
16
|
|
17
17
|
before(:all) do
|
18
18
|
name = 'vm-'+Time.now.to_i.to_s
|
19
|
-
|
20
|
-
params[:name] = name
|
21
|
-
params[:cluster_name] = "test"
|
22
|
-
@vm = @client.create_vm(params)
|
19
|
+
@vm = @client.create_vm(:name => name)
|
23
20
|
@client.add_volume(@vm.id)
|
24
21
|
@client.add_interface(@vm.id)
|
25
22
|
while @client.vm(@vm.id).status !~ /down/i do
|
@@ -54,19 +51,18 @@ describe "VM Life cycle" do
|
|
54
51
|
|
55
52
|
it "test_should_destroy_vm" do
|
56
53
|
name = 'd-'+Time.now.to_i.to_s
|
57
|
-
|
58
|
-
params[:name] = name
|
59
|
-
params[:cluster_name] = "test"
|
60
|
-
vm = @client.create_vm(params)
|
54
|
+
vm = @client.create_vm(:name => name)
|
61
55
|
@client.destroy_vm(vm.id)
|
62
56
|
end
|
63
57
|
|
58
|
+
it "test_should_update_vm" do
|
59
|
+
name = 'u-'+Time.now.to_i.to_s
|
60
|
+
@client.update_vm(:id => @vm.id, :name=> name)
|
61
|
+
end
|
62
|
+
|
64
63
|
it "test_should_create_a_vm" do
|
65
64
|
name = 'c-'+Time.now.to_i.to_s
|
66
|
-
|
67
|
-
params[:name] = name
|
68
|
-
params[:cluster_name] = "test"
|
69
|
-
vm = @client.create_vm(params)
|
65
|
+
vm = @client.create_vm(:name => name)
|
70
66
|
vm.class.to_s.should eql("OVIRT::VM")
|
71
67
|
@client.destroy_vm(vm.id)
|
72
68
|
end
|
metadata
CHANGED
@@ -1,101 +1,136 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbovirt
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Amos Benari
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-02-20 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
15
23
|
name: nokogiri
|
16
|
-
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
25
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
requirement: *id001
|
22
34
|
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
23
36
|
prerelease: false
|
24
|
-
version_requirements: *70167913971680
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
37
|
name: rest-client
|
27
|
-
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
requirement: *id002
|
33
48
|
type: :runtime
|
49
|
+
- !ruby/object:Gem::Dependency
|
34
50
|
prerelease: false
|
35
|
-
version_requirements: *70167913971000
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
51
|
name: shoulda
|
38
|
-
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
requirement: *id003
|
44
62
|
type: :development
|
63
|
+
- !ruby/object:Gem::Dependency
|
45
64
|
prerelease: false
|
46
|
-
version_requirements: *70167913969940
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
65
|
name: bundler
|
49
|
-
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
50
67
|
none: false
|
51
|
-
requirements:
|
68
|
+
requirements:
|
52
69
|
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 23
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 0
|
75
|
+
- 0
|
54
76
|
version: 1.0.0
|
77
|
+
requirement: *id004
|
55
78
|
type: :development
|
79
|
+
- !ruby/object:Gem::Dependency
|
56
80
|
prerelease: false
|
57
|
-
version_requirements: *70167913969440
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
81
|
name: jeweler
|
60
|
-
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
61
83
|
none: false
|
62
|
-
requirements:
|
84
|
+
requirements:
|
63
85
|
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 7
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 6
|
91
|
+
- 4
|
65
92
|
version: 1.6.4
|
93
|
+
requirement: *id005
|
66
94
|
type: :development
|
95
|
+
- !ruby/object:Gem::Dependency
|
67
96
|
prerelease: false
|
68
|
-
version_requirements: *70167913993860
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
97
|
name: rcov
|
71
|
-
|
98
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
72
99
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
requirement: *id006
|
77
108
|
type: :development
|
109
|
+
- !ruby/object:Gem::Dependency
|
78
110
|
prerelease: false
|
79
|
-
version_requirements: *70167913991540
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
111
|
name: rspec-rails
|
82
|
-
|
112
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
|
-
requirements:
|
114
|
+
requirements:
|
85
115
|
- - ~>
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 15
|
118
|
+
segments:
|
119
|
+
- 2
|
120
|
+
- 6
|
121
|
+
version: "2.6"
|
122
|
+
requirement: *id007
|
88
123
|
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: *70167913989260
|
91
124
|
description: A Ruby client for oVirt REST API
|
92
125
|
email: abenari@redhat.com
|
93
126
|
executables: []
|
127
|
+
|
94
128
|
extensions: []
|
95
|
-
|
129
|
+
|
130
|
+
extra_rdoc_files:
|
96
131
|
- LICENSE.txt
|
97
132
|
- README.rdoc
|
98
|
-
files:
|
133
|
+
files:
|
99
134
|
- .document
|
100
135
|
- Gemfile
|
101
136
|
- LICENSE.txt
|
@@ -118,29 +153,39 @@ files:
|
|
118
153
|
- spec/integration/vm_crud_spec.rb
|
119
154
|
- spec/spec_helper.rb
|
120
155
|
- spec/unit/vm_spec.rb
|
156
|
+
has_rdoc: true
|
121
157
|
homepage: http://github.com/abenari/rbovirt
|
122
|
-
licenses:
|
158
|
+
licenses:
|
123
159
|
- MIT
|
124
160
|
post_install_message:
|
125
161
|
rdoc_options: []
|
126
|
-
|
162
|
+
|
163
|
+
require_paths:
|
127
164
|
- lib
|
128
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
166
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
version: "0"
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
175
|
none: false
|
136
|
-
requirements:
|
137
|
-
- -
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 3
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
version: "0"
|
140
183
|
requirements: []
|
184
|
+
|
141
185
|
rubyforge_project:
|
142
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.3.7
|
143
187
|
signing_key:
|
144
188
|
specification_version: 3
|
145
189
|
summary: A Ruby client for oVirt REST API
|
146
190
|
test_files: []
|
191
|
+
|