2009-06-11 22:17:42 +08:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef WITH_QEMU
|
|
|
|
|
2010-03-10 02:22:22 +08:00
|
|
|
# include <stdio.h>
|
|
|
|
# include <stdlib.h>
|
2009-06-11 22:17:42 +08:00
|
|
|
|
2010-03-10 02:22:22 +08:00
|
|
|
# include "testutils.h"
|
2010-12-18 00:41:51 +08:00
|
|
|
# include "qemu/qemu_capabilities.h"
|
2011-01-14 00:09:15 +08:00
|
|
|
# include "memory.h"
|
2009-06-11 22:17:42 +08:00
|
|
|
|
2010-03-10 02:22:22 +08:00
|
|
|
# define MAX_HELP_OUTPUT_SIZE 1024*64
|
2009-06-11 22:17:42 +08:00
|
|
|
|
|
|
|
struct testInfo {
|
|
|
|
const char *name;
|
2010-02-09 21:06:56 +08:00
|
|
|
unsigned long long flags;
|
|
|
|
unsigned int version;
|
|
|
|
unsigned int is_kvm;
|
|
|
|
unsigned int kvm_version;
|
2009-06-11 22:17:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static char *progname;
|
|
|
|
static char *abs_srcdir;
|
|
|
|
|
2010-05-13 11:07:00 +08:00
|
|
|
static void printMismatchedFlags(unsigned long long got,
|
|
|
|
unsigned long long expect)
|
2009-12-22 04:36:32 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2010-05-13 11:07:00 +08:00
|
|
|
for (i = 0 ; i < (sizeof(got)*CHAR_BIT) ; i++) {
|
|
|
|
unsigned long long gotFlag = (got & (1LL << i));
|
|
|
|
unsigned long long expectFlag = (expect & (1LL << i));
|
2009-12-22 04:36:32 +08:00
|
|
|
if (gotFlag && !expectFlag)
|
|
|
|
fprintf(stderr, "Extra flag %i\n", i);
|
|
|
|
if (!gotFlag && expectFlag)
|
|
|
|
fprintf(stderr, "Missing flag %i\n", i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-11 22:17:42 +08:00
|
|
|
static int testHelpStrParsing(const void *data)
|
|
|
|
{
|
|
|
|
const struct testInfo *info = data;
|
2011-01-14 00:09:15 +08:00
|
|
|
char *path = NULL;
|
2009-06-11 22:17:42 +08:00
|
|
|
char helpStr[MAX_HELP_OUTPUT_SIZE];
|
|
|
|
char *help = &(helpStr[0]);
|
2010-02-09 21:06:56 +08:00
|
|
|
unsigned int version, is_kvm, kvm_version;
|
|
|
|
unsigned long long flags;
|
2011-01-14 00:09:15 +08:00
|
|
|
int ret = -1;
|
2009-06-11 22:17:42 +08:00
|
|
|
|
2011-01-14 00:09:15 +08:00
|
|
|
if (virAsprintf(&path, "%s/qemuhelpdata/%s", abs_srcdir, info->name) < 0)
|
|
|
|
return -1;
|
2009-06-11 22:17:42 +08:00
|
|
|
|
|
|
|
if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
2009-06-11 22:17:42 +08:00
|
|
|
|
2010-12-18 00:41:51 +08:00
|
|
|
if (qemuCapsParseHelpStr("QEMU", help, &flags,
|
|
|
|
&version, &is_kvm, &kvm_version) == -1)
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (info->flags & QEMUD_CMD_FLAG_DEVICE) {
|
|
|
|
VIR_FREE(path);
|
|
|
|
if (virAsprintf(&path, "%s/qemuhelpdata/%s-device", abs_srcdir,
|
|
|
|
info->name) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (qemuCapsParseDeviceStr(help, &flags) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2009-06-11 22:17:42 +08:00
|
|
|
|
|
|
|
if (flags != info->flags) {
|
2011-01-14 00:09:15 +08:00
|
|
|
fprintf(stderr,
|
|
|
|
"Computed flags do not match: got 0x%llx, expected 0x%llx\n",
|
2009-06-11 22:17:42 +08:00
|
|
|
flags, info->flags);
|
2009-12-22 04:36:32 +08:00
|
|
|
|
|
|
|
if (getenv("VIR_TEST_DEBUG"))
|
|
|
|
printMismatchedFlags(flags, info->flags);
|
|
|
|
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
2009-06-11 22:17:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (version != info->version) {
|
|
|
|
fprintf(stderr, "Parsed versions do not match: got %u, expected %u\n",
|
|
|
|
version, info->version);
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
2009-06-11 22:17:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_kvm != info->is_kvm) {
|
2011-01-14 00:09:15 +08:00
|
|
|
fprintf(stderr,
|
|
|
|
"Parsed is_kvm flag does not match: got %u, expected %u\n",
|
2009-06-11 22:17:42 +08:00
|
|
|
is_kvm, info->is_kvm);
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
2009-06-11 22:17:42 +08:00
|
|
|
}
|
|
|
|
|
2009-12-22 04:36:32 +08:00
|
|
|
if (kvm_version != info->kvm_version) {
|
2011-01-14 00:09:15 +08:00
|
|
|
fprintf(stderr,
|
|
|
|
"Parsed KVM versions do not match: got %u, expected %u\n",
|
2009-12-22 04:36:32 +08:00
|
|
|
kvm_version, info->kvm_version);
|
2011-01-14 00:09:15 +08:00
|
|
|
goto cleanup;
|
2009-06-11 22:17:42 +08:00
|
|
|
}
|
|
|
|
|
2011-01-14 00:09:15 +08:00
|
|
|
ret = 0;
|
|
|
|
cleanup:
|
|
|
|
VIR_FREE(path);
|
|
|
|
return ret;
|
2009-06-11 22:17:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mymain(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
char cwd[PATH_MAX];
|
|
|
|
|
|
|
|
progname = argv[0];
|
|
|
|
|
|
|
|
if (argc > 1) {
|
|
|
|
fprintf(stderr, "Usage: %s\n", progname);
|
|
|
|
return (EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
abs_srcdir = getenv("abs_srcdir");
|
|
|
|
if (!abs_srcdir)
|
|
|
|
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
|
|
|
|
2010-03-10 02:22:22 +08:00
|
|
|
# define DO_TEST(name, flags, version, is_kvm, kvm_version) \
|
2009-06-11 22:17:42 +08:00
|
|
|
do { \
|
|
|
|
const struct testInfo info = { name, flags, version, is_kvm, kvm_version }; \
|
|
|
|
if (virtTestRun("QEMU Help String Parsing " name, \
|
|
|
|
1, testHelpStrParsing, &info) < 0) \
|
|
|
|
ret = -1; \
|
|
|
|
} while (0)
|
|
|
|
|
2009-07-06 21:59:19 +08:00
|
|
|
DO_TEST("qemu-0.9.1",
|
|
|
|
QEMUD_CMD_FLAG_KQEMU |
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_NAME,
|
|
|
|
9001, 0, 0);
|
|
|
|
DO_TEST("kvm-74",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
Support configuration of huge pages in guests
Add option to domain XML for
<memoryBacking>
<hugepages/>
</memoryBacking>
* configure.in: Add check for mntent.h
* qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
Add 'hugetlbfs_mount' config parameter
* src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
and pass it when hugepages are requested.
Load hugetlbfs_mount config parameter, search for mount if not given.
* src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
Create directory for QEMU hugepage usage, chowning if required.
* docs/formatdomain.html.in: Document memoryBacking/hugepages elements
* docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
* src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
helper API
* tests/qemuhelptest.c: Add -mem-path constants
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
handling
* tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
hugepage tests
2009-08-25 22:05:18 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
|
|
|
QEMUD_CMD_FLAG_TDF,
|
2009-07-06 21:59:19 +08:00
|
|
|
9001, 1, 74);
|
2010-10-23 00:02:31 +08:00
|
|
|
DO_TEST("kvm-83-rhel56",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
|
|
|
QEMUD_CMD_FLAG_VGA |
|
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
|
|
|
QEMUD_CMD_FLAG_BALLOON |
|
|
|
|
QEMUD_CMD_FLAG_RTC_TD_HACK |
|
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
|
|
|
QEMUD_CMD_FLAG_TDF |
|
2010-11-05 22:44:57 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_READONLY |
|
2010-11-09 21:51:21 +08:00
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_SPICE,
|
2010-10-23 00:02:31 +08:00
|
|
|
9001, 1, 83);
|
2009-07-06 21:59:19 +08:00
|
|
|
DO_TEST("qemu-0.10.5",
|
|
|
|
QEMUD_CMD_FLAG_KQEMU |
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
2009-08-14 19:22:01 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
2009-07-18 05:08:33 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA |
|
2009-11-20 22:41:05 +08:00
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
2009-12-22 04:23:55 +08:00
|
|
|
QEMUD_CMD_FLAG_ENABLE_KVM |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_SDL |
|
|
|
|
QEMUD_CMD_FLAG_RTC_TD_HACK |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_VGA_NONE,
|
2009-07-06 21:59:19 +08:00
|
|
|
10005, 0, 0);
|
|
|
|
DO_TEST("qemu-kvm-0.10.5",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
2009-08-14 19:22:01 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
2009-07-18 05:08:33 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA |
|
2009-08-14 15:31:11 +08:00
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
Support configuration of huge pages in guests
Add option to domain XML for
<memoryBacking>
<hugepages/>
</memoryBacking>
* configure.in: Add check for mntent.h
* qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
Add 'hugetlbfs_mount' config parameter
* src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
and pass it when hugepages are requested.
Load hugetlbfs_mount config parameter, search for mount if not given.
* src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
Create directory for QEMU hugepage usage, chowning if required.
* docs/formatdomain.html.in: Document memoryBacking/hugepages elements
* docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
* src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
helper API
* tests/qemuhelptest.c: Add -mem-path constants
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
handling
* tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
hugepage tests
2009-08-25 22:05:18 +08:00
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
2009-12-22 04:23:55 +08:00
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_SDL |
|
|
|
|
QEMUD_CMD_FLAG_RTC_TD_HACK |
|
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
2010-09-22 19:47:09 +08:00
|
|
|
QEMUD_CMD_FLAG_TDF |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
|
|
|
QEMUD_CMD_FLAG_VGA_NONE,
|
2009-07-06 21:59:19 +08:00
|
|
|
10005, 1, 0);
|
|
|
|
DO_TEST("kvm-86",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
2009-08-14 19:22:01 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
2009-07-18 05:08:33 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA |
|
2009-08-14 15:31:11 +08:00
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
2009-12-22 04:23:55 +08:00
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_SDL |
|
|
|
|
QEMUD_CMD_FLAG_RTC_TD_HACK |
|
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
2010-09-22 19:47:09 +08:00
|
|
|
QEMUD_CMD_FLAG_TDF |
|
2010-11-05 22:44:57 +08:00
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_VGA_NONE,
|
2009-07-06 21:59:19 +08:00
|
|
|
10050, 1, 0);
|
2009-09-10 16:36:13 +08:00
|
|
|
DO_TEST("qemu-kvm-0.11.0-rc2",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
|
|
|
QEMUD_CMD_FLAG_VGA |
|
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
2009-11-20 22:41:05 +08:00
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
2010-01-07 01:01:51 +08:00
|
|
|
QEMUD_CMD_FLAG_ENABLE_KVM |
|
2009-12-22 04:23:55 +08:00
|
|
|
QEMUD_CMD_FLAG_BALLOON |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_SDL |
|
|
|
|
QEMUD_CMD_FLAG_RTC_TD_HACK |
|
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
2010-07-26 22:28:58 +08:00
|
|
|
QEMUD_CMD_FLAG_TDF |
|
2010-09-22 19:47:09 +08:00
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
2010-10-20 16:25:05 +08:00
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
2010-11-05 22:44:57 +08:00
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_VGA_NONE,
|
2009-09-10 16:36:13 +08:00
|
|
|
10092, 1, 0);
|
2009-12-22 04:36:32 +08:00
|
|
|
DO_TEST("qemu-0.12.1",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
2010-10-23 00:02:31 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_READONLY |
|
2009-12-22 04:36:32 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA |
|
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
|
|
|
QEMUD_CMD_FLAG_ENABLE_KVM |
|
2009-12-22 04:23:55 +08:00
|
|
|
QEMUD_CMD_FLAG_SDL |
|
2009-12-22 04:36:32 +08:00
|
|
|
QEMUD_CMD_FLAG_XEN_DOMID |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX |
|
|
|
|
QEMUD_CMD_FLAG_CHARDEV |
|
|
|
|
QEMUD_CMD_FLAG_BALLOON |
|
2010-01-18 23:51:52 +08:00
|
|
|
QEMUD_CMD_FLAG_DEVICE |
|
2010-02-03 02:07:12 +08:00
|
|
|
QEMUD_CMD_FLAG_SMP_TOPOLOGY |
|
2010-03-30 19:51:01 +08:00
|
|
|
QEMUD_CMD_FLAG_RTC |
|
2010-07-26 22:28:58 +08:00
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
2010-10-20 16:25:05 +08:00
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
2010-11-05 22:44:57 +08:00
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
2010-12-23 06:13:06 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA_NONE |
|
2010-04-21 22:28:21 +08:00
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_FD |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_AIO,
|
2009-12-22 04:36:32 +08:00
|
|
|
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AG_PCI_CONFIGFD |
|
2010-12-09 00:29:54 +08:00
|
|
|
QEMUD_CMD_FLAG_NODEFCONFIG |
|
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_VGA_QXL |
|
|
|
|
QEMUD_CMD_FLAG_SPICE |
|
2010-12-23 06:13:06 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA_NONE |
|
2010-04-21 22:28:21 +08:00
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_FD |
|
2011-02-04 23:43:32 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_AIO |
|
|
|
|
QEMUD_CMD_FLAG_DEVICE_SPICEVMC,
|
2010-12-09 00:29:54 +08:00
|
|
|
12001, 1, 0);
|
2010-05-13 11:07:00 +08:00
|
|
|
DO_TEST("qemu-kvm-0.12.3",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
2010-10-23 00:02:31 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_READONLY |
|
2010-05-13 11:07:00 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA |
|
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
|
|
|
QEMUD_CMD_FLAG_SDL |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX |
|
|
|
|
QEMUD_CMD_FLAG_CHARDEV |
|
|
|
|
QEMUD_CMD_FLAG_BALLOON |
|
|
|
|
QEMUD_CMD_FLAG_DEVICE |
|
|
|
|
QEMUD_CMD_FLAG_SMP_TOPOLOGY |
|
|
|
|
QEMUD_CMD_FLAG_RTC |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HOST |
|
|
|
|
QEMUD_CMD_FLAG_NO_HPET |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
2010-07-26 22:28:58 +08:00
|
|
|
QEMUD_CMD_FLAG_TDF |
|
2010-09-22 19:47:09 +08:00
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
2010-10-20 16:25:05 +08:00
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
2010-11-05 22:44:57 +08:00
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
2010-12-08 21:45:00 +08:00
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
2010-12-23 06:13:06 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA_NONE |
|
2010-04-21 22:28:21 +08:00
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_FD |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_AIO,
|
2010-05-13 11:07:00 +08:00
|
|
|
12003, 1, 0);
|
2010-12-09 01:10:51 +08:00
|
|
|
DO_TEST("qemu-kvm-0.13.0",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMU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|
QEMUD_CMD_FLAG_PCI_CONFIGFD |
|
2010-12-09 01:10:51 +08:00
|
|
|
QEMUD_CMD_FLAG_NODEFCONFIG |
|
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
|
|
|
QEMUD_CMD_FLAG_FSDEV |
|
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_SPICE |
|
2010-12-23 06:13:06 +08:00
|
|
|
QEMUD_CMD_FLAG_VGA_NONE |
|
2010-04-21 22:28:21 +08:00
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_FD |
|
2011-02-04 23:43:32 +08:00
|
|
|
QEMUD_CMD_FLAG_DRIVE_AIO |
|
|
|
|
QEMUD_CMD_FLAG_DEVICE_SPICEVMC,
|
2010-12-09 01:10:51 +08:00
|
|
|
13000, 1, 0);
|
2011-01-13 23:54:33 +08:00
|
|
|
DO_TEST("qemu-kvm-0.12.1.2-rhel61",
|
|
|
|
QEMUD_CMD_FLAG_VNC_COLON |
|
|
|
|
QEMUD_CMD_FLAG_NO_REBOOT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE |
|
|
|
|
QEMUD_CMD_FLAG_NAME |
|
|
|
|
QEMUD_CMD_FLAG_UUID |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HDR |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
|
|
|
QEMUD_CMD_FLAG_KVM |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_SERIAL |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_READONLY |
|
|
|
|
QEMUD_CMD_FLAG_VGA |
|
|
|
|
QEMUD_CMD_FLAG_0_10 |
|
|
|
|
QEMUD_CMD_FLAG_PCIDEVICE |
|
|
|
|
QEMUD_CMD_FLAG_MEM_PATH |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX |
|
|
|
|
QEMUD_CMD_FLAG_CHARDEV |
|
|
|
|
QEMUD_CMD_FLAG_ENABLE_KVM |
|
|
|
|
QEMUD_CMD_FLAG_BALLOON |
|
|
|
|
QEMUD_CMD_FLAG_DEVICE |
|
|
|
|
QEMUD_CMD_FLAG_SMP_TOPOLOGY |
|
|
|
|
QEMUD_CMD_FLAG_RTC |
|
|
|
|
QEMUD_CMD_FLAG_VNET_HOST |
|
|
|
|
QEMUD_CMD_FLAG_NO_KVM_PIT |
|
|
|
|
QEMUD_CMD_FLAG_TDF |
|
|
|
|
QEMUD_CMD_FLAG_PCI_CONFIGFD |
|
|
|
|
QEMUD_CMD_FLAG_NODEFCONFIG |
|
|
|
|
QEMUD_CMD_FLAG_BOOT_MENU |
|
|
|
|
QEMUD_CMD_FLAG_NESTING |
|
|
|
|
QEMUD_CMD_FLAG_NAME_PROCESS |
|
|
|
|
QEMUD_CMD_FLAG_SMBIOS_TYPE |
|
|
|
|
QEMUD_CMD_FLAG_VGA_QXL |
|
|
|
|
QEMUD_CMD_FLAG_SPICE |
|
|
|
|
QEMUD_CMD_FLAG_VGA_NONE |
|
|
|
|
QEMUD_CMD_FLAG_MIGRATE_QEMU_FD |
|
|
|
|
QEMUD_CMD_FLAG_HDA_DUPLEX |
|
|
|
|
QEMUD_CMD_FLAG_DRIVE_AIO |
|
|
|
|
QEMUD_CMD_FLAG_CCID_PASSTHRU |
|
Add txmode attribute to interface XML for virtio backend
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=629662
Explanation
qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.
'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)
'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)
The resulting difference, according to the qemu developer who added
the option is:
bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.
Solution
This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:
<interface ...>
...
<model type='virtio'/>
<driver txmode='iothread'/>
...
</interface>
I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)
Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of
qemu -device virtio-net-pci,?
If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-04 04:20:01 +08:00
|
|
|
QEMUD_CMD_FLAG_CHARDEV_SPICEVMC |
|
|
|
|
QEMUD_CMD_FLAG_VIRTIO_TX_ALG,
|
2011-01-13 23:54:33 +08:00
|
|
|
12001, 1, 0);
|
2009-06-11 22:17:42 +08:00
|
|
|
|
|
|
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
VIRT_TEST_MAIN(mymain)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
int main (void) { return (77); /* means 'test skipped' for automake */ }
|
|
|
|
|
|
|
|
#endif /* WITH_QEMU */
|