foreman_xen 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7970c57af652a76865ce11386d3f96d2ad5cd789
4
- data.tar.gz: 8b7a10b16676968ce4a50fcb3d3bc59c5f3248c1
3
+ metadata.gz: 8d4e7a7c9e4fabcd5946a7b155453661efd872f2
4
+ data.tar.gz: 30ced528a243b7267340ba682f01d27e3e8400db
5
5
  SHA512:
6
- metadata.gz: 1e45718f60595e04ccf5b634df462952bf7494881966b4519c2120ebae45a2f5c3a080f525236fff92f2625eb16146d0e62f1ff4b827692fbfc8d259965ee1d5
7
- data.tar.gz: c3106ac70bdc20df5c749d63d89dd26234700f3a6e2005645870e5883209408befbbbfcf357bc68b0727e81b69faf18c7e5d2f8987afaf8e0f13001d3d1a0297
6
+ metadata.gz: 4cb8a8f9329784a6bdf9ca7d2869ddabdb1becda7e355b195511bc5173df093c775e1f9c30ca0e712f1f24f60b246f4d5b0ef37d1d7b56dfb6347e0f0b12cb0b
7
+ data.tar.gz: d0bbbec49fd6d0c921aed943cd46e7a45006b135a3a31a0650cc45d5bfba3918ac60db26429ee6955a1680551d2d6c2bfbfa41b2d35959d8a5c7e40bbfe1cf79
@@ -36,7 +36,7 @@ module ForemanXen
36
36
  vm.revert(ref)
37
37
  vm.start
38
38
  process_success(
39
- :success_msg => "Successfully reverted and powered on #{@host.name}",
39
+ :success_msg => "Successfully reverted and powered on #{@host.name}",
40
40
  :success_redirect => "/foreman_xen/snapshots/#{id}"
41
41
  )
42
42
  else
@@ -71,7 +71,7 @@ module ForemanXen
71
71
  process_error(:error_msg => "Error retrieving compute resource information for host id: #{id}")
72
72
  end
73
73
  process_success(
74
- :success_msg => "Successfully deleted snapshot: #{name}",
74
+ :success_msg => "Successfully deleted snapshot: #{name}",
75
75
  :success_redirect => "/foreman_xen/snapshots/#{id}"
76
76
  )
77
77
  end
@@ -110,7 +110,7 @@ module ForemanXen
110
110
  if !vm.nil?
111
111
  vm.snapshot(name)
112
112
  process_success(
113
- :success_msg => "Successfully created snapshot #{name} for #{@host.name}",
113
+ :success_msg => "Successfully created snapshot #{name} for #{@host.name}",
114
114
  :success_redirect => "/foreman_xen/snapshots/#{id}"
115
115
  )
116
116
  else
@@ -10,7 +10,7 @@ module XenComputeHelper
10
10
 
11
11
  def init_vmdata
12
12
  vmdata = {
13
- :ifs => {
13
+ :ifs => {
14
14
  '0' => {
15
15
  :ip => '',
16
16
  :gateway => '',
@@ -12,11 +12,9 @@ module FogExtensions
12
12
  name
13
13
  end
14
14
 
15
- def nics_attributes=(attrs)
16
- end
15
+ def nics_attributes=(attrs); end
17
16
 
18
- def volumes_attributes=(attrs)
19
- end
17
+ def volumes_attributes=(attrs); end
20
18
 
21
19
  def memory
22
20
  memory_static_max.to_i
@@ -26,6 +24,10 @@ module FogExtensions
26
24
  reboot
27
25
  end
28
26
 
27
+ def stop
28
+ shutdown
29
+ end
30
+
29
31
  def ready?
30
32
  running?
31
33
  end
@@ -15,7 +15,8 @@ module ForemanXen
15
15
  _('Xen Snapshots'),
16
16
  "../foreman_xen/snapshots/#{@host.id}/",
17
17
  :title => _('Manage machine snapshots'),
18
- :id => :xen_snap_button
18
+ :id => :xen_snap_button,
19
+ :class => 'btn btn-default'
19
20
  )
20
21
  )
21
22
  )
@@ -15,9 +15,10 @@ module ForemanXen
15
15
  [:build]
16
16
  end
17
17
 
18
- def find_vm_by_uuid(ref)
19
- client.servers.get(ref)
18
+ def find_vm_by_uuid(uuid)
19
+ client.servers.get(uuid)
20
20
  rescue Fog::XenServer::RequestFailed => e
21
+ Foreman::Logging.exception("Failed retrieving xenserver vm by uuid #{uuid}", e)
21
22
  raise(ActiveRecord::RecordNotFound) if e.message.include?('HANDLE_INVALID')
22
23
  raise(ActiveRecord::RecordNotFound) if e.message.include?('VM.get_record: ["SESSION_INVALID"')
23
24
  raise e
@@ -66,7 +67,7 @@ module ForemanXen
66
67
  rescue
67
68
  []
68
69
  end
69
- tmps.sort { |a, b| a.name <=> b.name }
70
+ tmps.sort_by(&:name)
70
71
  end
71
72
 
72
73
  def new_nic(attr = {})
@@ -100,7 +101,7 @@ module ForemanXen
100
101
  break
101
102
  end
102
103
 
103
- if found == 0
104
+ if found.zero?
104
105
  subresults[:name] = sr.name
105
106
  subresults[:display_name] = sr.name
106
107
  subresults[:uuid] = sr.uuid
@@ -124,7 +125,7 @@ module ForemanXen
124
125
  rescue
125
126
  []
126
127
  end
127
- networks.sort { |a, b| a.name <=> b.name }
128
+ networks.sort_by(&:name)
128
129
  end
129
130
 
130
131
  def templates
@@ -139,7 +140,7 @@ module ForemanXen
139
140
  rescue
140
141
  []
141
142
  end
142
- tmps.sort { |a, b| a.name <=> b.name }
143
+ tmps.sort_by(&:name)
143
144
  end
144
145
 
145
146
  def builtin_templates
@@ -148,11 +149,11 @@ module ForemanXen
148
149
  rescue
149
150
  []
150
151
  end
151
- tmps.sort { |a, b| a.name <=> b.name }
152
+ tmps.sort_by(&:name)
152
153
  end
153
154
 
154
155
  def associated_host(vm)
155
- associate_by('mac', vm.interfaces.map(&:mac))
156
+ associate_by('mac', vm.interfaces.map(&:mac).map { |mac| Net::Validations.normalize_mac(mac) })
156
157
  end
157
158
 
158
159
  def find_snapshots_for_vm(vm)
@@ -175,7 +176,7 @@ module ForemanXen
175
176
  rescue
176
177
  []
177
178
  end
178
- tmps.sort { |a, b| a.name <=> b.name }
179
+ tmps.sort_by(&:name)
179
180
  end
180
181
 
181
182
  def new_vm(attr = {})
@@ -203,10 +204,10 @@ module ForemanXen
203
204
  begin
204
205
  logger.info "create_vm(): custom_template_name: #{custom_template_name}"
205
206
  logger.info "create_vm(): builtin_template_name: #{builtin_template_name}"
206
- vm = (custom_template_name != '') ? create_vm_from_custom(args) : create_vm_from_builtin(args)
207
+ vm = custom_template_name != '' ? create_vm_from_custom(args) : create_vm_from_builtin(args)
207
208
  vm.set_attribute('name_description', 'Provisioned by Foreman')
208
- vm.set_attribute('VCPUs_at_startup', args[:vcpus_max])
209
209
  vm.set_attribute('VCPUs_max', args[:vcpus_max])
210
+ vm.set_attribute('VCPUs_at_startup', args[:vcpus_max])
210
211
  vm.reload
211
212
  return vm
212
213
  rescue => e
@@ -337,9 +338,9 @@ module ForemanXen
337
338
  tunnel.start
338
339
  logger.info 'VNCTunnel started'
339
340
  WsProxy.start(
340
- :host => tunnel.host,
341
+ :host => tunnel.host,
341
342
  :host_port => tunnel.port,
342
- :password => ''
343
+ :password => ''
343
344
  ).merge(
344
345
  :type => 'vnc',
345
346
  :name => vm.name
@@ -358,10 +359,10 @@ module ForemanXen
358
359
 
359
360
  def client
360
361
  @client ||= ::Fog::Compute.new(
361
- :provider => 'XenServer',
362
- :xenserver_url => url,
363
- :xenserver_username => user,
364
- :xenserver_password => password,
362
+ :provider => 'XenServer',
363
+ :xenserver_url => url,
364
+ :xenserver_username => user,
365
+ :xenserver_password => password,
365
366
  :xenserver_redirect_to_master => true
366
367
  )
367
368
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanXen
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_xen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Nemirovsky
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-30 00:00:00.000000000 Z
13
+ date: 2016-12-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fog-xenserver
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.5.1
101
+ rubygems_version: 2.5.2
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Provision and manage XEN Server from Foreman