From 83606aecaae571ce8eb7d6499de028192d82f79b Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 24 Feb 2017 15:13:15 -0500 Subject: tools/ds-identify: ovf identify vmware guest customization. cloud-init by default sets 'disable_vmware_customization' to True. So in ds-identify, we will enable the ovf datasource if: - virt is vmware - 'libdeployPkgPlugin.so' exists as installed by vmware-tools or open-vm-tools. - disable_vmware_customization is configured to True --- tools/ds-identify | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tools/ds-identify') diff --git a/tools/ds-identify b/tools/ds-identify index c39956fc..34bf0643 100755 --- a/tools/ds-identify +++ b/tools/ds-identify @@ -559,10 +559,45 @@ dscheck_OpenNebula() { return ${DS_NOT_FOUND} } +ovf_vmware_guest_customization() { + # vmware guest customization + + # virt provider must be vmware + [ "${DI_VIRT}" = "vmware" ] || return 1 + + # we have to have the plugin to do vmware customization + local found="" pkg="" pre="/usr/lib" + for pkg in vmware-tools open-vm-tools; do + if [ -f "$pre/$pkg/plugins/vmsvc/libdeployPkgPlugin.so" ]; then + found="$pkg"; break; + fi + done + [ -n "$found" ] || return 1 + + # disable_vmware_customization defaults to False. + # any value then other than false means disabled. + local key="disable_vmware_customization" + local match="" bp="${PATH_CLOUD_CONFD}/cloud.cfg" + match="$bp.d/*[Oo][Vv][Ff]*.cfg" + if check_config "$key" "$match"; then + debug 2 "${_RET_fname} set $key to $_RET" + case "$_RET" in + 0|false|False) return 0;; + *) return;; + esac + fi + + return 1 +} + dscheck_OVF() { local p="" check_seed_dir ovf ovf-env.xml && return "${DS_FOUND}" + if ovf_vmware_guest_customization; then + return ${DS_FOUND} + fi + has_cdrom || return ${DS_NOT_FOUND} # FIXME: currently just return maybe if there is a cdrom -- cgit v1.2.3