rbovirt 0.0.10 → 0.0.11

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 CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
@@ -6,10 +6,10 @@ module OVIRT
6
6
  end
7
7
 
8
8
  def storagedomains(opts={})
9
- search= opts[:search] ||''
9
+ search= opts[:search] || ("datacenter=%s" % current_datacenter.name)
10
10
  http_get("/storagedomains?search=%s" % CGI.escape(search)).xpath('/storage_domains/storage_domain').collect do |sd|
11
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.
12
+ #filter by role is not supported by the search language. The work around is to list all, then filter.
13
13
  (opts[:role].nil? || storage_domain.role == opts[:role]) ? storage_domain : nil
14
14
  end.compact
15
15
  end
data/lib/client/vm_api.rb CHANGED
@@ -37,13 +37,16 @@ module OVIRT
37
37
  end
38
38
 
39
39
  def vm_volumes vm_id
40
- http_get("/vms/%s/disks" % vm_id, http_headers).xpath('/disks/disk').collect do |disk|
40
+ volumes = http_get("/vms/%s/disks" % vm_id, http_headers).xpath('/disks/disk').collect do |disk|
41
41
  OVIRT::Volume::new(self, disk)
42
42
  end
43
+ #this is a workaround to a bug that the list is not sorted by default.
44
+ volumes.sort{ |l, r| l.name <=> r.name }
43
45
  end
44
46
 
45
47
  def add_volume(vm_id, opts={})
46
- storage_domain_id = opts[:storage_domain] || storagedomains(:role => 'data').first.id
48
+ search = opts[:search] || ("datacenter=%s" % current_datacenter.name)
49
+ storage_domain_id = opts[:storage_domain] || storagedomains(:role => 'data', :search => search).first.id
47
50
  http_post("/vms/%s/disks" % vm_id, OVIRT::Volume.to_xml(storage_domain_id, opts))
48
51
  end
49
52
 
data/lib/ovirt/volume.rb CHANGED
@@ -16,7 +16,7 @@ module OVIRT
16
16
  storage_domain_(:id => storage_domain_id)
17
17
  }
18
18
  size_(opts[:size] || 8589934592)
19
- type_(opts[:type] || 'system')
19
+ type_(opts[:type] || 'data')
20
20
  bootable_(opts[:bootable] || 'true')
21
21
  interface_(opts[:interface] || 'virtio')
22
22
  format_(opts[:format] || 'cow')
@@ -29,7 +29,7 @@ module OVIRT
29
29
  def parse_xml_attributes!(xml)
30
30
  @storage_domain = (xml/'storage_domains/storage_domain').first[:id]
31
31
  @size = (xml/'size').first.text
32
- @disk_type = (xml/'type').first.text
32
+ @disk_type = ((xml/'type').first.text rescue nil)
33
33
  @bootable = (xml/'bootable').first.text
34
34
  @interface = (xml/'interface').first.text
35
35
  @format = (xml/'format').first.text
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.10"
8
+ s.version = "0.0.11"
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-04-08}
12
+ s.date = %q{2012-04-16}
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
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-04-08 00:00:00 +03:00
18
+ date: 2012-04-16 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency