From 6491ca9208885269ece836d3ce81757bd91f00c9 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 6 Feb 2015 13:39:45 +0100 Subject: [PATCH] Feature #3383: Add automatic deploy for importing running vcenter VMs --- src/cli/onevcenter | 9 +++++++++ src/vmm_mad/remotes/vcenter/vcenter_driver.rb | 1 + 2 files changed, 10 insertions(+) diff --git a/src/cli/onevcenter b/src/cli/onevcenter index f6e0e4255d..2d9604edd3 100755 --- a/src/cli/onevcenter +++ b/src/cli/onevcenter @@ -272,6 +272,15 @@ cmd=CommandParser::CmdParser.new(ARGV) do rc = one_v.allocate(v[:one]) + if ::OpenNebula.is_error?(rc) + STDOUT.puts " Error creating Virtual Machine: "\ + "#{rc.message}\n" + end + + host_id = OpenNebulaHelper.rname_to_id(v[:host], "HOST") + + rc = one_v.deploy host_id + if ::OpenNebula.is_error?(rc) STDOUT.puts " Error creating Virtual Machine: "\ "#{rc.message}\n" diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb index 884d222e38..3688b1e8a7 100644 --- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb +++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb @@ -271,6 +271,7 @@ class VIClient tmp = vms.select { |v| # Get rid of VM Templates and VMs not in running state + v.config && v.config.template != true && v.summary.runtime.powerState == "poweredOn" }