提交 b34e0820 编写于 作者: J Jiri Denemark

Fake host CPU for qemu tests

上级 b9a2552d
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# include "testutilsqemu.h" # include "testutilsqemu.h"
# include "testutils.h" # include "testutils.h"
# include "memory.h" # include "memory.h"
# include "cpu_conf.h"
static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines) static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines)
{ {
...@@ -62,13 +63,40 @@ virCapsPtr testQemuCapsInit(void) { ...@@ -62,13 +63,40 @@ virCapsPtr testQemuCapsInit(void) {
static const char *const xen_machines[] = { static const char *const xen_machines[] = {
"xenner" "xenner"
}; };
static virCPUFeatureDef host_cpu_features[] = {
{ (char *) "lahf_lm", -1 },
{ (char *) "xtpr", -1 },
{ (char *) "cx16", -1 },
{ (char *) "tm2", -1 },
{ (char *) "est", -1 },
{ (char *) "vmx", -1 },
{ (char *) "ds_cpl", -1 },
{ (char *) "pbe", -1 },
{ (char *) "tm", -1 },
{ (char *) "ht", -1 },
{ (char *) "ss", -1 },
{ (char *) "acpi", -1 },
{ (char *) "ds", -1 }
};
static virCPUDef host_cpu = {
VIR_CPU_TYPE_HOST, /* type */
0, /* match */
(char *) "x86_64", /* arch */
(char *) "core2duo", /* model */
1, /* sockets */
2, /* cores */
1, /* threads */
ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */
host_cpu_features /* features */
};
uname (&utsname); uname (&utsname);
if ((caps = virCapabilitiesNew(utsname.machine, if ((caps = virCapabilitiesNew(utsname.machine,
0, 0)) == NULL) 0, 0)) == NULL)
return NULL; return NULL;
if ((machines = testQemuAllocMachines(&nmachines)) == NULL) if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL ||
(machines = testQemuAllocMachines(&nmachines)) == NULL)
goto cleanup; goto cleanup;
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32, if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册