On 10/07/13 16:19, Laine Stump wrote:
On 10/04/2013 08:55 AM, Peter Krempa wrote:
> Prefer using VFIO (if available) to the legacy KVM device passthrough.
>
> With this patch a PCI passthrough device without the driver configured
> will be started with VFIO if it's available on the host. If not legacy
> KVM passthrough is checked and error is reported if it's not available.
> ---
> docs/formatdomain.html.in | 9 ++++-----
> src/conf/domain_conf.h | 2 +-
> src/qemu/qemu_command.c | 3 ++-
> src/qemu/qemu_hostdev.c | 21 +++++++++++++++++++--
> src/qemu/qemu_hostdev.h | 3 ++-
> src/qemu/qemu_hotplug.c | 2 +-
> src/qemu/qemu_process.c | 15 ++++++++-------
> tests/qemuxml2argvtest.c | 11 +++++++++++
> 8 files changed, 48 insertions(+), 18 deletions(-)
...
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 38319e5..6fe8c6a 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -98,6 +98,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
> virConnectPtr conn;
> char *log = NULL;
> virCommandPtr cmd = NULL;
> + size_t i;
>
> if (!(conn = virGetConnect()))
> goto out;
> @@ -154,6 +155,16 @@ static int testCompareXMLToArgvFiles(const char *xml,
> if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
> goto out;
>
> + for (i = 0; i < vmdef->nhostdevs; i++) {
> + virDomainHostdevDefPtr hostdev = vmdef->hostdevs[i];
> +
> + if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> + hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI
&&
> + hostdev->source.subsys.u.pci.backend ==
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
> + hostdev->source.subsys.u.pci.backend =
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
> + }
> + }
> +
I'm in too much of a rush to read the code and understand why you're
changing this unconditionally for the test. Can you just comment on what
you're doing to save me the time?
We can't call the detection code in the test suite as we could get
different results on different environments. This just "simulates" that
legacy passthrough was selected instead of leaving the default so that:
a) the command line generator doesn't error out as it now won't work
with _DEFAULT
b) the test results won't have to be changed to cope with a change to VFIO.
> if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
> (flags & FLAG_JSON), extraFlags,
> migrateFrom, migrateFd, NULL,
Peter