Skip to content

Commit

Permalink
at_dt_iscsi_disk: fix disk_discovery
Browse files Browse the repository at this point in the history
The code found new disks by their target name, e.g.
'vdX'. Those names can change between reboots.

Instead, use function to identify new disks that don't mount the root
file system.

The function raises an error if there is no such disk, so handle that to
confirm that disks are detached correctly.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed Mar 5, 2024
1 parent 4c08c98 commit 1b33ab7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions libvirt/tests/src/virtual_disks/at_dt_iscsi_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from aexpect import ShellError

from avocado.core.exceptions import TestError
from avocado.utils import process

from virttest import virsh
Expand All @@ -16,6 +17,7 @@
from virttest.remote import LoginError
from virttest.virt_vm import VMError
from virttest.utils_test import libvirt
from virttest.utils_libvirt import libvirt_disk
from virttest.libvirt_xml import vm_xml
from virttest.libvirt_xml import pool_xml
from virttest.libvirt_xml.secret_xml import SecretXML
Expand Down Expand Up @@ -386,13 +388,10 @@ def find_attach_disk(expect=True):
# recognize the hotplugged disk on PPC
if on_ppc:
time.sleep(10)
cmd = "grep %s /proc/partitions" % disk_target
s, o = session.cmd_status_output(cmd)
logging.info("%s output: %s", cmd, o)
session.close()
if s == 0:
found_disk = True
except (LoginError, VMError, ShellError) as e:
disk, _ = libvirt_disk.get_non_root_disk_name(session)
logging.debug("Found new disk in VM as %s", disk)
found_disk = True
except (LoginError, VMError, ShellError, TestError) as e:
logging.error(str(e))
if found_disk == expect:
logging.debug("Check disk inside the VM PASS as expected")
Expand Down

0 comments on commit 1b33ab7

Please sign in to comment.