from .config import CrTplConfiguration
-__version__ = '0.4.3'
+__version__ = '0.4.4'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
self.tpl_data_store = None
self.tpl_network = None
self.tpl_cluster = None
+ self.tpl_vm = None
if initialized:
self.initialized = True
self.select_data_store()
self.check_network()
self.create_vm()
+ self.tpl_vm = self.get_temp_tpl_vm()
+ if not self.tpl_vm:
+ raise HandlerError(
+ "Could not find VM after creating.")
+ self.poweron_vm()
finally:
LOG.debug("Disconnecting from vSphere host {h}:{p} ...".format(
h=self.config.vsphere_host, p=self.config.vsphere_port))
if vm:
return vm
+ return None
+
# -------------------------------------------------------------------------
def _get_temp_tpl_vm(self, child, depth=1):
self.wait_for_tasks([task])
+ # -------------------------------------------------------------------------
+ def poweron_vm(self):
+
+ LOG.info("Powering on VM {!r} ...".format(self.config.template_vm))
+
+ task = self.tpl_vm.PowerOnVM_Task()
+ self.wait_for_tasks([task])
+ LOG.debug("VM {!r} successful powered on.".format(self.config.template_vm))
+
# =============================================================================