This patch fixes a few issues noted while enabling the TCK PCI device
hotplug tests.
First, the call to node device dettach function misses parameters, resulting
in the following failure
Failed test 'detached device from host OS'
at /usr/share/libvirt-tck/tests/domain/250-pci-host-hotplug.t line 90.
died: Usage: Sys::Virt::NodeDevice::dettach(dev, driversv, flags=0)
at /usr/share/libvirt-tck/tests/domain/250-pci-host-hotplug.t line 90.
Trivally fixed by adding the missing parameters when calling node device
dettach function.
Second, it appears qemu needs to reach some state of initialization before
host device attach/detach works properly. Currently, the test fails when
detaching the device from the guest, resetting it, and reattaching it to
the host
Failed test 'reset the host PCI device'
at /usr/share/libvirt-tck/tests/domain/250-pci-host-hotplug.t line 110.
died: Sys::Virt::Error (libvirt error code: 1, message: internal error:
Not resetting active device 0000:03:00.1)
Failed test 'reattached device to host OS'
at /usr/share/libvirt-tck/tests/domain/250-pci-host-hotplug.t line 111.
died: Sys::Virt::Error (libvirt error code: 55, message: Requested operation
is not valid: PCI device 0000:03:00.1 is still in use by driver QEMU, domain
tck)
I've found that sleeping for a bit after creating the guest allows the
tests to pass.
While here, also fix a small typo from copy and paste of disk tests.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
scripts/domain/250-pci-host-hotplug.t | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/domain/250-pci-host-hotplug.t
b/scripts/domain/250-pci-host-hotplug.t
index 4579477..e128de7 100644
--- a/scripts/domain/250-pci-host-hotplug.t
+++ b/scripts/domain/250-pci-host-hotplug.t
@@ -52,6 +52,8 @@ my $xml = $tck->generic_domain(name =>
"tck")->as_xml;
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain
object");
+diag "Waiting 10 seconds for guest to initialize";
+sleep(10);
my ($domain, $bus, $slot, $function) = $tck->get_host_pci_device();
@@ -86,7 +88,7 @@ SKIP: {
ok(defined $nodedev, "found PCI device $domain:$bus:$slot.$function on
host");
- lives_ok(sub { $nodedev->dettach() }, "detached device from host OS");
+ lives_ok(sub { $nodedev->dettach(undef, 0) }, "detached device from host
OS");
lives_ok(sub { $nodedev->reset() }, "reset the host PCI device");
my $devxml =
@@ -112,6 +114,6 @@ SKIP: {
my $finalxml = $dom->get_xml_description;
- is($initialxml, $finalxml, "final XML has removed the disk")
+ is($initialxml, $finalxml, "final XML has removed the PCI device")
}
--
1.8.4.5