mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
Don't try to detach & reset PCI devices while running test suite for XML-> ARGV conversion.
This commit is contained in:
parent
1ca2bd7912
commit
8f1912c58d
@ -1,3 +1,12 @@
|
|||||||
|
Tue Mar 3 08:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
Don't try to detach & reset PCI devices while running test
|
||||||
|
suite for XML-> ARGV conversion.
|
||||||
|
* src/qemu_driver.c: Add qemuPrepareHostDevices() helper to
|
||||||
|
detach and reset PCI devices.
|
||||||
|
* src/qemu_conf.c: Don't detach & reset PCI devices while
|
||||||
|
building the command line argv
|
||||||
|
|
||||||
Tue Mar 3 09:24:13 CET 2009 Daniel Veillard <veillard@redhat.com>
|
Tue Mar 3 09:24:13 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* qemud/qemud.c: fix qemu+tls handshake negotiation, patch by
|
* qemud/qemud.c: fix qemu+tls handshake negotiation, patch by
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
#include "nodeinfo.h"
|
#include "nodeinfo.h"
|
||||||
#include "pci.h"
|
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||||
|
|
||||||
@ -1395,52 +1394,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
ADD_ARG_LIT("-pcidevice");
|
ADD_ARG_LIT("-pcidevice");
|
||||||
ADD_ARG_LIT(pcidev);
|
ADD_ARG_LIT(pcidev);
|
||||||
VIR_FREE(pcidev);
|
VIR_FREE(pcidev);
|
||||||
|
|
||||||
if (hostdev->managed) {
|
|
||||||
pciDevice *dev = pciGetDevice(conn,
|
|
||||||
hostdev->source.subsys.u.pci.domain,
|
|
||||||
hostdev->source.subsys.u.pci.bus,
|
|
||||||
hostdev->source.subsys.u.pci.slot,
|
|
||||||
hostdev->source.subsys.u.pci.function);
|
|
||||||
if (!dev)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (pciDettachDevice(conn, dev) < 0) {
|
|
||||||
pciFreeDevice(conn, dev);
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pciFreeDevice(conn, dev);
|
|
||||||
} /* else {
|
|
||||||
XXX validate that non-managed device isn't in use, eg
|
|
||||||
by checking that device is either un-bound, or bound
|
|
||||||
to pci-stub.ko
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that all the PCI hostdevs have be dettached, we can reset them */
|
|
||||||
for (i = 0 ; i < vm->def->nhostdevs ; i++) {
|
|
||||||
virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
|
|
||||||
pciDevice *dev;
|
|
||||||
|
|
||||||
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
|
||||||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
dev = pciGetDevice(conn,
|
|
||||||
hostdev->source.subsys.u.pci.domain,
|
|
||||||
hostdev->source.subsys.u.pci.bus,
|
|
||||||
hostdev->source.subsys.u.pci.slot,
|
|
||||||
hostdev->source.subsys.u.pci.function);
|
|
||||||
if (!dev)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (pciResetDevice(conn, dev) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
pciFreeDevice(conn, dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (migrateFrom) {
|
if (migrateFrom) {
|
||||||
|
@ -1133,6 +1133,79 @@ static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qemuPrepareHostDevices(virConnectPtr conn,
|
||||||
|
virDomainDefPtr def) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* We have to use 2 loops here. *All* devices must
|
||||||
|
* be detached before we reset any of them, because
|
||||||
|
* in some cases you have to reset the whole PCI,
|
||||||
|
* which impacts all devices on it
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (i = 0 ; i < def->nhostdevs ; i++) {
|
||||||
|
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||||
|
|
||||||
|
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
||||||
|
continue;
|
||||||
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!hostdev->managed) {
|
||||||
|
pciDevice *dev = pciGetDevice(conn,
|
||||||
|
hostdev->source.subsys.u.pci.domain,
|
||||||
|
hostdev->source.subsys.u.pci.bus,
|
||||||
|
hostdev->source.subsys.u.pci.slot,
|
||||||
|
hostdev->source.subsys.u.pci.function);
|
||||||
|
if (!dev)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (pciDettachDevice(conn, dev) < 0) {
|
||||||
|
pciFreeDevice(conn, dev);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
pciFreeDevice(conn, dev);
|
||||||
|
} /* else {
|
||||||
|
XXX validate that non-managed device isn't in use, eg
|
||||||
|
by checking that device is either un-bound, or bound
|
||||||
|
to pci-stub.ko
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now that all the PCI hostdevs have be dettached, we can safely
|
||||||
|
* reset them */
|
||||||
|
for (i = 0 ; i < def->nhostdevs ; i++) {
|
||||||
|
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||||
|
pciDevice *dev;
|
||||||
|
|
||||||
|
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
||||||
|
continue;
|
||||||
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dev = pciGetDevice(conn,
|
||||||
|
hostdev->source.subsys.u.pci.domain,
|
||||||
|
hostdev->source.subsys.u.pci.bus,
|
||||||
|
hostdev->source.subsys.u.pci.slot,
|
||||||
|
hostdev->source.subsys.u.pci.function);
|
||||||
|
if (!dev)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (pciResetDevice(conn, dev) < 0) {
|
||||||
|
pciFreeDevice(conn, dev);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
pciFreeDevice(conn, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
|
static virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
@ -1210,6 +1283,9 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
vm->def->id = driver->nextvmid++;
|
vm->def->id = driver->nextvmid++;
|
||||||
if (qemudBuildCommandLine(conn, driver, vm,
|
if (qemudBuildCommandLine(conn, driver, vm,
|
||||||
qemuCmdFlags, &argv, &progenv,
|
qemuCmdFlags, &argv, &progenv,
|
||||||
|
Loading…
Reference in New Issue
Block a user