Class: ForemanResourceQuota::ResourceOrigins::ComputeAttributesOrigin
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/compute_attributes_origin.rb', line 14
def (param)
return nil unless param.key?(:cpus)
param[:cpus].to_i
rescue StandardError
nil
end
|
32
33
34
35
36
37
38
39
40
41
|
# File 'app/services/foreman_resource_quota/resource_origins/compute_attributes_origin.rb', line 32
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
27
28
29
30
|
# File 'app/services/foreman_resource_quota/resource_origins/compute_attributes_origin.rb', line 21
def (param)
case determine_memory_key(param)
when :memory
param[:memory].to_i / ResourceQuotaHelper::FACTOR_B_TO_MB
when :memory_mb
param[:memory_mb].to_i
end
rescue StandardError
nil
end
|
#host_attribute_eager_name ⇒ Object
6
7
8
|
# File 'app/services/foreman_resource_quota/resource_origins/compute_attributes_origin.rb', line 6
def host_attribute_eager_name
:compute_attributes
end
|
#host_attribute_name ⇒ Object
10
11
12
|
# File 'app/services/foreman_resource_quota/resource_origins/compute_attributes_origin.rb', line 10
def host_attribute_name
:compute_attributes
end
|