default_max_wait_for_shutdown = 600
default_max_wait_for_finish_install = 60 * 60
default_max_nr_templates_stay = 4
- default_vmware_cfg_version = 'vmx-14'
- default_os_version = 'oracleLinux7_64Guest'
+ default_vmware_cfg_version = 'vmx-15'
+ default_os_version = 'centos8_64Guest'
min_max_wait_for_finish_general = 2
min_max_wait_for_finish_install = 3 * 60
max_max_wait_for_finish_general = 60 * 60
import pytz
import paramiko
+from pyVmomi import vim
+
# Own modules
from fb_tools.common import pp, to_str
from .xlate import XLATOR
-__version__ = '1.5.3'
+__version__ = '1.5.4'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
self.tpl_network = None
self.tpl_vm = None
self.tpl_vm_hostname = None
+ self.tpl_macaddress = None
self.ts_start_install = None
self.ts_finish_install = None
self.initial_sleep = 60
else:
self.create_vm()
self.tpl_vm = self.vsphere.get_vm(self.tpl_vm_fqdn, as_vmw_obj=True)
- if not self.tpl_vm:
+ if self.tpl_vm:
+ LOG.debug(_("Created VM as {cls}: {vm!r}").format(
+ cls=self.tpl_vm.__class__.__name__, vm=self.tpl_vm))
+ for device in self.tpl_vm.config.hardware.device:
+ if isinstance(device, vim.vm.device.VirtualEthernetCard):
+ self.tpl_macaddress = device.macAddress
+ LOG.debug(_("Found Ethernet card as {}.").format(
+ device.__class__.__name__))
+ if self.verbose > 2:
+ LOG.debug(_("Found Ethernet card:") + "\n{}".format(device))
+ if not self.tpl_macaddress:
+ msg = _("Did not found MAC address of ethernet card.")
+ raise HandlerError(msg)
+ else:
if self.simulate:
LOG.warn(_("Simulation mode - VM not created in real."))
+ self.tpl_macaddress = self.config.default_mac_address
else:
raise HandlerError(_("Could not find VM after creating."))
+ LOG.info(_("Using MAC address of template VM: {!r}").format(self.tpl_macaddress))
+
# self.vsphere.poweron_vm(self.tpl_vm, max_wait=self.config.max_wait_for_poweron_vm)
# self.ts_start_install = time.time()
# self.wait_for_finish_install()