1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vsphere] allow setting ram and num of cpu when cloning

This commit is contained in:
Mick Pollard 2013-04-04 23:36:29 +11:00 committed by Jeff McCune
parent 6bcd8239e7
commit 460783d945
2 changed files with 21 additions and 1 deletions

View file

@ -186,7 +186,17 @@ module Fog
:nicSettingMap => cust_adapter_mapping)
end
customization_spec ||= nil
# FIXME: pad this out with the rest of the useful things in VirtualMachineConfigSpec
# http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.ConfigSpec.html
#
if options.has_key?('memoryMB') || options.has_key?('numCPUs')
virtual_machine_config_spec = {
:memoryMB => options['memoryMB'],
:numCPUs => options['numCPUs']
}
end
relocation_spec=nil
if ( options['linked_clone'] )
# cribbed heavily from the rbvmomi clone_vm.rb

View file

@ -14,6 +14,16 @@ Shindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do
end
end
template = "folder/rhel64"
datacenter = "Solutions"
tests("Standard Clone setting ram and cpu | The return value should") do
response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true)
test("be a kind of Hash") { response.kind_of? Hash }
%w{ vm_ref task_ref }.each do |key|
test("have a #{key} key") { response.has_key? key }
end
end
template = "folder/rhel64"
datacenter = "Solutions"
tests("Linked Clone | The return value should") do