mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
* src/qemu_conf.[ch] src/qemu_driver.c: add qemu/kvm drivers report
features for i686 and x86_64, patch from David Lutterkort Daniel
This commit is contained in:
parent
4e01a607e4
commit
c7722ca345
@ -1,3 +1,8 @@
|
||||
Mon Jul 30 11:59:51 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/qemu_conf.[ch] src/qemu_driver.c: add qemu/kvm drivers report
|
||||
features for i686 and x86_64, patch from David Lutterkort
|
||||
|
||||
Fri Jul 27 19:19:31 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/test.c: Added impl of networking APIs. Cleanup all other
|
||||
|
@ -221,17 +221,31 @@ static const char *arch_info_ppc_machines[] = {
|
||||
"g3bw", "mac99", "prep", NULL
|
||||
};
|
||||
|
||||
/* Feature flags for the architecture info */
|
||||
struct qemu_feature_flags arch_info_i686_flags [] = {
|
||||
{ "pae", 1, 1 },
|
||||
{ "acpi", 1, 1 },
|
||||
{ "apic", 1, 0 },
|
||||
{ NULL, -1, -1 }
|
||||
};
|
||||
|
||||
struct qemu_feature_flags arch_info_x86_64_flags [] = {
|
||||
{ "acpi", 1, 1 },
|
||||
{ "apic", 1, 0 },
|
||||
{ NULL, -1, -1 }
|
||||
};
|
||||
|
||||
/* The archicture tables for supported QEMU archs */
|
||||
struct qemu_arch_info qemudArchs[] = {
|
||||
/* i686 must be in position 0 */
|
||||
{ "i686", 32, arch_info_x86_machines, "qemu" },
|
||||
{ "i686", 32, arch_info_x86_machines, "qemu", arch_info_i686_flags },
|
||||
/* x86_64 must be in position 1 */
|
||||
{ "x86_64", 64, arch_info_x86_machines, "qemu-system-x86_64" },
|
||||
{ "mips", 32, arch_info_mips_machines, "qemu-system-mips" },
|
||||
{ "mipsel", 32, arch_info_mips_machines, "qemu-system-mipsel" },
|
||||
{ "sparc", 32, arch_info_sparc_machines, "qemu-system-sparc" },
|
||||
{ "ppc", 32, arch_info_ppc_machines, "qemu-system-ppc" },
|
||||
{ NULL, -1, NULL, NULL }
|
||||
{ "x86_64", 64, arch_info_x86_machines, "qemu-system-x86_64", arch_info_x86_64_flags },
|
||||
{ "mips", 32, arch_info_mips_machines, "qemu-system-mips", NULL },
|
||||
{ "mipsel", 32, arch_info_mips_machines, "qemu-system-mipsel", NULL },
|
||||
{ "sparc", 32, arch_info_sparc_machines, "qemu-system-sparc", NULL },
|
||||
{ "ppc", 32, arch_info_ppc_machines, "qemu-system-ppc", NULL },
|
||||
{ NULL, -1, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* Return the default architecture if none is explicitly requested*/
|
||||
|
@ -384,11 +384,18 @@ char * qemudGenerateNetworkXML (virConnectPtr conn,
|
||||
struct qemud_network *network,
|
||||
struct qemud_network_def *def);
|
||||
|
||||
struct qemu_feature_flags {
|
||||
const char *name;
|
||||
const int default_on;
|
||||
const int toggle;
|
||||
};
|
||||
|
||||
struct qemu_arch_info {
|
||||
const char *arch;
|
||||
int wordsize;
|
||||
const char **machines;
|
||||
const char *binary;
|
||||
const struct qemu_feature_flags *fflags;
|
||||
};
|
||||
extern struct qemu_arch_info qemudArchs[];
|
||||
|
||||
|
@ -1416,6 +1416,40 @@ static int qemudGetNodeInfo(virConnectPtr conn,
|
||||
return virNodeInfoPopulate(conn, nodeinfo);
|
||||
}
|
||||
|
||||
static int qemudGetFeatures(virBufferPtr xml,
|
||||
const struct qemu_feature_flags *flags) {
|
||||
int i, r;
|
||||
|
||||
if (flags == NULL)
|
||||
return 0;
|
||||
|
||||
r = virBufferAdd(xml, "\
|
||||
<features>\n", -1);
|
||||
if (r == -1) return r;
|
||||
for (i = 0; flags[i].name; ++i) {
|
||||
if (STREQ(flags[i].name, "pae")) {
|
||||
int pae = flags[i].default_on || flags[i].toggle;
|
||||
int nonpae = flags[i].toggle;
|
||||
if (pae) {
|
||||
r = virBufferAdd(xml, " <pae/>\n", -1);
|
||||
if (r == -1) return r;
|
||||
}
|
||||
if (nonpae) {
|
||||
r = virBufferAdd(xml, " <nonpae/>\n", -1);
|
||||
if (r == -1) return r;
|
||||
}
|
||||
} else {
|
||||
r = virBufferVSprintf(xml, " <%s default='%s' toggle='%s'/>\n",
|
||||
flags[i].name,
|
||||
flags[i].default_on ? "on" : "off",
|
||||
flags[i].toggle ? "yes" : "no");
|
||||
if (r == -1) return r;
|
||||
}
|
||||
}
|
||||
r = virBufferAdd(xml, " </features>\n", -1);
|
||||
return r;
|
||||
}
|
||||
|
||||
static char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||
struct utsname utsname;
|
||||
int i, j, r;
|
||||
@ -1493,10 +1527,13 @@ static char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||
</domain>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
}
|
||||
r = virBufferAdd (xml,
|
||||
"\
|
||||
</arch>\n\
|
||||
</guest>\n", -1);
|
||||
r = virBufferAdd (xml, " </arch>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
|
||||
r = qemudGetFeatures(xml, qemudArchs[i].fflags);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
|
||||
r = virBufferAdd (xml, " </guest>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
|
||||
/* The "other" PC architecture needs emulation. */
|
||||
@ -1521,10 +1558,7 @@ static char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||
qemudArchs[i].machines[j]);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
}
|
||||
r = virBufferAdd (xml,
|
||||
"\
|
||||
</arch>\n\
|
||||
</guest>\n", -1);
|
||||
r = virBufferAdd (xml, " </arch>\n </guest>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
}
|
||||
|
||||
@ -1550,10 +1584,13 @@ static char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||
qemudArchs[i].machines[j]);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
}
|
||||
r = virBufferAdd (xml,
|
||||
"\
|
||||
</arch>\n\
|
||||
</guest>\n", -1);
|
||||
r = virBufferAdd (xml, " </arch>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
|
||||
r = qemudGetFeatures(xml, qemudArchs[i].fflags);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
|
||||
r = virBufferAdd (xml, " </guest>\n", -1);
|
||||
if (r == -1) goto vir_buffer_failed;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user