From 0f187dd7035ac724912ea5c877f6bff1bea6fe57 Mon Sep 17 00:00:00 2001 From: Sankar Tanguturi Date: Sun, 20 Mar 2016 19:49:53 -0700 Subject: 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. --- cloudinit/sources/DataSourceOVF.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'cloudinit/sources') diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py index 5734d233..fc12cbb4 100644 --- a/cloudinit/sources/DataSourceOVF.py +++ b/cloudinit/sources/DataSourceOVF.py @@ -75,7 +75,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): @@ -88,7 +95,8 @@ class DataSourceOVF(sources.DataSource): 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" % @@ -134,12 +142,6 @@ class DataSourceOVF(sources.DataSource): 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) else: np = {'iso': transport_iso9660, 'vmware-guestd': transport_vmware_guestd, } -- cgit v1.2.3 From b21c2b4326f501032e06b3f85236ced1efa0b309 Mon Sep 17 00:00:00 2001 From: Sankar Tanguturi Date: Tue, 22 Mar 2016 15:35:13 -0700 Subject: Fixed few other misc issues. Enabled NICS even in failure case. Used util.del_dir() instead of shutil.rmtree. --- cloudinit/sources/DataSourceOVF.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cloudinit/sources') diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py index fc12cbb4..ccdd4fd0 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 @@ -120,10 +119,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") @@ -135,13 +134,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) + enable_nics(nics) else: np = {'iso': transport_iso9660, 'vmware-guestd': transport_vmware_guestd, } -- cgit v1.2.3 From 4e3ec3a040adf1e5a44aafa1f7276fe83c3329ad Mon Sep 17 00:00:00 2001 From: Sankar Tanguturi Date: Tue, 29 Mar 2016 11:38:47 -0700 Subject: Added a comment about /var/run/vmware-imc directory. --- cloudinit/sources/DataSourceOVF.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cloudinit/sources') diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py index ccdd4fd0..2a6cd050 100644 --- a/cloudinit/sources/DataSourceOVF.py +++ b/cloudinit/sources/DataSourceOVF.py @@ -91,6 +91,10 @@ 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", -- cgit v1.2.3