From: Frank Brehm Date: Thu, 12 Apr 2018 10:26:56 +0000 (+0200) Subject: Adding boot delay, changing debug output X-Git-Tag: 0.1.1~40 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=a76f79282c7c5539a7b8ed2d5da10c93c48d0b34;p=pixelpark%2Fcreate-vmware-tpl.git Adding boot delay, changing debug output --- diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index bd413da..ef3bdb4 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -29,7 +29,7 @@ from pyVmomi import vim, vmodl from pyVim.connect import SmartConnect, Disconnect # Own modules -from .common import pp +from .common import pp, to_str from .errors import FunctionNotImplementedError, PpError @@ -37,7 +37,7 @@ from .obj import PpBaseObject from .config import CrTplConfiguration -__version__ = '0.6.3' +__version__ = '0.6.4' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -582,14 +582,21 @@ class CrTplHandler(PpBaseObject): created_opt.value = int(time.time()) extra_opts.append(created_opt) + # Set waiting for 3 second in BIOS before booting + boot_opts = vim.vm.BootOptions() + boot_opts.bootDelay = 3000 + boot_opts.bootRetryEnabled = False + boot_opts.enterBIOSSetup = False + config = vim.vm.ConfigSpec( name=self.config.template_vm, deviceChange=dev_changes, flags=vm_flags, extraConfig=extra_opts, memoryMB=self.config.ram_mb, memoryHotAddEnabled=True, numCPUs=self.config.num_cpus, cpuHotAddEnabled=True, cpuHotRemoveEnabled=True, files=vm_file_info, - guestId = 'oracleLinux64Guest', - version = 'vmx-11', + guestId='oracleLinux64Guest', + version='vmx-11', + bootOptions=boot_opts, #guestFullName='Oracle Enterprise Linux 7 (64 Bit)', #alternateGuestName='OEL 7/64', ) @@ -668,15 +675,16 @@ class CrTplHandler(PpBaseObject): cur_time = time.time() cur_duration = cur_time - self.ts_start_install if (cur_time - last_dot) >= self.interval_dot: - print('.', end='', flush=True) - i += 1 - if i >= 60: - print('', flush=True) - print(' ', end='', flush=True) - i = 0 - last_dot = cur_time + if self.verbose < 3: + print('.', end='', flush=True) + i += 1 + if i >= 60: + print('', flush=True) + print(' ', end='', flush=True) + i = 0 + last_dot = cur_time - if self.verbose > 2: + if self.verbose > 3: LOG.debug("Trying to connect to {a} via TCP port {p} ...".format( a=sockaddr[0], p=sockaddr[1])) @@ -692,7 +700,7 @@ class CrTplHandler(PpBaseObject): except socket.error as e: sock.close() sock = None - if self.verbose > 2: + if self.verbose > 3: LOG.debug("Could not connect: {}".format(e)) continue