summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-05-15 13:38:20 -0400
committerScott Moser <smoser@brickies.net>2018-05-15 13:38:20 -0400
commit0d7ee5592621d09699d079945ffd6febf16669b2 (patch)
treef768984325f51e7581e64ab85ead14e84ca2f766 /tools
parentd5374bba2f1b4607a773ebff00e1ee7d66e23033 (diff)
downloadvyos-cloud-init-0d7ee5592621d09699d079945ffd6febf16669b2.tar.gz
vyos-cloud-init-0d7ee5592621d09699d079945ffd6febf16669b2.zip
ds-identify: recognize container-other as a container, test SmartOS.
In playing with a SmartOS container I found that ds-identify did not identify the container there as a container. Systemd-detect-virt identifies it as 'container-other'. Also here are tests for ds-identify for the SmartOS platform identification, and some indentation fixes in ds-identify.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ds-identify12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/ds-identify b/tools/ds-identify
index 435a5bcb..dc7ac3a7 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -261,7 +261,7 @@ read_virt() {
is_container() {
case "${DI_VIRT}" in
- lxc|lxc-libvirt|systemd-nspawn|docker|rkt) return 0;;
+ container-other|lxc|lxc-libvirt|systemd-nspawn|docker|rkt) return 0;;
*) return 1;;
esac
}
@@ -990,12 +990,14 @@ dscheck_SmartOS() {
# joyent cloud has two virt types: kvm and container
# on kvm, product name on joyent public cloud shows 'SmartDC HVM'
# on the container platform, uname's version has: BrandZ virtual linux
+ # for container, we also verify that the socketfile exists to protect
+ # against embedded containers (lxd running on brandz)
local smartdc_kver="BrandZ virtual linux"
+ local metadata_sockfile="${PATH_ROOT}/native/.zonecontrol/metadata.sock"
dmi_product_name_matches "SmartDC*" && return $DS_FOUND
- if [ "${DI_UNAME_KERNEL_VERSION}" = "${smartdc_kver}" ] &&
- [ "${DI_VIRT}" = "container-other" ]; then
- return ${DS_FOUND}
- fi
+ [ "${DI_UNAME_KERNEL_VERSION}" = "${smartdc_kver}" ] &&
+ [ -e "${metadata_sockfile}" ] &&
+ return ${DS_FOUND}
return ${DS_NOT_FOUND}
}