mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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
This commit is contained in:
parent
8866eed097
commit
209c2880b9
@ -144,7 +144,7 @@ struct _virCaps {
|
|||||||
unsigned int emulatorRequired : 1;
|
unsigned int emulatorRequired : 1;
|
||||||
const char *defaultDiskDriverName;
|
const char *defaultDiskDriverName;
|
||||||
const char *defaultDiskDriverType;
|
const char *defaultDiskDriverType;
|
||||||
int defaultConsoleTargetType;
|
int (*defaultConsoleTargetType)(const char *ostype);
|
||||||
void *(*privateDataAllocFunc)(void);
|
void *(*privateDataAllocFunc)(void);
|
||||||
void (*privateDataFreeFunc)(void *);
|
void (*privateDataFreeFunc)(void *);
|
||||||
int (*privateDataXMLFormat)(virBufferPtr, void *);
|
int (*privateDataXMLFormat)(virBufferPtr, void *);
|
||||||
|
@ -295,7 +295,9 @@ VIR_ENUM_IMPL(virDomainChrConsoleTarget,
|
|||||||
"serial",
|
"serial",
|
||||||
"xen",
|
"xen",
|
||||||
"uml",
|
"uml",
|
||||||
"virtio")
|
"virtio",
|
||||||
|
"lxc",
|
||||||
|
"openvz")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
|
||||||
"parallel",
|
"parallel",
|
||||||
@ -3578,7 +3580,9 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainChrDefaultTargetType(virCapsPtr caps, int devtype) {
|
virDomainChrDefaultTargetType(virCapsPtr caps,
|
||||||
|
virDomainDefPtr def,
|
||||||
|
int devtype) {
|
||||||
|
|
||||||
int target = -1;
|
int target = -1;
|
||||||
|
|
||||||
@ -3590,7 +3594,12 @@ virDomainChrDefaultTargetType(virCapsPtr caps, int devtype) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
|
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
|
||||||
target = caps->defaultConsoleTargetType;
|
if (!caps->defaultConsoleTargetType) {
|
||||||
|
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Driver does not have a default console type set"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
target = caps->defaultConsoleTargetType(def->os.type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
|
case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
|
||||||
@ -3606,6 +3615,7 @@ virDomainChrDefaultTargetType(virCapsPtr caps, int devtype) {
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainChrTargetTypeFromString(virCapsPtr caps,
|
virDomainChrTargetTypeFromString(virCapsPtr caps,
|
||||||
|
virDomainDefPtr def,
|
||||||
int devtype,
|
int devtype,
|
||||||
const char *targetType)
|
const char *targetType)
|
||||||
{
|
{
|
||||||
@ -3613,7 +3623,7 @@ virDomainChrTargetTypeFromString(virCapsPtr caps,
|
|||||||
int target = 0;
|
int target = 0;
|
||||||
|
|
||||||
if (!targetType) {
|
if (!targetType) {
|
||||||
target = virDomainChrDefaultTargetType(caps, devtype);
|
target = virDomainChrDefaultTargetType(caps, def, devtype);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3640,6 +3650,7 @@ out:
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainChrDefParseTargetXML(virCapsPtr caps,
|
virDomainChrDefParseTargetXML(virCapsPtr caps,
|
||||||
|
virDomainDefPtr vmdef,
|
||||||
virDomainChrDefPtr def,
|
virDomainChrDefPtr def,
|
||||||
xmlNodePtr cur)
|
xmlNodePtr cur)
|
||||||
{
|
{
|
||||||
@ -3650,8 +3661,8 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
|
|||||||
const char *portStr = NULL;
|
const char *portStr = NULL;
|
||||||
|
|
||||||
if ((def->targetType =
|
if ((def->targetType =
|
||||||
virDomainChrTargetTypeFromString(caps,
|
virDomainChrTargetTypeFromString(caps, vmdef,
|
||||||
def->deviceType, targetType)) < 0) {
|
def->deviceType, targetType)) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3989,6 +4000,7 @@ virDomainChrDefNew(void) {
|
|||||||
*/
|
*/
|
||||||
static virDomainChrDefPtr
|
static virDomainChrDefPtr
|
||||||
virDomainChrDefParseXML(virCapsPtr caps,
|
virDomainChrDefParseXML(virCapsPtr caps,
|
||||||
|
virDomainDefPtr vmdef,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
@ -4028,7 +4040,7 @@ virDomainChrDefParseXML(virCapsPtr caps,
|
|||||||
if (cur->type == XML_ELEMENT_NODE) {
|
if (cur->type == XML_ELEMENT_NODE) {
|
||||||
if (xmlStrEqual(cur->name, BAD_CAST "target")) {
|
if (xmlStrEqual(cur->name, BAD_CAST "target")) {
|
||||||
seenTarget = true;
|
seenTarget = true;
|
||||||
if (virDomainChrDefParseTargetXML(caps, def, cur) < 0) {
|
if (virDomainChrDefParseTargetXML(caps, vmdef, def, cur) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4038,7 +4050,7 @@ virDomainChrDefParseXML(virCapsPtr caps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!seenTarget &&
|
if (!seenTarget &&
|
||||||
((def->targetType = virDomainChrDefaultTargetType(caps, def->deviceType)) < 0))
|
((def->targetType = virDomainChrDefaultTargetType(caps, vmdef, def->deviceType)) < 0))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (def->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
|
if (def->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
|
||||||
@ -7167,6 +7179,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
|
|
||||||
for (i = 0 ; i < n ; i++) {
|
for (i = 0 ; i < n ; i++) {
|
||||||
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
||||||
|
def,
|
||||||
nodes[i],
|
nodes[i],
|
||||||
flags);
|
flags);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
@ -7193,6 +7206,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
|
|
||||||
for (i = 0 ; i < n ; i++) {
|
for (i = 0 ; i < n ; i++) {
|
||||||
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
||||||
|
def,
|
||||||
nodes[i],
|
nodes[i],
|
||||||
flags);
|
flags);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
@ -7221,6 +7235,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
|
|
||||||
for (i = 0 ; i < n ; i++) {
|
for (i = 0 ; i < n ; i++) {
|
||||||
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
||||||
|
def,
|
||||||
nodes[i],
|
nodes[i],
|
||||||
flags);
|
flags);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
@ -7285,6 +7300,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
|
|
||||||
for (i = 0 ; i < n ; i++) {
|
for (i = 0 ; i < n ; i++) {
|
||||||
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
|
||||||
|
def,
|
||||||
nodes[i],
|
nodes[i],
|
||||||
flags);
|
flags);
|
||||||
if (!chr)
|
if (!chr)
|
||||||
|
@ -605,6 +605,8 @@ enum virDomainChrConsoleTargetType {
|
|||||||
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
|
||||||
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
|
||||||
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
|
||||||
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC,
|
||||||
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
|
||||||
|
|
||||||
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
|
||||||
};
|
};
|
||||||
|
@ -588,6 +588,11 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int esxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
esxCapsInit(esxPrivate *priv)
|
esxCapsInit(esxPrivate *priv)
|
||||||
@ -615,6 +620,7 @@ esxCapsInit(esxPrivate *priv)
|
|||||||
virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr");
|
virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr");
|
||||||
|
|
||||||
caps->hasWideScsiBus = true;
|
caps->hasWideScsiBus = true;
|
||||||
|
caps->defaultConsoleTargetType = esxDefaultConsoleType;
|
||||||
|
|
||||||
if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) {
|
if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) {
|
||||||
goto failure;
|
goto failure;
|
||||||
|
@ -114,6 +114,15 @@ libxlNextFreeVncPort(libxlDriverPrivatePtr driver, int startPort)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int libxlDefaultConsoleType(const char *ostype)
|
||||||
|
{
|
||||||
|
if (STREQ(ostype, "hvm"))
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
else
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||||
|
}
|
||||||
|
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
libxlBuildCapabilities(const char *hostmachine,
|
libxlBuildCapabilities(const char *hostmachine,
|
||||||
int host_pae,
|
int host_pae,
|
||||||
@ -206,7 +215,7 @@ libxlBuildCapabilities(const char *hostmachine,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
caps->defaultConsoleTargetType = libxlDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
|
@ -40,6 +40,12 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_LXC
|
#define VIR_FROM_THIS VIR_FROM_LXC
|
||||||
|
|
||||||
|
static int lxcDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
virCapsPtr lxcCapsInit(void)
|
virCapsPtr lxcCapsInit(void)
|
||||||
{
|
{
|
||||||
@ -54,6 +60,8 @@ virCapsPtr lxcCapsInit(void)
|
|||||||
0, 0)) == NULL)
|
0, 0)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = lxcDefaultConsoleType;
|
||||||
|
|
||||||
/* Some machines have problematic NUMA toplogy causing
|
/* Some machines have problematic NUMA toplogy causing
|
||||||
* unexpected failures. We don't want to break the QEMU
|
* unexpected failures. We don't want to break the QEMU
|
||||||
* driver in this scenario, so log errors & carry on
|
* driver in this scenario, so log errors & carry on
|
||||||
|
@ -129,6 +129,11 @@ int openvzExtractVersion(struct openvz_driver *driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int openvzDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
|
||||||
|
}
|
||||||
|
|
||||||
virCapsPtr openvzCapsInit(void)
|
virCapsPtr openvzCapsInit(void)
|
||||||
{
|
{
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
@ -165,6 +170,7 @@ virCapsPtr openvzCapsInit(void)
|
|||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
caps->defaultInitPath = "/sbin/init";
|
caps->defaultInitPath = "/sbin/init";
|
||||||
|
caps->defaultConsoleTargetType = openvzDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
no_memory:
|
no_memory:
|
||||||
|
@ -291,6 +291,13 @@ phypGetVIOSPartitionID(virConnectPtr conn)
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int phypDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
phypCapsInit(void)
|
phypCapsInit(void)
|
||||||
{
|
{
|
||||||
@ -328,6 +335,8 @@ phypCapsInit(void)
|
|||||||
"phyp", NULL, NULL, 0, NULL) == NULL)
|
"phyp", NULL, NULL, 0, NULL) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = phypDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
|
@ -807,6 +807,12 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int qemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virCapsPtr qemuCapsInit(virCapsPtr old_caps)
|
virCapsPtr qemuCapsInit(virCapsPtr old_caps)
|
||||||
{
|
{
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
@ -874,7 +880,7 @@ virCapsPtr qemuCapsInit(virCapsPtr old_caps)
|
|||||||
/* QEMU Requires an emulator in the XML */
|
/* QEMU Requires an emulator in the XML */
|
||||||
virCapabilitiesSetEmulatorRequired(caps);
|
virCapabilitiesSetEmulatorRequired(caps);
|
||||||
|
|
||||||
caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
caps->defaultConsoleTargetType = qemuDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
|
@ -152,6 +152,11 @@ static void testDomainObjPrivateFree(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
testBuildCapabilities(virConnectPtr conn) {
|
testBuildCapabilities(virConnectPtr conn) {
|
||||||
testConnPtr privconn = conn->privateData;
|
testConnPtr privconn = conn->privateData;
|
||||||
@ -163,6 +168,8 @@ testBuildCapabilities(virConnectPtr conn) {
|
|||||||
if ((caps = virCapabilitiesNew(TEST_MODEL, 0, 0)) == NULL)
|
if ((caps = virCapabilitiesNew(TEST_MODEL, 0, 0)) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = testDefaultConsoleType;
|
||||||
|
|
||||||
if (virCapabilitiesAddHostFeature(caps, "pae") < 0)
|
if (virCapabilitiesAddHostFeature(caps, "pae") < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0)
|
if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0)
|
||||||
|
@ -54,6 +54,13 @@
|
|||||||
#define umlLog(level, msg, ...) \
|
#define umlLog(level, msg, ...) \
|
||||||
virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
|
virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
static int umlDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virCapsPtr umlCapsInit(void) {
|
virCapsPtr umlCapsInit(void) {
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
virCapsPtr caps;
|
virCapsPtr caps;
|
||||||
@ -99,7 +106,7 @@ virCapsPtr umlCapsInit(void) {
|
|||||||
NULL) == NULL)
|
NULL) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML;
|
caps->defaultConsoleTargetType = umlDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
|
@ -825,6 +825,13 @@ cleanup:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int vboxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virCapsPtr vboxCapsInit(void) {
|
static virCapsPtr vboxCapsInit(void) {
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
virCapsPtr caps;
|
virCapsPtr caps;
|
||||||
@ -858,6 +865,9 @@ static virCapsPtr vboxCapsInit(void) {
|
|||||||
0,
|
0,
|
||||||
NULL) == NULL)
|
NULL) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = vboxDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
|
@ -49,6 +49,13 @@ vmwareFreeDriver(struct vmware_driver *driver)
|
|||||||
VIR_FREE(driver);
|
VIR_FREE(driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int vmwareDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virCapsPtr
|
virCapsPtr
|
||||||
vmwareCapsInit(void)
|
vmwareCapsInit(void)
|
||||||
{
|
{
|
||||||
@ -117,6 +124,8 @@ vmwareCapsInit(void)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = vmwareDefaultConsoleType;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCPUDefFree(cpu);
|
virCPUDefFree(cpu);
|
||||||
cpuDataFree(utsname.machine, data);
|
cpuDataFree(utsname.machine, data);
|
||||||
|
@ -2276,6 +2276,14 @@ struct guest_arch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static int xenDefaultConsoleType(const char *ostype)
|
||||||
|
{
|
||||||
|
if (STREQ(ostype, "hvm"))
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
else
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||||
|
}
|
||||||
|
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
xenHypervisorBuildCapabilities(virConnectPtr conn,
|
xenHypervisorBuildCapabilities(virConnectPtr conn,
|
||||||
const char *hostmachine,
|
const char *hostmachine,
|
||||||
@ -2405,7 +2413,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
caps->defaultConsoleTargetType = xenDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
|
@ -48,6 +48,16 @@
|
|||||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
static int xenapiDefaultConsoleType(const char *ostype)
|
||||||
|
{
|
||||||
|
if (STREQ(ostype, "hvm"))
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
else
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getCapsObject
|
* getCapsObject
|
||||||
*
|
*
|
||||||
@ -78,6 +88,8 @@ getCapsObject (void)
|
|||||||
if (!domain2)
|
if (!domain2)
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = xenapiDefaultConsoleType;
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
|
@ -55,6 +55,11 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
|
|||||||
return machines;
|
return machines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int testQemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
virCapsPtr testQemuCapsInit(void) {
|
virCapsPtr testQemuCapsInit(void) {
|
||||||
virCapsPtr caps;
|
virCapsPtr caps;
|
||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
@ -96,6 +101,8 @@ virCapsPtr testQemuCapsInit(void) {
|
|||||||
0, 0)) == NULL)
|
0, 0)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = testQemuDefaultConsoleType;
|
||||||
|
|
||||||
if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL ||
|
if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL ||
|
||||||
(machines = testQemuAllocMachines(&nmachines)) == NULL)
|
(machines = testQemuAllocMachines(&nmachines)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -4,6 +4,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "testutilsxen.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) {
|
virCapsPtr testXenCapsInit(void) {
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
@ -23,6 +32,8 @@ virCapsPtr testXenCapsInit(void) {
|
|||||||
0, 0)) == NULL)
|
0, 0)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = testXenDefaultConsoleType;
|
||||||
|
|
||||||
nmachines = ARRAY_CARDINALITY(x86_machines);
|
nmachines = ARRAY_CARDINALITY(x86_machines);
|
||||||
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
|
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
static virCapsPtr caps;
|
static virCapsPtr caps;
|
||||||
static virVMXContext ctx;
|
static virVMXContext ctx;
|
||||||
|
|
||||||
|
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
testCapsInit(void)
|
testCapsInit(void)
|
||||||
{
|
{
|
||||||
@ -25,6 +30,8 @@ testCapsInit(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = testDefaultConsoleType;
|
||||||
|
|
||||||
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
|
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
|
||||||
virCapabilitiesAddHostMigrateTransport(caps, "esx");
|
virCapabilitiesAddHostMigrateTransport(caps, "esx");
|
||||||
|
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
static virCapsPtr caps;
|
static virCapsPtr caps;
|
||||||
static virVMXContext ctx;
|
static virVMXContext ctx;
|
||||||
|
|
||||||
|
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
testCapsInit(void)
|
testCapsInit(void)
|
||||||
{
|
{
|
||||||
@ -25,6 +30,8 @@ testCapsInit(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caps->defaultConsoleTargetType = testDefaultConsoleType;
|
||||||
|
|
||||||
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
|
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
|
||||||
virCapabilitiesAddHostMigrateTransport(caps, "esx");
|
virCapabilitiesAddHostMigrateTransport(caps, "esx");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user