diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2011-10-20 14:56:20 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2011-11-03 12:01:48 +0000 |
commit | 209c2880b918a80449d42845ca1fd1497f2ec2da (patch) | |
tree | 7481164f14e72e4423f402a186571b06ef7e47d5 /tests/testutilsxen.c | |
parent | 8866eed0970d44b7b51d28a4515d43d51774cf37 (diff) | |
download | libvirt-209c2880b918a80449d42845ca1fd1497f2ec2da.tar.gz |
Fix default console type setting
The default console type may vary based on the OS type. ie a Xen
paravirt guests wants a 'xen' console, while a fullvirt guests
wants a 'serial' console.
A plain integer default console type in the capabilities does
not suffice. Instead introduce a callback that is passed the
OS type.
* src/conf/capabilities.h: Use a callback for default console
type
* src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
for default console type. Add missing LXC/OpenVZ console types.
* src/esx/esx_driver.c, src/libxl/libxl_conf.c,
src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
src/xenapi/xenapi_driver.c: Set default console type callback
Diffstat (limited to 'tests/testutilsxen.c')
-rw-r--r-- | tests/testutilsxen.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index 94c423f872..7d5a872a8e 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -4,6 +4,15 @@ #include <stdlib.h> #include "testutilsxen.h" +#include "domain_conf.h" + +static int testXenDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED) +{ + if (STREQ(ostype, "hvm")) + return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; + else + return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; +} virCapsPtr testXenCapsInit(void) { struct utsname utsname; @@ -23,6 +32,8 @@ virCapsPtr testXenCapsInit(void) { 0, 0)) == NULL) return NULL; + caps->defaultConsoleTargetType = testXenDefaultConsoleType; + nmachines = ARRAY_CARDINALITY(x86_machines); if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL) goto cleanup; |