manageiq-smartstate 0.2.24 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88652f88b8c5d6a77b1954fadbe76dc2d489d79d
4
- data.tar.gz: 8077e08ee5d0e4ef22347586ce6556c76e7f46f5
3
+ metadata.gz: 4f731538916cc77ead512682c9f59f0973df895c
4
+ data.tar.gz: c749c7daf28c1e65ae613bfe632ff8c98ba1a0eb
5
5
  SHA512:
6
- metadata.gz: 9275dbe27efff2e306632e60d025c1f7c520c0652480b7c110d30402993ae41b751ebc1cd2a5ec80f0cdbbcf57d5668b284572aab3e5f7f53aa48668ec1dc4eb
7
- data.tar.gz: 16788607a86a04fe9c05d103ce49c7da0184de1ce951d076c486724b9b801d5c893028f67793161ff6b4291adb43fb6655da983844c456d7bd777669574066c7
6
+ metadata.gz: b28438c09564c8d3e44cfda1a7c263847578274d231c8ca5423d7e44622cb8cd5b10dedbaa8ef0c2109f0212f6e47a5ff7aa793f687a9d50e23f9feeae1959f1
7
+ data.tar.gz: 2e55c1e754a8adc088be23da2ca5c0d7b07dffd9ed0a93f39ef41aa904de1f46a5d271a45f406b62399e2752f55fc60e7475435153cb416ace39cdd79bb4bb77
@@ -4,19 +4,17 @@ exclude_paths:
4
4
  - "**.xml"
5
5
  - "**.yaml"
6
6
  - "**.yml"
7
- - "lib/metadata/linux/test/Packages"
8
- - "lib/metadata/linux/test/tc_LinuxUtils.rb"
9
- - "locale/"
10
- - "spec/"
11
- - "test/"
12
- - "tools/"
13
- - "tmp/"
7
+ - lib/metadata/linux/test/Packages
8
+ - lib/metadata/linux/test/tc_LinuxUtils.rb
9
+ - locale/
10
+ - spec/
11
+ - test/
12
+ - tools/
13
+ - tmp/
14
14
  engines:
15
15
  brakeman:
16
- # very slow :sad_panda:
17
16
  enabled: false
18
17
  bundler-audit:
19
- # requires Gemfile.lock
20
18
  enabled: false
21
19
  csslint:
22
20
  enabled: false
@@ -27,19 +25,18 @@ engines:
27
25
  ruby:
28
26
  mass_threshold: 25
29
27
  count_threshold: 5
30
- javascript:
28
+ javascript:
31
29
  eslint:
32
30
  enabled: false
33
- channel: "eslint-3"
31
+ channel: eslint-3
34
32
  fixme:
35
- # let's enable later
36
33
  enabled: false
37
34
  markdownlint:
38
- # let's enable later
39
35
  enabled: false
40
36
  rubocop:
41
37
  enabled: true
42
- config: '.rubocop_cc.yml'
38
+ config: ".rubocop_cc.yml"
39
+ channel: rubocop-0-69
43
40
  checks:
44
41
  method-complexity:
45
42
  enabled: true
@@ -47,9 +44,9 @@ checks:
47
44
  threshold: 8
48
45
  prepare:
49
46
  fetch:
50
- - url: "https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml"
47
+ - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
51
48
  path: ".rubocop_base.yml"
52
- - url: "https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml"
49
+ - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml
53
50
  path: ".rubocop_cc_base.yml"
54
51
  ratings:
55
52
  paths:
@@ -25,11 +25,11 @@ class MiqRhevmVm < MiqVm
25
25
  end
26
26
 
27
27
  def getCfg(_snap = nil)
28
- cfg_props = @rhevmVm.attributes
28
+ cfg_props = @rhevmVm.as_json.with_indifferent_access
29
29
 
30
30
  raise MiqException::MiqVimError, "Failed to retrieve configuration information for VM" if cfg_props.nil?
31
31
 
32
- storage_domains = @rhevm.storagedomains
32
+ storage_domains = @rhevm.collect_storagedomains
33
33
  $log.debug "MiqRhevmVm#getCfg: storage_domains = #{storage_domains.inspect}"
34
34
 
35
35
  cfg_hash = {}
@@ -39,15 +39,15 @@ class MiqRhevmVm < MiqVm
39
39
  cfg_hash['numvcpu'] = cfg_props.fetch_path(:cpu, :sockets)
40
40
 
41
41
  # Collect disk information
42
- @rhevmVm.attributes[:disks] = @rhevmVm.send(:disks, :disk) if @rhevmVm[:disks].nil?
43
- @rhevmVm.disks.each_with_index do |disk, idx|
42
+ disks = @rhevm.collect_vm_disks(@rhevmVm)
43
+ disks.each_with_index do |disk, idx|
44
44
  $log.debug "MiqRhevmVm#getCfg: disk = #{disk.inspect}"
45
- storage_domain = disk[:storage_domains].first
45
+ storage_domain = disk.storage_domains.first
46
46
  if storage_domain.nil?
47
- $log.info "Disk <#{disk[:name]}> is skipped due to unassigned storage domain"
47
+ $log.info("Disk <#{disk.name}> is skipped due to unassigned storage domain")
48
48
  next
49
49
  end
50
- storage_id = storage_domain && storage_domain[:id]
50
+ storage_id = storage_domain.id
51
51
  storage_obj = storage_domains_by_id[storage_id]
52
52
 
53
53
  file_path = file_path_for_storage_type(storage_obj, disk)
@@ -56,13 +56,13 @@ class MiqRhevmVm < MiqVm
56
56
  cfg_hash["#{tag}.present"] = "true"
57
57
  cfg_hash["#{tag}.devicetype"] = "disk"
58
58
  cfg_hash["#{tag}.filename"] = file_path.to_s
59
- cfg_hash["#{tag}.format"] = disk[:format]
59
+ cfg_hash["#{tag}.format"] = disk.format
60
60
  end
61
61
  cfg_hash
62
62
  end
63
63
 
64
64
  def file_path_for_storage_type(storage_obj, disk)
65
- storage_type = storage_obj && storage_obj.attributes[:storage][:type]
65
+ storage_type = storage_obj&.storage&.type
66
66
 
67
67
  # TODO: account for other storage types here.
68
68
  case storage_type
@@ -75,38 +75,38 @@ class MiqRhevmVm < MiqVm
75
75
  end
76
76
 
77
77
  def nfs_mount_root
78
- @nfs_mount_root ||= @ost.nfs_mount_root || "/mnt/#{@rhevmVm.attributes[:id]}"
78
+ @nfs_mount_root ||= @ost.nfs_mount_root || "/mnt/#{@rhevmVm.id}"
79
79
  end
80
80
 
81
81
  def fs_file_path(storage_obj, disk)
82
- storage_id = storage_obj.attributes[:id]
83
- disk_id = disk.attributes[:id]
84
- image_id = disk.attributes[:image_id]
82
+ storage_id = storage_obj.id
83
+ disk_id = disk.id
84
+ image_id = disk.image_id
85
85
  mount_point = nfs_mounts[storage_id][:mount_point]
86
86
 
87
87
  ::File.join(mount_point, storage_id, 'images', disk_id, image_id)
88
88
  end
89
89
 
90
90
  def lun_file_path(storage_obj, disk)
91
- storage_id = storage_obj.attributes[:id]
92
- disk_id = disk[:image_id].blank? ? disk.attributes[:id] : disk.attributes[:image_id]
91
+ storage_id = storage_obj.id
92
+ disk_id = disk.image_id || disk.id
93
93
 
94
94
  ::File.join('/dev', storage_id, disk_id)
95
95
  end
96
96
 
97
97
  def storage_domains_by_id
98
- @storage_domains_by_id ||= @rhevm.storagedomains.each_with_object({}) { |sd, sdh| sdh[sd.attributes[:id]] = sd }
98
+ @storage_domains_by_id ||= @rhevm.collect_storagedomains.each_with_object({}) { |sd, sdh| sdh[sd.id] = sd }
99
99
  end
100
100
 
101
101
  #
102
102
  # Returns uri and mount points, hashed by storage ID.
103
103
  #
104
104
  def add_fs_mount(storage_obj)
105
- storage_id = storage_obj.attributes[:id]
105
+ storage_id = storage_obj.id
106
106
  return if nfs_mounts[storage_id]
107
107
 
108
108
  mount_point = ::File.join(nfs_mount_root, nfs_mount_dir(storage_obj))
109
- type = storage_obj.attributes[:storage][:type]
109
+ type = storage_obj.storage.type
110
110
  nfs_mounts[storage_id] = {
111
111
  :uri => "#{type}://#{nfs_uri(storage_obj)}",
112
112
  :mount_point => mount_point,
@@ -116,8 +116,8 @@ class MiqRhevmVm < MiqVm
116
116
  end
117
117
 
118
118
  def nfs_uri(storage_obj)
119
- storage = storage_obj.attributes[:storage]
120
- "#{storage[:address]}:#{storage[:path]}"
119
+ storage = storage_obj.storage
120
+ "#{storage.address}:#{storage.path}"
121
121
  end
122
122
 
123
123
  def nfs_mounts
@@ -42,7 +42,7 @@ class MiqVm
42
42
  elsif (@rhevm = @ost.miqRhevm)
43
43
  $log.debug "MiqVm::initialize: accessing VM through RHEVM server" if $log.debug?
44
44
  $log.debug "MiqVm::initialize: vmCfg = #{vmCfg}"
45
- @rhevmVm = @rhevm.get_vm(vmCfg)
45
+ @rhevmVm = @rhevm.vm_or_template_by_path(vmCfg)
46
46
  $log.debug "MiqVm::initialize: setting @ost.miqRhevmVm = #{@rhevmVm.class}" if $log.debug?
47
47
  @ost.miqRhevmVm = @rhevmVm
48
48
  @vmConfig = VmConfig.new(getCfg(@ost.snapId))
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module Smartstate
3
- VERSION = "0.2.24".freeze
3
+ VERSION = "0.3.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-smartstate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.24
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure-armrest