B #2262 (vCenter) wait poweron/off to be performed

This commit is contained in:
joseangelgm authored and Tino Vázquez committed 2018-07-23 17:05:11 +02:00
1 parent 53e4d999f3
commit ceb98e3efe
3 files changed
+2 -13

No files matched your search

@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
require 'openssl'
require 'yaml'
@@ -48,7 +47,7 @@ class VIClient
end
def load_vcenter_configuration
vcenter_conf = YAML::load(File.open("/etc/one/vcenter_driver.conf"))
vcenter_conf = YAML::load(File.open("#{ETC_LOCATION}/vcenter_driver.conf"))
vcenter_conf
end
@@ -1483,6 +1483,7 @@ class VirtualMachine < Template
return self['_ref']
end
#The exception will be handle outside this method
def wait_deploy_timeout
timeout_deploy = @vi_client.get_property_vcenter_conf(:vm_poweron_wait_default)
time_start = Time.now
@@ -92,15 +92,4 @@ def check_item(item, target_class)
rescue RbVmomi::Fault => e
raise "Reference \"#{item._ref}\" error [#{e.message}]. The reference does not exist"
end
end
def wait_deploy_timeout(vm, timeout_deploy = 300)
time_start = Time.now
begin
time_running = Time.now - time_start
raise 'reached deploy timeout' if time_running.to_i >= timeout_deploy
sleep(2)
state = vm.item.summary.runtime.powerState
end until(state == "poweredOn")
end