1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vsphere/requests/compute/get_resource_pool.rb
Chris Thompson 0777ea7800 get resource pool without name
This appears to be the best way to allow cloning into a chosen cluster which is not using any resource pools. Luckily the cluster is able to return a default resource pool. I have this working with vsphere 5.1 and rbvmomi 1.6.0.
The option to the vm_clone method would look like this 'resource_pool' => ['cluster5', nil]
2014-08-19 10:26:44 -05:00

26 lines
810 B
Ruby

module Fog
module Compute
class Vsphere
class Real
def get_resource_pool(name, cluster_name, datacenter_name)
resource_pool = get_raw_resource_pool(name, cluster_name, datacenter_name)
raise(Fog::Compute::Vsphere::NotFound) unless resource_pool
resource_pool_attributes(resource_pool, cluster_name, datacenter_name)
end
protected
def get_raw_resource_pool(name, cluster_name, datacenter_name)
dc = find_raw_datacenter(datacenter_name)
cluster = dc.find_compute_resource(cluster_name)
name.nil? ? cluster.resourcePool : cluster.resourcePool.find( name)
end
end
class Mock
def get_resource_pool(name, cluster_name, datacenter_name)
end
end
end
end
end