ovirt 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/ovirt/api.rb +1 -1
- data/lib/ovirt/{object.rb → base.rb} +3 -3
- data/lib/ovirt/cdrom.rb +1 -1
- data/lib/ovirt/cluster.rb +1 -1
- data/lib/ovirt/data_center.rb +1 -1
- data/lib/ovirt/disk.rb +1 -1
- data/lib/ovirt/domain.rb +1 -1
- data/lib/ovirt/event.rb +1 -1
- data/lib/ovirt/file.rb +1 -1
- data/lib/ovirt/group.rb +1 -1
- data/lib/ovirt/host.rb +1 -1
- data/lib/ovirt/host_nic.rb +1 -1
- data/lib/ovirt/network.rb +1 -1
- data/lib/ovirt/nic.rb +1 -1
- data/lib/ovirt/permission.rb +1 -1
- data/lib/ovirt/permit.rb +1 -1
- data/lib/ovirt/role.rb +1 -1
- data/lib/ovirt/service.rb +1 -1
- data/lib/ovirt/snapshot.rb +1 -1
- data/lib/ovirt/statistic.rb +1 -1
- data/lib/ovirt/storage.rb +1 -1
- data/lib/ovirt/storage_domain.rb +1 -1
- data/lib/ovirt/tag.rb +1 -1
- data/lib/ovirt/template.rb +3 -3
- data/lib/ovirt/user.rb +1 -1
- data/lib/ovirt/version.rb +1 -1
- data/lib/ovirt/vmpool.rb +1 -1
- data/lib/ovirt.rb +1 -1
- data/spec/{object_spec.rb → base_spec.rb} +2 -2
- data/spec/template_spec.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWY4MTRkMzgxNGI4NGZiMDMxYjNjYTE2MTViMTE2ZGNmYzA5ODA5Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODBlZDRkZWVlZDE3ODAyMGU1MDg3MTIzMGQ0NTNiYTMyNDIwMmEyZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjJhYmU3YTQyN2JmOTA3MDAzODQ2OGEyODE5YmQ1OGE4N2UyYzcwMTgzZjkx
|
10
|
+
NmJmNDg5ODMzZTUzYTZlOWI4MDgyMDAxZDM5MGE5YWY2OWM5NjVmMWEwNmM4
|
11
|
+
M2ZlMTc4NzlkMTUzYTBlNmEzY2ViMmQxMTAxNTQ3MGU0YjA5M2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTNmNjkyOTU3MWEwMDNiZDFiNjFlYzZkZWI3ZTgyY2EzOTZjMjkyYTk1YTYx
|
14
|
+
ZTcxMmI1M2NiY2I2OGJjNzQyNzUwMmI5OTFiNWJjZjFlY2Q2MjVmYmEyNDgz
|
15
|
+
MGU0NWRmZDBiNzUyYTdmNWU3MDYwMGJlYTQ1OTFjNWY1ODc5ZmM=
|
data/lib/ovirt/api.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Ovirt
|
2
|
-
class
|
2
|
+
class Base
|
3
3
|
def self.create_from_xml(service, xml)
|
4
4
|
self.new(service, parse_xml(xml))
|
5
5
|
end
|
@@ -173,7 +173,7 @@ module Ovirt
|
|
173
173
|
|
174
174
|
def self.object_to_id(object)
|
175
175
|
case object
|
176
|
-
when Ovirt::
|
176
|
+
when Ovirt::Base
|
177
177
|
object = object[:id]
|
178
178
|
when String
|
179
179
|
raise ArgumentError, "object must be a valid guid" unless object.guid?
|
@@ -252,7 +252,7 @@ module Ovirt
|
|
252
252
|
rel_str = 'storage_domains' if rel_str == 'storagedomains'
|
253
253
|
rel_str = 'data_centers' if rel_str == 'datacenters'
|
254
254
|
singular = rel_str.singularize
|
255
|
-
klass = singular.camelize
|
255
|
+
klass = Ovirt.const_get(singular.camelize)
|
256
256
|
xml = @service.resource_get(@relationships[m])
|
257
257
|
doc = Nokogiri::XML(xml)
|
258
258
|
return doc.root.xpath(singular).collect { |node| klass.create_from_xml(@service, node) }
|
data/lib/ovirt/cdrom.rb
CHANGED
data/lib/ovirt/cluster.rb
CHANGED
data/lib/ovirt/data_center.rb
CHANGED
data/lib/ovirt/disk.rb
CHANGED
data/lib/ovirt/domain.rb
CHANGED
data/lib/ovirt/event.rb
CHANGED
data/lib/ovirt/file.rb
CHANGED
data/lib/ovirt/group.rb
CHANGED
data/lib/ovirt/host.rb
CHANGED
data/lib/ovirt/host_nic.rb
CHANGED
data/lib/ovirt/network.rb
CHANGED
data/lib/ovirt/nic.rb
CHANGED
data/lib/ovirt/permission.rb
CHANGED
data/lib/ovirt/permit.rb
CHANGED
data/lib/ovirt/role.rb
CHANGED
data/lib/ovirt/service.rb
CHANGED
data/lib/ovirt/snapshot.rb
CHANGED
data/lib/ovirt/statistic.rb
CHANGED
data/lib/ovirt/storage.rb
CHANGED
data/lib/ovirt/storage_domain.rb
CHANGED
data/lib/ovirt/tag.rb
CHANGED
data/lib/ovirt/template.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Ovirt
|
2
|
-
class Template <
|
2
|
+
class Template < Base
|
3
3
|
|
4
4
|
self.top_level_strings = [:name, :description, :type]
|
5
5
|
self.top_level_booleans = [:stateless]
|
@@ -88,7 +88,7 @@ module Ovirt
|
|
88
88
|
def create_vm(options = {})
|
89
89
|
options = options.dup
|
90
90
|
determine_clone_type(options)
|
91
|
-
options[:storage] =
|
91
|
+
options[:storage] = Base.object_to_id(options[:storage]) if options[:storage]
|
92
92
|
|
93
93
|
case options[:clone_type]
|
94
94
|
when :full; clone_to_vm(options)
|
@@ -147,7 +147,7 @@ module Ovirt
|
|
147
147
|
builder = Nokogiri::XML::Builder.new do |xml|
|
148
148
|
xml.vm do
|
149
149
|
xml.name options[:name]
|
150
|
-
xml.cluster(:id =>
|
150
|
+
xml.cluster(:id => Base.object_to_id(options[:cluster]))
|
151
151
|
xml.template(:id => self[:id])
|
152
152
|
|
153
153
|
CLONE_ATTRIBUTES_WITH_SCALARS.each do |key|
|
data/lib/ovirt/user.rb
CHANGED
data/lib/ovirt/version.rb
CHANGED
data/lib/ovirt/vmpool.rb
CHANGED
data/lib/ovirt.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Ovirt::
|
3
|
+
describe Ovirt::Base do
|
4
4
|
it ".api_endpoint" do
|
5
|
-
Ovirt::
|
5
|
+
Ovirt::Base.api_endpoint.should == "bases"
|
6
6
|
Ovirt::Template.api_endpoint.should == "templates"
|
7
7
|
Ovirt::Cluster.api_endpoint.should == "clusters"
|
8
8
|
Ovirt::Vm.api_endpoint.should == "vms"
|
data/spec/template_spec.rb
CHANGED
@@ -127,7 +127,7 @@ EOX
|
|
127
127
|
|
128
128
|
context "build_clone_xml" do
|
129
129
|
it "Properly sets vm/cpu/topology attributes" do
|
130
|
-
|
130
|
+
Ovirt::Base.stub(:object_to_id)
|
131
131
|
xml = @template.send(:build_clone_xml, :name => "Blank", :cluster => "6b8f1c1e-3eb0-11e4-8420-56847afe9799")
|
132
132
|
nodeset = Nokogiri::XML.parse(xml).xpath("//vm/cpu/topology")
|
133
133
|
node = nodeset.first
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Frey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- README.md
|
154
154
|
- lib/ovirt.rb
|
155
155
|
- lib/ovirt/api.rb
|
156
|
+
- lib/ovirt/base.rb
|
156
157
|
- lib/ovirt/cdrom.rb
|
157
158
|
- lib/ovirt/cluster.rb
|
158
159
|
- lib/ovirt/data_center.rb
|
@@ -168,7 +169,6 @@ files:
|
|
168
169
|
- lib/ovirt/inventory.rb
|
169
170
|
- lib/ovirt/network.rb
|
170
171
|
- lib/ovirt/nic.rb
|
171
|
-
- lib/ovirt/object.rb
|
172
172
|
- lib/ovirt/permission.rb
|
173
173
|
- lib/ovirt/permit.rb
|
174
174
|
- lib/ovirt/role.rb
|
@@ -183,8 +183,8 @@ files:
|
|
183
183
|
- lib/ovirt/version.rb
|
184
184
|
- lib/ovirt/vm.rb
|
185
185
|
- lib/ovirt/vmpool.rb
|
186
|
+
- spec/base_spec.rb
|
186
187
|
- spec/event_spec.rb
|
187
|
-
- spec/object_spec.rb
|
188
188
|
- spec/service_spec.rb
|
189
189
|
- spec/spec_helper.rb
|
190
190
|
- spec/template_spec.rb
|
@@ -215,8 +215,8 @@ specification_version: 4
|
|
215
215
|
summary: Ovirt provides a simple Object Oriented interface to the REST API of oVirt
|
216
216
|
and RHEV-M servers.
|
217
217
|
test_files:
|
218
|
+
- spec/base_spec.rb
|
218
219
|
- spec/event_spec.rb
|
219
|
-
- spec/object_spec.rb
|
220
220
|
- spec/service_spec.rb
|
221
221
|
- spec/spec_helper.rb
|
222
222
|
- spec/template_spec.rb
|