canonical/pycloudlib

Qemu image times out when using config-defined working_dir

Opened this issue · 0 comments

When specifying a working_dir for the new qemu provider, I get the following failure. However if the working_dir points to a tmpfs (/run/, /tmp/), it succeeds. I think that this is because startup time when reading the qcow image from disk is much slower than from a tmpfs (RAM).

We may want to bump up the timeout value from 10s, or at least include a note in the template config about the risks of using a disk-backed filesystem for working_dir.

_____ ERROR at setup of TestVarLogCloudInitOutput.test_var_log_cloud_init_output_not_world_readable ______

request = <SubRequest 'client' for <Function test_var_log_cloud_init_output_not_world_readable>>
fixture_utils = <class 'conftest._FixtureUtils'>
session_cloud = <tests.integration_tests.clouds.QemuCloud object at 0x7fa7f25dc0d0>, setup_image = None

    @pytest.fixture
    def client(
        request, fixture_utils, session_cloud, setup_image
    ) -> Iterator[IntegrationInstance]:
        """Provide a client that runs for every test."""
>       with _client(request, fixture_utils, session_cloud) as client:

tests/integration_tests/conftest.py:280: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.11/contextlib.py:137: in __enter__
    return next(self.gen)
tests/integration_tests/conftest.py:260: in _client
    with session_cloud.launch(
tests/integration_tests/clouds.py:151: in launch
    pycloudlib_instance = self._perform_launch(
tests/integration_tests/clouds.py:107: in _perform_launch
    self._maybe_wait(pycloudlib_instance, wait)
tests/integration_tests/clouds.py:98: in _maybe_wait
    pycloudlib_instance.wait()
.tox/integration-tests/lib/python3.11/site-packages/pycloudlib/instance.py:169: in wait
    self._wait_for_instance_start(**kwargs)
.tox/integration-tests/lib/python3.11/site-packages/pycloudlib/qemu/instance.py:213: in _wait_for_instance_start
    self.wait_till_status("running")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pycloudlib.qemu.instance.QemuInstance object at 0x7fa7f25ec090>, expected_status = 'running'
timeout = 500

    def wait_till_status(self, expected_status: str, timeout: int = 500):
        """Wait for instance to reach a certain status.
    
        Args:
            status: status to wait for
            timeout: timeout in seconds
        """
        if not self.qmp:
>           raise MissingPrerequisiteError("No QMP connection")
E           pycloudlib.errors.MissingPrerequisiteError: No QMP connection

.tox/integration-tests/lib/python3.11/site-packages/pycloudlib/qemu/instance.py:236: MissingPrerequisiteError