Skip to content

Commit

Permalink
Merge pull request #138 from billfitzgerald0120/quota_cloud_volumes
Browse files Browse the repository at this point in the history
Added cloud volumes to requested resource calculation.
(cherry picked from commit 70a6ded)

https://bugzilla.redhat.com/show_bug.cgi?id=1481446
  • Loading branch information
mkanoor authored and simaishi committed Aug 14, 2017
1 parent a8e548f commit 051fcf1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Expand Up @@ -231,10 +231,23 @@ def cloud_storage(args_hash)
else
flavor.root_disk_size.to_i + flavor.ephemeral_disk_size.to_i + flavor.swap_disk_size.to_i
end

storage += cloud_volume_storage(args_hash)
$evm.log(:info, "Retrieving cloud storage #{storage}")
default_option((storage * args_hash[:number_of_vms]), args_hash[:options_array])
end

def cloud_volume_storage(args_hash)
storage = 0
if args_hash[:resource].options[:volumes]
args_hash[:resource].options[:volumes].each do |v|
$evm.log(:info, "Adding volume to storage: #{v.inspect} ")
storage += v[:size].to_i.gigabytes
end
end
storage
end

def cloud_number_of_cpus(args_hash)
flavor = args_hash[:flavor]
$evm.log(:info, "Retrieving cloud flavor #{flavor.name} cpus => #{flavor.cpus}")
Expand Down
11 changes: 11 additions & 0 deletions spec/automation/unit/method_validation/calculate_requested_spec.rb
Expand Up @@ -94,6 +94,17 @@ def check_results(requested_hash, storage, cpu, vms, memory)
end
end

context "VM Cloud provisioning with cloud volumes" do
it "google calculate_requested number of vms 3, cloud volumes 3 gig " do
setup_model("google")
@miq_provision_request.options[:volumes] = [{:name => "Fred", :size => '1'}, {:name => "Wilma", :size => '2'}]
@miq_provision_request.options[:number_of_vms] = 3
@miq_provision_request.save
ws = run_automate_method(vm_attrs)
check_results(ws.root['quota_requested'], 39.gigabytes, 12, 3, 3.kilobytes)
end
end

context "VmReconfig quota calculate_request" do
it "add 2 cpus and add 4096 memory " do
setup_model("vmware_reconfigure")
Expand Down

0 comments on commit 051fcf1

Please sign in to comment.