Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround VM first start failure due to swtpm #5946

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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: 14 additions & 3 deletions libvirt/tests/src/virtual_device/tpm_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,14 @@ def reuse_by_vm2(tpm_dev):
return
test.fail("Reuse a passthroughed tpm should not succeed.")
elif ret.exit_status:
# emulator backend
test.fail("Vtpm for each guest should not interfere with each other")
# workaround VM first start failure due to swtpm
swtpm_error_msg = "internal error: Could not run '/usr/bin/swtpm_setup'"
output = ret.stdout_text + ret.stderr_text
if re.search(r'%s' % swtpm_error_msg, output):
virsh.start(vm2_name, ignore_status=True, debug=True)
else:
# emulator backend
test.fail("Vtpm for each guest should not interfere with each other")

def save_modify_pcrbank(vm_name, active_pcr_banks, pcrbank_change):
"""
Expand Down Expand Up @@ -843,7 +849,12 @@ def check_swtpmpidfile(vm_name, test_stage):
logging.debug("Expected failure: %s", detail)
return
else:
test.fail(detail)
# workaround VM first start failure due to swtpm
swtpm_error_msg = "internal error: Could not run '/usr/bin/swtpm_setup'"
if re.search(r'%s' % swtpm_error_msg, str(detail)):
vm.start()
else:
test.fail(detail)
if undefine_flag:
time.sleep(5)
vm.destroy()
Expand Down
Loading