summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-02-24 15:13:15 -0500
committerScott Moser <smoser@brickies.net>2017-02-24 22:51:32 -0500
commit83606aecaae571ce8eb7d6499de028192d82f79b (patch)
treeaaad59a4c1ad8c857da67a79372fad939b9bcb2c /tools
parent5dd5b2cb539a84ed59f2b3181020d2bd18989718 (diff)
downloadvyos-cloud-init-83606aecaae571ce8eb7d6499de028192d82f79b.tar.gz
vyos-cloud-init-83606aecaae571ce8eb7d6499de028192d82f79b.zip
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
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ds-identify35
1 files changed, 35 insertions, 0 deletions
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