From 697c61d3a0e6cdc65f70c86ac7551ba5fbff1b29 Mon Sep 17 00:00:00 2001 From: Zhang Hua Date: Wed, 2 Sep 2026 13:55:07 +0800 Subject: [PATCH] Add encrypted ephemeral storage timeout test Enable encrypted ephemeral storage in the noble-caracal nova-compute bundle and relate nova-compute directly to Vault through its secrets-storage endpoint. Add a NovaCompute functional test that verifies the instance storage fstab entry is vaultlocker-managed and contains an x-systemd.device-timeout value matching the deployed charm configuration. Depends-On: https://review.opendev.org/c/openstack/charm-nova-compute/+/987606 Related-Bug: https://launchpad.net/bugs/2086718 Signed-off-by: Zhang Hua --- zaza/openstack/charm_tests/nova/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zaza/openstack/charm_tests/nova/tests.py b/zaza/openstack/charm_tests/nova/tests.py index 2c0286e4c..6de531b97 100644 --- a/zaza/openstack/charm_tests/nova/tests.py +++ b/zaza/openstack/charm_tests/nova/tests.py @@ -391,6 +391,28 @@ def wait_for_nova_compute_count(expected_count): class NovaCompute(NovaCommonTests): """Run nova-compute specific tests.""" + def test_305_encrypted_ephemeral_fstab_options(self): + """Verify encrypted ephemeral storage has a device timeout.""" + config = zaza.model.get_application_config( + 'nova-compute', model_name=self.model_name) + if not config['encrypt']['value']: + self.skipTest('Encrypted ephemeral storage is not enabled') + + device_timeout = config['encrypt-device-timeout']['value'] + command = ( + "awk '$2 == \"/var/lib/nova/instances\" && " + "$4 ~ /comment=vaultlocker/ && " + "$4 ~ /x-systemd.device-timeout={}s/ {{found = 1}} " + "END {{exit !found}}' /etc/fstab".format(device_timeout)) + for unit in zaza.model.get_units('nova-compute', + model_name=self.model_name): + result = zaza.model.run_on_unit( + unit.entity_id, command, model_name=self.model_name) + self.assertEqual( + int(result['Code']), 0, + 'Missing vaultlocker timeout in /etc/fstab on {}: {}'.format( + unit.entity_id, result['Stderr'])) + def test_311_pci_alias_config_compute(self): """Verify that the pci alias data is rendered properly.