During install tests, avoid VM being shutdown before PDB can run - #563
During install tests, avoid VM being shutdown before PDB can run#563ydirson wants to merge 2 commits into
Conversation
Makes the management of the temporary ISO self-contained. Signed-off-by: Yann Dirson <yann.dirson@vates.tech>
vm_booted_with_installer fixture would shutdown an host under installation if it fails to boot far enough to be driven by the test (in the fixture setup stage). This changes the exception handling to record the failure, make sure the calling test or fixture must fail, and let the cleanup stage do the shutdown when needed. This changes the fixture signature, which cannot be detected today by type checkers, so the fixture name is changed as well to help devs catch code in pending PRs. Signed-off-by: Yann Dirson <yann.dirson@vates.tech>
|
As discussed earlier, it would be nice if we could avoid yielding |
Is it a request for change, or just a suggestion but then you didn't approve for some reason? |
There was a problem hiding this comment.
I think this change is very useful, but I agree with @glehmann that it might done in a way that is more straight forward.
In particular, having (try_)booting_vm_installer no longer failing when it could not boot gives the wrong impression that this might be expected for some specific tests. As far as I understand this is not the case, but a way to address the valid issue of being able to drop in a PDB before the cleanup is performed when the booting fails.
Instead, we might want to add a defer/request.addFinalizer to booting_vm_installer, i.e remove the try-except-finally statements and use something like this instead:
def cleanup():
if host_vm is not None:
host_vm.shutdown(force=True)
if remote_iso:
host.pool.remove_iso(remote_iso)
defer(cleanup)This should achieve the expected result.
When booting a nested host with an installer ISO, in case of failure to get to the state where we can read it using ssh, we could not inspect the host once
--pdbstopped the test, because the exception was firing from fixture setup code.