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 +4 -4
- data/.codeclimate.yml +13 -16
- data/lib/MiqVm/MiqRhevmVm.rb +20 -20
- data/lib/MiqVm/MiqVm.rb +1 -1
- data/lib/manageiq/smartstate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f731538916cc77ead512682c9f59f0973df895c
|
4
|
+
data.tar.gz: c749c7daf28c1e65ae613bfe632ff8c98ba1a0eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b28438c09564c8d3e44cfda1a7c263847578274d231c8ca5423d7e44622cb8cd5b10dedbaa8ef0c2109f0212f6e47a5ff7aa793f687a9d50e23f9feeae1959f1
|
7
|
+
data.tar.gz: 2e55c1e754a8adc088be23da2ca5c0d7b07dffd9ed0a93f39ef41aa904de1f46a5d271a45f406b62399e2752f55fc60e7475435153cb416ace39cdd79bb4bb77
|
data/.codeclimate.yml
CHANGED
@@ -4,19 +4,17 @@ exclude_paths:
|
|
4
4
|
- "**.xml"
|
5
5
|
- "**.yaml"
|
6
6
|
- "**.yml"
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
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:
|
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:
|
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:
|
47
|
+
- url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
|
51
48
|
path: ".rubocop_base.yml"
|
52
|
-
- url:
|
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:
|
data/lib/MiqVm/MiqRhevmVm.rb
CHANGED
@@ -25,11 +25,11 @@ class MiqRhevmVm < MiqVm
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def getCfg(_snap = nil)
|
28
|
-
cfg_props = @rhevmVm.
|
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.
|
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
|
-
|
43
|
-
|
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
|
45
|
+
storage_domain = disk.storage_domains.first
|
46
46
|
if storage_domain.nil?
|
47
|
-
$log.info
|
47
|
+
$log.info("Disk <#{disk.name}> is skipped due to unassigned storage domain")
|
48
48
|
next
|
49
49
|
end
|
50
|
-
storage_id = storage_domain
|
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
|
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
|
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.
|
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.
|
83
|
-
disk_id = disk.
|
84
|
-
image_id = disk.
|
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.
|
92
|
-
disk_id = disk
|
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.
|
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.
|
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.
|
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.
|
120
|
-
"#{storage
|
119
|
+
storage = storage_obj.storage
|
120
|
+
"#{storage.address}:#{storage.path}"
|
121
121
|
end
|
122
122
|
|
123
123
|
def nfs_mounts
|
data/lib/MiqVm/MiqVm.rb
CHANGED
@@ -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.
|
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))
|
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.
|
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-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: azure-armrest
|