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 +4 -4
- data/app/controllers/foreman_xen/snapshots_controller.rb +3 -3
- data/app/helpers/xen_compute_helper.rb +1 -1
- data/app/models/concerns/fog_extensions/xenserver/server.rb +6 -4
- data/app/models/concerns/foreman_xen/host_helper_extensions.rb +2 -1
- data/app/models/foreman_xen/xenserver.rb +18 -17
- data/lib/foreman_xen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d4e7a7c9e4fabcd5946a7b155453661efd872f2
|
4
|
+
data.tar.gz: 30ced528a243b7267340ba682f01d27e3e8400db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
113
|
+
:success_msg => "Successfully created snapshot #{name} for #{@host.name}",
|
114
114
|
:success_redirect => "/foreman_xen/snapshots/#{id}"
|
115
115
|
)
|
116
116
|
else
|
@@ -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,9 +15,10 @@ module ForemanXen
|
|
15
15
|
[:build]
|
16
16
|
end
|
17
17
|
|
18
|
-
def find_vm_by_uuid(
|
19
|
-
client.servers.get(
|
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.
|
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
|
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.
|
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.
|
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.
|
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.
|
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 =
|
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
|
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
|
362
|
-
:xenserver_url
|
363
|
-
:xenserver_username
|
364
|
-
:xenserver_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
|
data/lib/foreman_xen/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|