rbovirt 0.0.18 → 0.0.19

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.

checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjEzMDgxMWNjZGQzMTUwYzVmNzFhNmEzNmU3ZDNlYzZkZjJhMWQwYg==
5
+ data.tar.gz: !binary |-
6
+ YjRmNmQyNmZlYzJjODk0NjgxYTY2NGE1ZmJmMWY1MGQzNWIzNGFhOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjM5Njc2MWI5ZGYxMzgxMGJiN2E4OGUwMGVmNDdmMzUwMWMzMGM0MmNiZThi
10
+ ZmM4MjVjMDBkNzgzODcxMTI1Njg1NWQ0YjIwNzdkNGE2OWM3OWNiNTgwOTAy
11
+ ODg2NTRmMjZlOWE4NjQ5NzEwZTYyYmM3MDRhZGRkNTNlNDExYjk=
12
+ data.tar.gz: !binary |-
13
+ NGVmOGUwNjc2YzcxODI2YTQ3MGNjOTg1YWRiNjQ2ZWQ0MjBiZGIxNDAxN2Ix
14
+ ZGY4ZjU2NmU2N2E0MWY1ZTYxYzYxN2Y3NWU1MWI0ODk5ZDE2ODAxYmRmOThm
15
+ NTcxY2Q1OGJiNjBkMjgwZDA0NDRlZjdhNjQwNDk1YTlhOGM4ZGI=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.18
1
+ 0.0.19
@@ -0,0 +1,14 @@
1
+ module OVIRT
2
+ class Client
3
+ def quota(quota_id, opts={})
4
+ q = http_get("/datacenters/%s/quotas/%s" % current_datacenter.id % quota_id)
5
+ OVIRT::Quota::new(self, q.root)
6
+ end
7
+
8
+ def quotas(opts={})
9
+ http_get("/datacenters/%s/quotas" % CGI.escape(current_datacenter.id)).xpath('/quotas/quota').collect do |q|
10
+ OVIRT::Quota::new(self, q)
11
+ end.compact
12
+ end
13
+ end
14
+ end
data/lib/client/vm_api.rb CHANGED
@@ -36,10 +36,15 @@ module OVIRT
36
36
  end
37
37
 
38
38
  def vm_interfaces vm_id
39
- http_get("/vms/%s/nics" % vm_id, http_headers).xpath('/nics/nic').collect do |nic|
40
- OVIRT::Interface::new(self, nic)
39
+ begin
40
+ http_get("/vms/%s/nics" % vm_id, http_headers).xpath('/nics/nic').collect do |nic|
41
+ OVIRT::Interface::new(self, nic)
42
+ end
43
+ rescue => e # Catch case were vm_id is destroyed.
44
+ raise e unless e.message =~ /Entity not found/
45
+ []
41
46
  end
42
- end
47
+ end
43
48
 
44
49
  def destroy_interface(vm_id, interface_id)
45
50
  http_delete("/vms/%s/nics/%s" % [vm_id, interface_id])
@@ -54,8 +59,13 @@ module OVIRT
54
59
  end
55
60
 
56
61
  def vm_volumes vm_id
57
- volumes = http_get("/vms/%s/disks" % vm_id, http_headers).xpath('/disks/disk').collect do |disk|
58
- OVIRT::Volume::new(self, disk)
62
+ begin
63
+ volumes = http_get("/vms/%s/disks" % vm_id, http_headers).xpath('/disks/disk').collect do |disk|
64
+ OVIRT::Volume::new(self, disk)
65
+ end
66
+ rescue => e # Catch case were vm_id is destroyed.
67
+ raise e unless e.message =~ /Entity not found/
68
+ volumes = []
59
69
  end
60
70
  #this is a workaround to a bug that the list is not sorted by default.
61
71
  volumes.sort{ |l, r| l.name <=> r.name }
@@ -0,0 +1,17 @@
1
+ module OVIRT
2
+ class Quota < BaseObject
3
+ attr_reader :name, :description
4
+
5
+ def initialize(client, xml)
6
+ super(client, xml[:id], xml[:href], (xml/'name').first.text)
7
+ parse_xml_attributes!(xml)
8
+ self
9
+ end
10
+
11
+ private
12
+ def parse_xml_attributes!(xml)
13
+ @desciption = ((xml/'description').first.text rescue nil)
14
+ end
15
+ end
16
+ end
17
+
data/lib/ovirt/vm.rb CHANGED
@@ -5,7 +5,7 @@ module OVIRT
5
5
 
6
6
  class VM < BaseObject
7
7
  attr_reader :description, :status, :memory, :profile, :display, :host, :cluster, :template
8
- attr_reader :storage, :cores, :creation_time, :os, :ips, :vnc
8
+ attr_reader :storage, :cores, :creation_time, :os, :ips, :vnc, :quota
9
9
  attr_accessor :interfaces, :volumes
10
10
 
11
11
  def initialize(client, xml)
@@ -31,6 +31,10 @@ module OVIRT
31
31
  @interfaces ||= @client.vm_interfaces(id)
32
32
  end
33
33
 
34
+ def quota
35
+ @quota ||= @client.quota(id)
36
+ end
37
+
34
38
  def volumes
35
39
  @volumes ||= @client.vm_volumes(id)
36
40
  end
@@ -53,6 +57,9 @@ module OVIRT
53
57
  else
54
58
  template_{name_('Blank')}
55
59
  end
60
+ if opts[:quota]
61
+ quota_( :id => opts[:quota])
62
+ end
56
63
  if opts[:cluster]
57
64
  cluster_( :id => opts[:cluster])
58
65
  elsif opts[:cluster_name]
@@ -67,10 +74,17 @@ module OVIRT
67
74
  topology( :cores => (opts[:cores] || '1'), :sockets => '1' )
68
75
  }
69
76
  end
70
- os{
71
- boot(:dev=> opts[:boot_dev1] || 'network')
72
- boot(:dev=> opts[:boot_dev2] || 'hd')
73
- }
77
+ if(opts[:first_boot_dev] && opts[:first_boot_dev] == 'network')
78
+ os{
79
+ boot(:dev=> opts[:boot_dev1] || 'network')
80
+ boot(:dev=> opts[:boot_dev2] || 'hd')
81
+ }
82
+ else
83
+ os{
84
+ boot(:dev=> opts[:boot_dev2] || 'hd')
85
+ boot(:dev=> opts[:boot_dev1] || 'network')
86
+ }
87
+ end
74
88
  display_{
75
89
  type_(opts[:display])
76
90
  } if opts[:display]
data/lib/ovirt/volume.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OVIRT
2
2
 
3
3
  class Volume < BaseObject
4
- attr_reader :size, :disk_type, :bootable, :interface, :format, :sparse, :status, :storage_domain, :vm
4
+ attr_reader :size, :disk_type, :bootable, :interface, :format, :sparse, :status, :storage_domain, :vm, :quota
5
5
 
6
6
  def initialize(client, xml)
7
7
  super(client, xml[:id], xml[:href], (xml/'name').first.text)
@@ -21,6 +21,7 @@ module OVIRT
21
21
  interface_(opts[:interface] || 'virtio')
22
22
  format_(opts[:format] || 'cow')
23
23
  sparse_(opts[:sparse] || 'true')
24
+ quota_( :id => opts[:quota])
24
25
  }
25
26
  end
26
27
  Nokogiri::XML(builder.to_xml).root.to_s
data/lib/rbovirt.rb CHANGED
@@ -8,6 +8,7 @@ require "ovirt/vm"
8
8
  require "ovirt/volume"
9
9
  require "ovirt/interface"
10
10
  require "ovirt/network"
11
+ require "ovirt/quota"
11
12
 
12
13
  require "client/vm_api"
13
14
  require "client/template_api"
@@ -15,6 +16,7 @@ require "client/cluster_api"
15
16
  require "client/host_api"
16
17
  require "client/datacenter_api"
17
18
  require "client/storage_domain_api"
19
+ require "client/quota_api"
18
20
 
19
21
  require "nokogiri"
20
22
  require "rest_client"
data/rbovirt.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rbovirt"
8
- s.version = "0.0.18"
8
+ s.version = "0.0.19"
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"]
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "lib/client/cluster_api.rb",
27
27
  "lib/client/datacenter_api.rb",
28
28
  "lib/client/host_api.rb",
29
+ "lib/client/quota_api.rb",
29
30
  "lib/client/storage_domain_api.rb",
30
31
  "lib/client/template_api.rb",
31
32
  "lib/client/vm_api.rb",
@@ -35,6 +36,7 @@ Gem::Specification.new do |s|
35
36
  "lib/ovirt/host.rb",
36
37
  "lib/ovirt/interface.rb",
37
38
  "lib/ovirt/network.rb",
39
+ "lib/ovirt/quota.rb",
38
40
  "lib/ovirt/storage_domain.rb",
39
41
  "lib/ovirt/template.rb",
40
42
  "lib/ovirt/vm.rb",
metadata CHANGED
@@ -1,135 +1,121 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rbovirt
3
- version: !ruby/object:Gem::Version
4
- hash: 59
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 18
10
- version: 0.0.18
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.19
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Amos Benari
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-02-25 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- prerelease: false
11
+ date: 2013-02-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: nokogiri
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- requirement: *id001
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :runtime
34
- - !ruby/object:Gem::Dependency
35
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
36
28
  name: rest-client
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
46
- requirement: *id002
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
47
34
  type: :runtime
48
- - !ruby/object:Gem::Dependency
49
35
  prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
50
42
  name: shoulda
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
60
- requirement: *id003
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
61
48
  type: :development
62
- - !ruby/object:Gem::Dependency
63
49
  prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
64
56
  name: bundler
65
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
68
59
  - - ~>
69
- - !ruby/object:Gem::Version
70
- hash: 23
71
- segments:
72
- - 1
73
- - 0
74
- - 0
60
+ - !ruby/object:Gem::Version
75
61
  version: 1.0.0
76
- requirement: *id004
77
62
  type: :development
78
- - !ruby/object:Gem::Dependency
79
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.0
69
+ - !ruby/object:Gem::Dependency
80
70
  name: jeweler
81
- version_requirements: &id005 !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
84
73
  - - ~>
85
- - !ruby/object:Gem::Version
86
- hash: 7
87
- segments:
88
- - 1
89
- - 6
90
- - 4
74
+ - !ruby/object:Gem::Version
91
75
  version: 1.6.4
92
- requirement: *id005
93
76
  type: :development
94
- - !ruby/object:Gem::Dependency
95
77
  prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.4
83
+ - !ruby/object:Gem::Dependency
96
84
  name: rcov
97
- version_requirements: &id006 !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
106
- requirement: *id006
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
107
90
  type: :development
108
- - !ruby/object:Gem::Dependency
109
91
  prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
110
98
  name: rspec-rails
111
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
- none: false
113
- requirements:
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
114
101
  - - ~>
115
- - !ruby/object:Gem::Version
116
- hash: 15
117
- segments:
118
- - 2
119
- - 6
120
- version: "2.6"
121
- requirement: *id007
102
+ - !ruby/object:Gem::Version
103
+ version: '2.6'
122
104
  type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '2.6'
123
111
  description: A Ruby client for oVirt REST API
124
112
  email: abenari@redhat.com
125
113
  executables: []
126
-
127
114
  extensions: []
128
-
129
- extra_rdoc_files:
115
+ extra_rdoc_files:
130
116
  - LICENSE.txt
131
117
  - README.rdoc
132
- files:
118
+ files:
133
119
  - .document
134
120
  - Gemfile
135
121
  - LICENSE.txt
@@ -139,6 +125,7 @@ files:
139
125
  - lib/client/cluster_api.rb
140
126
  - lib/client/datacenter_api.rb
141
127
  - lib/client/host_api.rb
128
+ - lib/client/quota_api.rb
142
129
  - lib/client/storage_domain_api.rb
143
130
  - lib/client/template_api.rb
144
131
  - lib/client/vm_api.rb
@@ -148,6 +135,7 @@ files:
148
135
  - lib/ovirt/host.rb
149
136
  - lib/ovirt/interface.rb
150
137
  - lib/ovirt/network.rb
138
+ - lib/ovirt/quota.rb
151
139
  - lib/ovirt/storage_domain.rb
152
140
  - lib/ovirt/template.rb
153
141
  - lib/ovirt/vm.rb
@@ -161,37 +149,27 @@ files:
161
149
  - spec/spec_helper.rb
162
150
  - spec/unit/vm_spec.rb
163
151
  homepage: http://github.com/abenari/rbovirt
164
- licenses:
152
+ licenses:
165
153
  - MIT
154
+ metadata: {}
166
155
  post_install_message:
167
156
  rdoc_options: []
168
-
169
- require_paths:
157
+ require_paths:
170
158
  - lib
171
- required_ruby_version: !ruby/object:Gem::Requirement
172
- none: false
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- hash: 3
177
- segments:
178
- - 0
179
- version: "0"
180
- required_rubygems_version: !ruby/object:Gem::Requirement
181
- none: false
182
- requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- hash: 3
186
- segments:
187
- - 0
188
- version: "0"
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ! '>='
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
189
169
  requirements: []
190
-
191
170
  rubyforge_project:
192
- rubygems_version: 1.8.24
171
+ rubygems_version: 2.0.3
193
172
  signing_key:
194
173
  specification_version: 3
195
174
  summary: A Ruby client for oVirt REST API
196
175
  test_files: []
197
-