Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/unittests/test_ds_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def call(
"DEBUG_LEVEL=2",
"DI_LOG=stderr",
"PATH_ROOT='%s'" % rootd,
"PATH_DI_ENV='%s/ds-identify-env'" % rootd,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, that's slick!

". " + self.dsid_path,
'DI_DEFAULT_POLICY="%s"' % policy_dmi,
'DI_DEFAULT_POLICY_NO_DMI="%s"' % policy_no_dmi,
Expand Down Expand Up @@ -623,6 +624,10 @@ def test_wb_print_variables(self, tmp_path):
),
# LXD containers will have /dev/lxd/socket at generator time.
pytest.param("LXD", True, id="lxd_containers"),
# MAAS detected despite /dev/lxd/socket existing
pytest.param(
"MAAS-not-LXD", True, id="maas_detected_kernel_cmdline_not_lxd"
),
# ConfigDrive datasource has a disk with LABEL=config-2.
pytest.param("ConfigDrive", True, id="config_drive"),
# Rbx datasource has a disk with LABEL=CLOUDMD.
Expand Down Expand Up @@ -1714,6 +1719,18 @@ def _print_run_output(rc, out, err, cfg, files):
"mocks": [{"name": "is_socket_file", "ret": 1}, MOCK_VIRT_IS_KVM],
"no_mocks": ["dscheck_LXD"], # Don't default mock dscheck_LXD
},
"MAAS-not-LXD": {
"ds": "MAAS",
# /dev/lxd/sock does exist and KVM virt-type
"mocks": [
{"name": "is_socket_file", "ret": 0},
MOCK_VIRT_IS_KVM,
],
"no_mocks": ["dscheck_LXD"], # Don't default mock dscheck_LXD
"files": {
"ds-identify-env": 'DI_KERNEL_CMDLINE="ds=MAAS"',
},
},
"flow_sequence-control": {
"ds": "None",
# /dev/lxd/sock does not exist and KVM virt-type
Expand Down
14 changes: 0 additions & 14 deletions tools/ds-identify
Original file line number Diff line number Diff line change
Expand Up @@ -940,20 +940,6 @@ get_single_line_flow_sequence() {
return 1
}

dscheck_MAAS() {
is_container && return "${DS_NOT_FOUND}"
# heuristic check for ephemeral boot environment
# for maas that do not set 'ci.dsname=' in the ephemeral environment
# these have iscsi root and cloud-config-url on the cmdline.
local maasiqn="iqn.2004-05.com.ubuntu:maas"
case "${DI_KERNEL_CMDLINE}" in
*cloud-config-url=*${maasiqn}*|*${maasiqn}*cloud-config-url=*)
return ${DS_FOUND}
;;
esac
return ${DS_NOT_FOUND}
}

# LXD datasource requires active /dev/lxd/sock
# https://documentation.ubuntu.com/lxd/en/latest/dev-lxd/
dscheck_LXD() {
Expand Down