foreman_xen 0.6.1 → 0.7.0

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
  SHA256:
3
- metadata.gz: a768b8f50ae86ddbca9006df5a6e123c68aece8a4fa6c96df9151715f573afb7
4
- data.tar.gz: 18e355d925f7eba0ec1694acc7fb0f7483b1b6cd382bb103d543578d7377e065
3
+ metadata.gz: 0cdd6bcd07d559882c14aeb7ff2846ec2374c6d2d499106a3164a8e69209d667
4
+ data.tar.gz: adec7df98c1e131f35aeac15e51fd13c74df1db4149a352f656c7cde6715344a
5
5
  SHA512:
6
- metadata.gz: ecbe4656e00f66a2481fb02b4048b5dce3da8056981b04d7aba390a782f1462a48e1f3e4c38c210bdd75c6e0b12cca2d51204ebeeba0799d0fe717d7fc8cecf7
7
- data.tar.gz: cf688e43aaf39170f504e0a1f980ba087d506d9a2f3e4b75b0db748b536cad8d8487d59a596e7b7e6c8a150d197ab719986ab7387d5cdf9949fc306fa03c02b6
6
+ metadata.gz: aa108f441b9d2b3fa86d6a92c0dfad446bef725be5516564071b155757c85c457384d1e1024331ff077e641b1d2e75a0a9cc558cf58c979979b0a2a4866e5499
7
+ data.tar.gz: e50152b26e2a04b0b341f9e7ee3e3143ff2611595ab7d773f1da82b2690b91fe59b7586ab3290e459882e1a314e7f0657d7f34c314b8d66a5969f4f9273576c2
data/README.md CHANGED
@@ -15,15 +15,16 @@ Please see the Foreman manual for further instructions:
15
15
 
16
16
  ## Compatibility
17
17
 
18
- | Foreman Version | Plugin Version |
19
- |:--------------- |:--------------------- |
20
- | >=1.5, <1.8 | 0.0.x (unmaintained) |
21
- | >=1.8.1, <1.10 | 0.1.x (unmaintained) |
22
- | >=1.10, <1.11 | 0.2.x (unmaintained) |
23
- | >=1.11, <1.13 | 0.3.x (unmaintained) |
24
- | >=1.13, <1.14 | 0.4.x (unmaintained) |
25
- | >=1.14, <1.17 | 0.5.x |
26
- | >=1.17 | 0.6.x |
18
+ | Foreman Version | Plugin Version |
19
+ | --------------- | ---------------------|
20
+ | >=1.5, <1.8 | 0.0.x (unmaintained) |
21
+ | >=1.8.1, <1.10 | 0.1.x (unmaintained) |
22
+ | >=1.10, <1.11 | 0.2.x (unmaintained) |
23
+ | >=1.11, <1.13 | 0.3.x (unmaintained) |
24
+ | >=1.13, <1.14 | 0.4.x (unmaintained) |
25
+ | >=1.14, <1.17 | 0.5.x (unmaintained) |
26
+ | >=1.17, <1.18 | 0.6.x (unmaintained) |
27
+ | >=1.18 | 0.7.x |
27
28
 
28
29
  ## Support
29
30
 
@@ -59,6 +59,7 @@ module ForemanXen
59
59
  snapshots = @compute_resource.find_snapshots
60
60
  snapshots.each do |snapshot|
61
61
  next unless snapshot.reference == ref
62
+
62
63
  name = snapshot.name
63
64
  snapshot.destroy
64
65
  notice "Successfully deleted snapshot #{snapshot.name}"
@@ -31,19 +31,17 @@ module XenComputeHelper
31
31
  compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
32
32
  attribute_map = filter_compute_attributes(attribute_map, compute_attributes)
33
33
  elsif new
34
- attribute_map[:cpu_count] = new.vcpus_max ? new.vcpus_max : nil
35
- attribute_map[:memory_min] = new.memory_static_min ? new.memory_static_min : nil
36
- attribute_map[:memory_max] = new.memory_static_max ? new.memory_static_max : nil
34
+ attribute_map[:cpu_count] = new.vcpus_max || nil
35
+ attribute_map[:memory_min] = new.memory_static_min || nil
36
+ attribute_map[:memory_max] = new.memory_static_max || nil
37
37
  if new.vbds
38
38
  vdi = new.vbds.first.vdi
39
39
  if vdi
40
- attribute_map[:volume_selected] = vdi.sr.uuid ? vdi.sr.uuid : nil
40
+ attribute_map[:volume_selected] = vdi.sr.uuid || nil
41
41
  attribute_map[:volume_size] = vdi.virtual_size ? (vdi.virtual_size.to_i / 1_073_741_824).to_s : nil
42
42
  end
43
43
  end
44
- if new.vifs
45
- attribute_map[:network_selected] = new.vifs.first.network.name ? new.vifs.first.network.name : nil
46
- end
44
+ attribute_map[:network_selected] = new.vifs.first.network.name || nil if new.vifs
47
45
  end
48
46
  attribute_map
49
47
  end
@@ -19,6 +19,7 @@ module ForemanXen
19
19
  Foreman::Logging.exception("Failed retrieving xenserver vm by uuid #{uuid}", e)
20
20
  raise(ActiveRecord::RecordNotFound) if e.message.include?('HANDLE_INVALID')
21
21
  raise(ActiveRecord::RecordNotFound) if e.message.include?('VM.get_record: ["SESSION_INVALID"')
22
+
22
23
  raise e
23
24
  end
24
25
 
@@ -92,6 +93,7 @@ module ForemanXen
92
93
 
93
94
  available_hypervisors.each do |host|
94
95
  next unless sr.reference == host.suspend_image_sr
96
+
95
97
  found = true
96
98
  subresults[:name] = sr.name
97
99
  subresults[:display_name] = sr.name + '(' + host.hostname + ')'
@@ -161,10 +163,11 @@ module ForemanXen
161
163
 
162
164
  def find_snapshots_for_vm(vm)
163
165
  return [] if vm.snapshots.empty?
166
+
164
167
  tmps = begin
165
168
  client.servers.templates.select(&:is_a_snapshot)
166
- rescue
167
- []
169
+ rescue
170
+ []
168
171
  end
169
172
  retval = []
170
173
  tmps.each do |snapshot|
@@ -176,8 +179,8 @@ module ForemanXen
176
179
  def find_snapshots
177
180
  tmps = begin
178
181
  client.servers.templates.select(&:is_a_snapshot)
179
- rescue
180
- []
182
+ rescue
183
+ []
181
184
  end
182
185
  tmps.sort_by(&:name)
183
186
  end
@@ -185,6 +188,7 @@ module ForemanXen
185
188
  def new_vm(attr = {})
186
189
  test_connection
187
190
  return unless errors.empty?
191
+
188
192
  opts = vm_instance_defaults.merge(attr.to_hash).symbolize_keys
189
193
 
190
194
  %i[networks volumes].each do |collection|
@@ -368,8 +372,7 @@ module ForemanXen
368
372
  protected
369
373
 
370
374
  def client
371
- @client ||= ::Fog::Compute.new(
372
- :provider => 'XenServer',
375
+ @client ||= Fog::XenServer::Compute.new(
373
376
  :xenserver_url => url,
374
377
  :xenserver_username => user,
375
378
  :xenserver_password => password,
@@ -423,6 +426,7 @@ module ForemanXen
423
426
 
424
427
  def get_hypervisor_host(args)
425
428
  return client.hosts.first unless args[:hypervisor_host] != ''
429
+
426
430
  client.hosts.find { |host| host.name == args[:hypervisor_host] }
427
431
  end
428
432
 
@@ -42,11 +42,11 @@ module ForemanXen
42
42
  config.to_prepare do
43
43
  begin
44
44
  # extend fog xen server and image models.
45
- require 'fog/compute/xen_server/models/server'
45
+ require 'fog/xenserver/compute/models/server'
46
46
  require File.expand_path('../../app/models/concerns/fog_extensions/xenserver/server', __dir__)
47
47
  require File.expand_path('../../app/models/concerns/foreman_xen/host_helper_extensions', __dir__)
48
48
 
49
- Fog::Compute::XenServer::Server.send(:include, ::FogExtensions::Xenserver::Server)
49
+ Fog::XenServer::Compute::Server.send(:include, ::FogExtensions::Xenserver::Server)
50
50
  ::HostsHelper.send(:include, ForemanXen::HostHelperExtensions)
51
51
  rescue => e
52
52
  Rails.logger.warn "Foreman-Xen: skipping engine hook (#{e})"
@@ -1,3 +1,3 @@
1
1
  module ForemanXen
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  end
@@ -51,6 +51,7 @@ class VNCTunnel
51
51
  begin
52
52
  data = @client_socket.read_nonblock(1024)
53
53
  break if data.nil?
54
+
54
55
  @srv_socket.write(data)
55
56
  rescue IO::WaitReadable => e
56
57
  IO.select([@client_socket])
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.6.1
4
+ version: 0.7.0
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: 2018-05-05 00:00:00.000000000 Z
13
+ date: 2018-11-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fog-xenserver
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.2'
21
+ version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '0.2'
28
+ version: '1.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -81,9 +81,9 @@ files:
81
81
  - locale/Makefile
82
82
  - test/foreman_xen_test.rb
83
83
  - test/test_helper.rb
84
- homepage: http://github.com/theforeman/foreman-xen
84
+ homepage: https://github.com/theforeman/foreman-xen
85
85
  licenses:
86
- - GPL-3
86
+ - GPL-3.0
87
87
  metadata: {}
88
88
  post_install_message:
89
89
  rdoc_options: []