Skip to content

Commit

Permalink
Catch libvirt error during disks teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
lalon4 committed Jul 15, 2021
1 parent d25df08 commit 865e02b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion discovery-infra/tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import shutil
import libvirt
from typing import Callable
from contextlib import suppress
from pathlib import Path
Expand Down Expand Up @@ -187,7 +188,11 @@ def attach(node, disk_size, bootable=False, with_wwn=False):
yield attach
if global_variables.test_teardown:
for modified_node in modified_nodes:
modified_node.detach_all_test_disks()
try:
modified_node.detach_all_test_disks()
logging.info(f'Successfully detach test disks from node {modified_node.name}')
except (libvirt.libvirtError, FileNotFoundError):
logging.warning(f'Failed to detach test disks from node {modified_node.name}')

@pytest.fixture(scope="function")
def attach_disk(self):
Expand Down

0 comments on commit 865e02b

Please sign in to comment.