rbovirt 0.0.9 → 0.0.10
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/client/storage_domain_api.rb +4 -2
- data/lib/client/vm_api.rb +5 -1
- data/lib/ovirt/storage_domain.rb +4 -3
- data/rbovirt.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
@@ -8,8 +8,10 @@ module OVIRT
|
|
8
8
|
def storagedomains(opts={})
|
9
9
|
search= opts[:search] ||''
|
10
10
|
http_get("/storagedomains?search=%s" % CGI.escape(search)).xpath('/storage_domains/storage_domain').collect do |sd|
|
11
|
-
OVIRT::StorageDomain::new(self, sd)
|
12
|
-
|
11
|
+
storage_domain = OVIRT::StorageDomain::new(self, sd)
|
12
|
+
#filter by role is not supported by the search language. The work around is to list all then filter.
|
13
|
+
(opts[:role].nil? || storage_domain.role == opts[:role]) ? storage_domain : nil
|
14
|
+
end.compact
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/client/vm_api.rb
CHANGED
@@ -43,10 +43,14 @@ module OVIRT
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def add_volume(vm_id, opts={})
|
46
|
-
storage_domain_id = opts[:storage_domain] || storagedomains.first.id
|
46
|
+
storage_domain_id = opts[:storage_domain] || storagedomains(:role => 'data').first.id
|
47
47
|
http_post("/vms/%s/disks" % vm_id, OVIRT::Volume.to_xml(storage_domain_id, opts))
|
48
48
|
end
|
49
49
|
|
50
|
+
def destroy_volume(vm_id, vol_id)
|
51
|
+
http_delete("/vms/%s/disks/%s" % [vm_id, vol_id])
|
52
|
+
end
|
53
|
+
|
50
54
|
def vm_action(id, action, opts={})
|
51
55
|
xml_response = http_post("/vms/%s/%s" % [id, action],'<action/>', opts)
|
52
56
|
return (xml_response/'action/status').first.text.strip.upcase=="COMPLETE"
|
data/lib/ovirt/storage_domain.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module OVIRT
|
2
2
|
class StorageDomain < BaseObject
|
3
|
-
attr_reader :available, :used, :kind, :address, :path
|
3
|
+
attr_reader :available, :used, :kind, :address, :path, :role
|
4
4
|
|
5
5
|
def initialize(client, xml)
|
6
6
|
super(client, xml[:id], xml[:href], (xml/'name').first.text)
|
@@ -11,8 +11,9 @@ class StorageDomain < BaseObject
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def parse_xml_attributes!(xml)
|
14
|
-
@available = (xml/'available').first.text
|
15
|
-
@used = (xml/'used').first.text
|
14
|
+
@available = ((xml/'available').first.text rescue nil)
|
15
|
+
@used = ((xml/'used').first.text rescue nil)
|
16
|
+
@role = (xml/'type').first.text
|
16
17
|
@kind = (xml/'storage/type').first.text
|
17
18
|
@address = ((xml/'storage/address').first.text rescue nil)
|
18
19
|
@path = ((xml/'storage/path').first.text rescue nil)
|
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.10"
|
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-
|
12
|
+
s.date = %q{2012-04-08}
|
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 = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbovirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Amos Benari
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-08 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|