diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-29 16:28:39 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-29 16:28:39 -0400 |
commit | 210b041b2fead7a57af91f60a6f89d9e5aa1ed4a (patch) | |
tree | 3651e7281d959879c6dd4923569cbaba1a2783f0 /cloudinit | |
parent | f6ad06d80aecadcd6d009111d14b6056a9545bd2 (diff) | |
parent | 4e3ec3a040adf1e5a44aafa1f7276fe83c3329ad (diff) | |
download | vyos-cloud-init-210b041b2fead7a57af91f60a6f89d9e5aa1ed4a.tar.gz vyos-cloud-init-210b041b2fead7a57af91f60a6f89d9e5aa1ed4a.zip |
Misc fixes for VMware Support.
- Modified the code to look for customization specification file in
/var/run/vmware-imc/ directory instead of /tmp
- Fixed the 'seed file' issue. There was a regression in DataSourceOVF.py
file. Fixed it.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/sources/DataSourceOVF.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py index 5734d233..2a6cd050 100644 --- a/cloudinit/sources/DataSourceOVF.py +++ b/cloudinit/sources/DataSourceOVF.py @@ -24,7 +24,6 @@ from xml.dom import minidom import base64 import os -import shutil import re import time @@ -75,7 +74,14 @@ class DataSourceOVF(sources.DataSource): system_type = util.read_dmi_data("system-product-name") if system_type is None: LOG.debug("No system-product-name found") - elif 'vmware' in system_type.lower(): + + if seedfile: + # Found a seed dir + seed = os.path.join(self.paths.seed_dir, seedfile) + (md, ud, cfg) = read_ovf_environment(contents) + self.environment = contents + found.append(seed) + elif system_type and 'vmware' in system_type.lower(): LOG.debug("VMware Virtualization Platform found") if not util.get_cfg_option_bool( self.sys_cfg, "disable_vmware_customization", True): @@ -85,10 +91,15 @@ class DataSourceOVF(sources.DataSource): deployPkgPluginPath = search_file("/usr/lib/open-vm-tools", "libdeployPkgPlugin.so") if deployPkgPluginPath: + # When the VM is powered on, the "VMware Tools" daemon + # copies the customization specification file to + # /var/run/vmware-imc directory. cloud-init code needs + # to search for the file in that directory. vmwareImcConfigFilePath = util.log_time( logfunc=LOG.debug, msg="waiting for configuration file", - func=wait_for_imc_cfg_file, args=("/tmp", "cust.cfg")) + func=wait_for_imc_cfg_file, + args=("/var/run/vmware-imc", "cust.cfg")) if vmwareImcConfigFilePath: LOG.debug("Found VMware DeployPkg Config File at %s" % @@ -112,10 +123,10 @@ class DataSourceOVF(sources.DataSource): set_customization_status( GuestCustStateEnum.GUESTCUST_STATE_RUNNING, GuestCustEventEnum.GUESTCUST_EVENT_CUSTOMIZE_FAILED) + enable_nics(nics) return False finally: - dirPath = os.path.dirname(vmwareImcConfigFilePath) - shutil.rmtree(dirPath) + util.del_dir(os.path.dirname(vmwareImcConfigFilePath)) try: LOG.debug("Applying the Network customization") @@ -127,19 +138,14 @@ class DataSourceOVF(sources.DataSource): set_customization_status( GuestCustStateEnum.GUESTCUST_STATE_RUNNING, GuestCustEventEnum.GUESTCUST_EVENT_NETWORK_SETUP_FAILED) + enable_nics(nics) return False vmwarePlatformFound = True - enable_nics(nics) set_customization_status( GuestCustStateEnum.GUESTCUST_STATE_DONE, GuestCustErrorEnum.GUESTCUST_ERROR_SUCCESS) - elif seedfile: - # Found a seed dir - seed = os.path.join(self.paths.seed_dir, seedfile) - (md, ud, cfg) = read_ovf_environment(contents) - self.environment = contents - found.append(seed) + enable_nics(nics) else: np = {'iso': transport_iso9660, 'vmware-guestd': transport_vmware_guestd, } |