vSphere functions should use connection object in vsphere_helper lib

This commit is contained in:
Scott Schneider 2013-11-04 10:10:15 -08:00
parent 30ebe4249e
commit b808b9c6c1

View file

@ -21,16 +21,6 @@ config = YAML.load_file(config_file)
pools = config[:pools] pools = config[:pools]
vsphere = config[:vsphere] vsphere = config[:vsphere]
# Connect to vSphere
$vim = RbVmomi::VIM.connect(
:host => vsphere['server'],
:user => vsphere['username'],
:password => vsphere['password'],
:ssl => true,
:insecure => true,
:rev => '5.1'
)
# Connect to Redis # Connect to Redis
$redis = Redis.new $redis = Redis.new
@ -41,7 +31,6 @@ loop do
total = 0 total = 0
# Locate the resource pool # Locate the resource pool
datacenter = $vim.serviceInstance.find_datacenter
base = vsphere_helper.find_pool(pool['pool']) base = vsphere_helper.find_pool(pool['pool'])
# Make sure all VMs in resource pool are accounted-for # Make sure all VMs in resource pool are accounted-for