Class: ForemanResourceQuota::ResourceOrigins::VMAttributesOrigin
Constant Summary
ForemanResourceQuota::ResourceOrigin::RESOURCE_FUNCTION_MAP
Instance Method Summary
collapse
#collect_resources!
Instance Method Details
14
15
16
17
18
19
|
# File 'app/services/foreman_resource_quota/resource_origins/vm_attributes_origin.rb', line 14
def (param)
return nil unless param.key?(:cpus)
param[:cpus]
rescue StandardError
nil
end
|
28
29
30
31
32
33
34
35
36
37
|
# File 'app/services/foreman_resource_quota/resource_origins/vm_attributes_origin.rb', line 28
def (param)
return nil unless param.key?(:volumes_attributes)
(param).sum do |disk|
return nil unless disk.key?(:capacity) || disk.key?(:size_gb)
(disk[:size_gb] || disk[:capacity]).to_i
end
rescue StandardError
nil
end
|
21
22
23
24
25
26
|
# File 'app/services/foreman_resource_quota/resource_origins/vm_attributes_origin.rb', line 21
def (param)
return nil unless param.key?(:memory_mb)
param[:memory_mb]
rescue StandardError
nil
end
|
#host_attribute_eager_name ⇒ Object
6
7
8
|
# File 'app/services/foreman_resource_quota/resource_origins/vm_attributes_origin.rb', line 6
def host_attribute_eager_name
:compute_resource
end
|
#host_attribute_name ⇒ Object
10
11
12
|
# File 'app/services/foreman_resource_quota/resource_origins/vm_attributes_origin.rb', line 10
def host_attribute_name
:vm_compute_attributes
end
|