virCaps: get rid of defaultConsoleTargetType callback

This patch refactors various places to allow removing of the
defaultConsoleTargetType callback from the virCaps structure.

A new console character device target type is introduced -
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
specified in the XML. This type is at the end converted to the standard
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
different from this default have to be processed separately in the
device post parse callback.
This commit is contained in:
Peter Krempa 2013-03-13 21:39:34 +01:00
parent 46becc18ba
commit 482e5f159c
32 changed files with 278 additions and 315 deletions

View File

@ -160,9 +160,6 @@ struct _virCaps {
size_t nguests; size_t nguests;
size_t nguests_max; size_t nguests_max;
virCapsGuestPtr *guests; virCapsGuestPtr *guests;
/* Move to virDomainXMLOption later */
int (*defaultConsoleTargetType)(const char *ostype, virArch guestarch);
}; };

View File

@ -385,6 +385,7 @@ VIR_ENUM_IMPL(virDomainChrChannelTarget,
VIR_ENUM_IMPL(virDomainChrConsoleTarget, VIR_ENUM_IMPL(virDomainChrConsoleTarget,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST, VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
"none",
"serial", "serial",
"xen", "xen",
"uml", "uml",
@ -2347,8 +2348,10 @@ virDomainDeviceInfoClearCCWAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
return 0; return 0;
} }
int virDomainDeviceInfoIterate(virDomainDefPtr def, static int
virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
virDomainDeviceInfoCallback cb, virDomainDeviceInfoCallback cb,
bool all,
void *opaque) void *opaque)
{ {
int i; int i;
@ -2413,8 +2416,10 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
return -1; return -1;
} }
for (i = 0; i < def->nconsoles ; i++) { for (i = 0; i < def->nconsoles ; i++) {
if (i == 0 && if (!all &&
def->consoles[i]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL && i == 0 &&
(def->consoles[i]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ||
def->consoles[i]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE) &&
STREQ_NULLABLE(def->os.type, "hvm")) STREQ_NULLABLE(def->os.type, "hvm"))
continue; continue;
device.data.chr = def->consoles[i]; device.data.chr = def->consoles[i];
@ -2491,10 +2496,21 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
} }
int
virDomainDeviceInfoIterate(virDomainDefPtr def,
virDomainDeviceInfoCallback cb,
void *opaque)
{
return virDomainDeviceInfoIterateInternal(def, cb, false, opaque);
}
static int static int
virDomainDefPostParseInternal(virDomainDefPtr def, virDomainDefPostParseInternal(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED) virCapsPtr caps ATTRIBUTE_UNUSED)
{ {
int i;
/* verify init path for container based domains */ /* verify init path for container based domains */
if (STREQ(def->os.type, "exe") && !def->os.init) { if (STREQ(def->os.type, "exe") && !def->os.init) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
@ -2502,6 +2518,91 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
return -1; return -1;
} }
/*
* Some really crazy backcompat stuff for consoles
*
* Historically the first (and only) '<console>' element in an HVM guest
* was treated as being an alias for a <serial> device.
*
* So if we see that this console device should be a serial device, then we
* move the config over to def->serials[0] (or discard it if that already
* exists). However, given console can already be filled with aliased data
* of def->serials[0]. Keep it then.
*
* We then fill def->consoles[0] with a stub just so we get sequencing
* correct for consoles > 0
*/
if (def->nconsoles > 0 && STREQ(def->os.type, "hvm") &&
(def->consoles[0]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ||
def->consoles[0]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)) {
/* First verify that only the first console is of type serial */
for (i = 1; i < def->nconsoles; i++) {
virDomainChrDefPtr cons = def->consoles[i];
if (cons->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only the first console can be a serial port"));
return -1;
}
}
/* If there isn't a corresponding serial port:
* - create one and set, the console to be an alias for it
*
* If there is a corresponding serial port:
* - Check if the source definition is equal:
* - if yes: leave it as-is
* - if no: change the console to be alias of the serial port
*/
/* create the serial port definition from the console definition */
if (def->nserials == 0) {
if (VIR_APPEND_ELEMENT(def->serials, def->nserials,
def->consoles[0]) < 0)
goto no_memory;
/* modify it to be a serial port */
def->serials[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
def->serials[0]->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA;
def->serials[0]->target.port = 0;
} else {
/* if the console source doesn't match */
if (!virDomainChrSourceDefIsEqual(&def->serials[0]->source,
&def->consoles[0]->source)) {
virDomainChrDefFree(def->consoles[0]);
def->consoles[0] = NULL;
}
}
if (!def->consoles[0]) {
/* allocate a new console type for the stolen one */
if (VIR_ALLOC(def->consoles[0]) < 0)
goto no_memory;
/* Create an console alias for the serial port */
def->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
}
return 0;
no_memory:
virReportOOMError();
return -1;
}
static int
virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
virDomainDefPtr def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
return 0; return 0;
} }
@ -2521,6 +2622,9 @@ virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
return ret; return ret;
} }
if ((ret = virDomainDeviceDefPostParseInternal(dev, def, caps)) < 0)
return ret;
return 0; return 0;
} }
@ -2564,8 +2668,9 @@ virDomainDefPostParse(virDomainDefPtr def,
} }
/* iterate the devices */ /* iterate the devices */
if ((ret = virDomainDeviceInfoIterate(def, if ((ret = virDomainDeviceInfoIterateInternal(def,
virDomainDefPostParseDeviceIterator, virDomainDefPostParseDeviceIterator,
true,
&data)) < 0) &data)) < 0)
return ret; return ret;
@ -5923,87 +6028,66 @@ error:
} }
static int static int
virDomainChrDefaultTargetType(virCapsPtr caps, virDomainChrDefaultTargetType(int devtype) {
virDomainDefPtr def, switch ((enum virDomainChrDeviceType) devtype) {
int devtype) {
int target = -1;
switch (devtype) {
case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("target type must be specified for %s device"), _("target type must be specified for %s device"),
virDomainChrDeviceTypeToString(devtype)); virDomainChrDeviceTypeToString(devtype));
break; return -1;
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
if (!caps->defaultConsoleTargetType) { return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE;
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Driver does not have a default console type set"));
return -1;
}
target = caps->defaultConsoleTargetType(def->os.type, def->os.arch);
break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
target = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA;
break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
default: case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
/* No target type yet*/ /* No target type yet*/
target = 0;
break; break;
} }
return target; return 0;
} }
static int static int
virDomainChrTargetTypeFromString(virCapsPtr caps, virDomainChrTargetTypeFromString(virDomainChrDefPtr def,
virDomainDefPtr vmdef,
virDomainChrDefPtr def,
int devtype, int devtype,
const char *targetType) const char *targetType)
{ {
int ret = -1; int ret = -1;
int target = 0;
if (!targetType) { if (!targetType)
target = virDomainChrDefaultTargetType(caps, vmdef, devtype); return virDomainChrDefaultTargetType(devtype);
goto out;
}
switch (devtype) { switch ((enum virDomainChrDeviceType) devtype) {
case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
target = virDomainChrChannelTargetTypeFromString(targetType); ret = virDomainChrChannelTargetTypeFromString(targetType);
break; break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
target = virDomainChrConsoleTargetTypeFromString(targetType); ret = virDomainChrConsoleTargetTypeFromString(targetType);
break; break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
target = virDomainChrSerialTargetTypeFromString(targetType); ret = virDomainChrSerialTargetTypeFromString(targetType);
break; break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
default: case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
/* No target type yet*/ /* No target type yet*/
ret = 0;
break; break;
} }
def->targetTypeAttr = true; def->targetTypeAttr = true;
out:
ret = target;
return ret; return ret;
} }
static int static int
virDomainChrDefParseTargetXML(virCapsPtr caps, virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
virDomainDefPtr vmdef,
virDomainChrDefPtr def,
xmlNodePtr cur) xmlNodePtr cur)
{ {
int ret = -1; int ret = -1;
@ -6013,8 +6097,8 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
const char *portStr = NULL; const char *portStr = NULL;
if ((def->targetType = if ((def->targetType =
virDomainChrTargetTypeFromString(caps, vmdef, def, virDomainChrTargetTypeFromString(def, def->deviceType,
def->deviceType, targetType)) < 0) { targetType)) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("unknown target type '%s' specified for character device"), _("unknown target type '%s' specified for character device"),
targetType); targetType);
@ -6373,9 +6457,7 @@ virDomainChrDefNew(void) {
* *
*/ */
static virDomainChrDefPtr static virDomainChrDefPtr
virDomainChrDefParseXML(virCapsPtr caps, virDomainChrDefParseXML(xmlXPathContextPtr ctxt,
virDomainDefPtr vmdef,
xmlXPathContextPtr ctxt,
xmlNodePtr node, xmlNodePtr node,
virSecurityLabelDefPtr* vmSeclabels, virSecurityLabelDefPtr* vmSeclabels,
int nvmSeclabels, int nvmSeclabels,
@ -6419,7 +6501,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, vmdef, def, cur) < 0) { if (virDomainChrDefParseTargetXML(def, cur) < 0) {
goto error; goto error;
} }
} }
@ -6429,7 +6511,7 @@ virDomainChrDefParseXML(virCapsPtr caps,
} }
if (!seenTarget && if (!seenTarget &&
((def->targetType = virDomainChrDefaultTargetType(caps, vmdef, def->deviceType)) < 0)) ((def->targetType = virDomainChrDefaultTargetType(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) {
@ -10557,9 +10639,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps, virDomainChrDefPtr chr = virDomainChrDefParseXML(ctxt,
def,
ctxt,
nodes[i], nodes[i],
def->seclabels, def->seclabels,
def->nseclabels, def->nseclabels,
@ -10587,9 +10667,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps, virDomainChrDefPtr chr = virDomainChrDefParseXML(ctxt,
def,
ctxt,
nodes[i], nodes[i],
def->seclabels, def->seclabels,
def->nseclabels, def->nseclabels,
@ -10619,10 +10697,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
bool create_stub = true; virDomainChrDefPtr chr = virDomainChrDefParseXML(ctxt,
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps,
def,
ctxt,
nodes[i], nodes[i],
def->seclabels, def->seclabels,
def->nseclabels, def->nseclabels,
@ -10630,64 +10705,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (!chr) if (!chr)
goto error; goto error;
/*
* Some really crazy backcompat stuff for consoles
*
* Historically the first (and only) '<console>'
* element in an HVM guest was treated as being
* an alias for a <serial> device.
*
* So if we see that this console device should
* be a serial device, then we move the config
* over to def->serials[0] (or discard it if
* that already exists). However, given console
* can already be filled with aliased data of
* def->serials[0]. Keep it then.
*
* We then fill def->consoles[0] with a stub
* just so we get sequencing correct for consoles
* > 0
*/
if (STREQ(def->os.type, "hvm") &&
(chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL)) {
if (i != 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only the first console can be a serial port"));
virDomainChrDefFree(chr);
goto error;
}
/* Either discard or move this chr to the serial config */
if (def->nserials != 0) {
if (virDomainChrSourceDefIsEqual(&def->serials[0]->source,
&chr->source)) {
/* Alias to def->serial[0]. Skip it */
create_stub = false;
} else {
virDomainChrDefFree(chr);
}
} else {
if (VIR_ALLOC_N(def->serials, 1) < 0) {
virDomainChrDefFree(chr);
goto no_memory;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
def->nserials = 1;
def->serials[0] = chr;
chr->target.port = 0;
}
if (create_stub) {
/* And create a stub placeholder */
if (VIR_ALLOC(chr) < 0)
goto no_memory;
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
}
chr->target.port = i; chr->target.port = i;
def->consoles[def->nconsoles++] = chr; def->consoles[def->nconsoles++] = chr;
} }
VIR_FREE(nodes); VIR_FREE(nodes);
@ -10699,9 +10717,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(caps, virDomainChrDefPtr chr = virDomainChrDefParseXML(ctxt,
def,
ctxt,
nodes[i], nodes[i],
def->seclabels, def->seclabels,
def->nseclabels, def->nseclabels,
@ -15200,7 +15216,6 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0) if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0)
goto error; goto error;
for (n = 0 ; n < def->nnets ; n++) for (n = 0 ; n < def->nnets ; n++)
if (virDomainNetDefFormat(buf, def->nets[n], flags) < 0) if (virDomainNetDefFormat(buf, def->nets[n], flags) < 0)
goto error; goto error;
@ -15223,7 +15238,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
* if it is type == serial * if it is type == serial
*/ */
if (STREQ(def->os.type, "hvm") && if (STREQ(def->os.type, "hvm") &&
(def->consoles[n]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL) && (def->consoles[n]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ||
def->consoles[n]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE) &&
(n < def->nserials)) { (n < def->nserials)) {
memcpy(&console, def->serials[n], sizeof(console)); memcpy(&console, def->serials[n], sizeof(console));
console.deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; console.deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
@ -15240,6 +15256,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virDomainChrDef console; virDomainChrDef console;
memcpy(&console, def->serials[n], sizeof(console)); memcpy(&console, def->serials[n], sizeof(console));
console.deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; console.deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
console.targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
if (virDomainChrDefFormat(buf, &console, flags) < 0) if (virDomainChrDefFormat(buf, &console, flags) < 0)
goto error; goto error;
} }

View File

@ -956,7 +956,8 @@ enum virDomainChrChannelTargetType {
}; };
enum virDomainChrConsoleTargetType { enum virDomainChrConsoleTargetType {
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL = 0, VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE = 0,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL,
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,

View File

@ -569,13 +569,6 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid)
} }
static int esxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static virCapsPtr static virCapsPtr
esxCapsInit(esxPrivate *priv) esxCapsInit(esxPrivate *priv)
{ {
@ -600,7 +593,6 @@ esxCapsInit(esxPrivate *priv)
virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr"); virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr");
caps->defaultConsoleTargetType = esxDefaultConsoleType;
if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) { if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) {
goto failure; goto failure;

View File

@ -64,15 +64,6 @@ static const char *xen_cap_re = "(xen|hvm)-[[:digit:]]+\\.[[:digit:]]+-(x86_32|x
static regex_t xen_cap_rec; static regex_t xen_cap_rec;
static int libxlDefaultConsoleType(const char *ostype,
virArch arch ATTRIBUTE_UNUSED)
{
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(virArch hostarch, libxlBuildCapabilities(virArch hostarch,
int host_pae, int host_pae,
@ -162,8 +153,6 @@ libxlBuildCapabilities(virArch hostarch,
} }
} }
caps->defaultConsoleTargetType = libxlDefaultConsoleType;
return caps; return caps;
no_memory: no_memory:

View File

@ -431,10 +431,29 @@ virDomainXMLPrivateDataCallbacks libxlDomainXMLPrivateDataCallbacks = {
.free = libxlDomainObjPrivateFree, .free = libxlDomainObjPrivateFree,
}; };
static int
libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
STRNEQ(def->os.type, "hvm"))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
return 0;
}
virDomainDefParserConfig libxlDomainDefParserConfig = { virDomainDefParserConfig libxlDomainDefParserConfig = {
.macPrefix = { 0x00, 0x16, 0x3e }, .macPrefix = { 0x00, 0x16, 0x3e },
.devicesPostParseCallback = libxlDomainDeviceDefPostParse,
}; };
/* driver must be locked before calling */ /* driver must be locked before calling */
static void static void
libxlDomainEventQueue(libxlDriverPrivatePtr driver, virDomainEventPtr event) libxlDomainEventQueue(libxlDriverPrivatePtr driver, virDomainEventPtr event)

View File

@ -41,12 +41,6 @@
#define VIR_FROM_THIS VIR_FROM_LXC #define VIR_FROM_THIS VIR_FROM_LXC
static int lxcDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
}
/* Functions */ /* Functions */
virCapsPtr lxcCapsInit(virLXCDriverPtr driver) virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
@ -59,8 +53,6 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
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

View File

@ -93,6 +93,23 @@ virLXCDomainDefPostParse(virDomainDefPtr def,
return 0; return 0;
} }
static int
virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
return 0;
}
virDomainDefParserConfig virLXCDriverDomainDefParserConfig = { virDomainDefParserConfig virLXCDriverDomainDefParserConfig = {
.domainPostParseCallback = virLXCDomainDefPostParse, .domainPostParseCallback = virLXCDomainDefPostParse,
.devicesPostParseCallback = virLXCDomainDeviceDefPostParse,
}; };

View File

@ -168,13 +168,6 @@ error:
} }
static int openvzDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
}
virCapsPtr openvzCapsInit(void) virCapsPtr openvzCapsInit(void)
{ {
virCapsPtr caps; virCapsPtr caps;
@ -204,9 +197,8 @@ virCapsPtr openvzCapsInit(void)
NULL) == NULL) NULL) == NULL)
goto no_memory; goto no_memory;
caps->defaultConsoleTargetType = openvzDefaultConsoleType;
return caps; return caps;
no_memory: no_memory:
virObjectUnref(caps); virObjectUnref(caps);
return NULL; return NULL;

View File

@ -115,8 +115,24 @@ openvzDomainDefPostParse(virDomainDefPtr def,
} }
static int
openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
return 0;
}
virDomainDefParserConfig openvzDomainDefParserConfig = { virDomainDefParserConfig openvzDomainDefParserConfig = {
.domainPostParseCallback = openvzDomainDefPostParse, .domainPostParseCallback = openvzDomainDefPostParse,
.devicesPostParseCallback = openvzDomainDeviceDefPostParse,
}; };

View File

@ -96,12 +96,6 @@ parallelsDriverUnlock(parallelsConnPtr driver)
virMutexUnlock(&driver->lock); virMutexUnlock(&driver->lock);
} }
static int
parallelsDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static void static void
parallelsDomObjFreePrivate(void *p) parallelsDomObjFreePrivate(void *p)
@ -149,7 +143,6 @@ parallelsBuildCapabilities(void)
"parallels", NULL, NULL, 0, NULL) == NULL) "parallels", NULL, NULL, 0, NULL) == NULL)
goto no_memory; goto no_memory;
caps->defaultConsoleTargetType = parallelsDefaultConsoleType;
return caps; return caps;
no_memory: no_memory:

View File

@ -300,13 +300,6 @@ phypGetVIOSPartitionID(virConnectPtr conn)
} }
static int phypDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static virCapsPtr static virCapsPtr
phypCapsInit(void) phypCapsInit(void)
{ {
@ -337,8 +330,6 @@ 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:

View File

@ -856,17 +856,6 @@ error:
} }
static int virQEMUCapsDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch)
{
if (arch == VIR_ARCH_S390 ||
arch == VIR_ARCH_S390X)
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
else
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache) virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
{ {
virCapsPtr caps; virCapsPtr caps;
@ -906,8 +895,6 @@ virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
i) < 0) i) < 0)
goto error; goto error;
caps->defaultConsoleTargetType = virQEMUCapsDefaultConsoleType;
return caps; return caps;
error: error:

View File

@ -731,6 +731,13 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
} }
} }
/* set the default console type for S390 arches */
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
(def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
ret = 0; ret = 0;
cleanup: cleanup:

View File

@ -687,11 +687,6 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
return rc; return rc;
} }
static int aaDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static int static int
get_definition(vahControl * ctl, const char *xmlStr) get_definition(vahControl * ctl, const char *xmlStr)
@ -716,8 +711,6 @@ get_definition(vahControl * ctl, const char *xmlStr)
goto exit; goto exit;
} }
ctl->caps->defaultConsoleTargetType = aaDefaultConsoleType;
if ((guest = virCapabilitiesAddGuest(ctl->caps, if ((guest = virCapabilitiesAddGuest(ctl->caps,
ctl->hvm, ctl->hvm,
ctl->arch, ctl->arch,

View File

@ -152,13 +152,6 @@ static void testDomainObjPrivateFree(void *data)
} }
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static virDomainXMLOptionPtr static virDomainXMLOptionPtr
testBuildXMLConfig(void) testBuildXMLConfig(void)
{ {
@ -179,8 +172,6 @@ testBuildCapabilities(virConnectPtr conn) {
if ((caps = virCapabilitiesNew(VIR_ARCH_I686, 0, 0)) == NULL) if ((caps = virCapabilitiesNew(VIR_ARCH_I686, 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)

View File

@ -52,13 +52,6 @@
#define VIR_FROM_THIS VIR_FROM_UML #define VIR_FROM_THIS VIR_FROM_UML
static int umlDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML;
}
virCapsPtr umlCapsInit(void) { virCapsPtr umlCapsInit(void) {
virCapsPtr caps; virCapsPtr caps;
virCapsGuestPtr guest; virCapsGuestPtr guest;
@ -102,8 +95,6 @@ virCapsPtr umlCapsInit(void) {
NULL) == NULL) NULL) == NULL)
goto error; goto error;
caps->defaultConsoleTargetType = umlDefaultConsoleType;
return caps; return caps;
error: error:

View File

@ -420,6 +420,27 @@ cleanup:
umlDriverUnlock(driver); umlDriverUnlock(driver);
} }
static int
umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML;
return 0;
}
virDomainDefParserConfig umlDriverDomainDefParserConfig = {
.devicesPostParseCallback = umlDomainDeviceDefPostParse,
};
/** /**
* umlStartup: * umlStartup:
* *
@ -505,7 +526,8 @@ umlStartup(bool privileged,
if ((uml_driver->caps = umlCapsInit()) == NULL) if ((uml_driver->caps = umlCapsInit()) == NULL)
goto out_of_memory; goto out_of_memory;
if (!(uml_driver->xmlopt = virDomainXMLOptionNew(NULL, &privcb, NULL))) if (!(uml_driver->xmlopt = virDomainXMLOptionNew(&umlDriverDomainDefParserConfig,
&privcb, NULL)))
goto error; goto error;
if ((uml_driver->inotifyFD = inotify_init()) < 0) { if ((uml_driver->inotifyFD = inotify_init()) < 0) {

View File

@ -844,13 +844,6 @@ cleanup:
} }
static int vboxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static virDomainDefParserConfig vboxDomainDefParserConfig = { static virDomainDefParserConfig vboxDomainDefParserConfig = {
.macPrefix = { 0x08, 0x00, 0x27 }, .macPrefix = { 0x08, 0x00, 0x27 },
}; };
@ -893,8 +886,6 @@ static virCapsPtr vboxCapsInit(void)
NULL) == NULL) NULL) == NULL)
goto no_memory; goto no_memory;
caps->defaultConsoleTargetType = vboxDefaultConsoleType;
return caps; return caps;
no_memory: no_memory:

View File

@ -50,13 +50,6 @@ vmwareFreeDriver(struct vmware_driver *driver)
} }
static int vmwareDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
virCapsPtr virCapsPtr
vmwareCapsInit(void) vmwareCapsInit(void)
{ {
@ -122,8 +115,6 @@ vmwareCapsInit(void)
goto error; goto error;
} }
caps->defaultConsoleTargetType = vmwareDefaultConsoleType;
cleanup: cleanup:
virCPUDefFree(cpu); virCPUDefFree(cpu);
if (caps) if (caps)

View File

@ -265,11 +265,36 @@ xenUnifiedXendProbe(void)
#endif #endif
static int
xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
STRNEQ(def->os.type, "hvm"))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
return 0;
}
virDomainDefParserConfig xenDomainDefParserConfig = { virDomainDefParserConfig xenDomainDefParserConfig = {
.macPrefix = { 0x00, 0x16, 0x3e }, .macPrefix = { 0x00, 0x16, 0x3e },
.devicesPostParseCallback = xenDomainDeviceDefPostParse,
}; };
virDomainXMLOptionPtr
xenDomainXMLConfInit(void)
{
return virDomainXMLOptionNew(&xenDomainDefParserConfig,
NULL, NULL);
}
static virDrvOpenStatus static virDrvOpenStatus
xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
{ {
@ -405,8 +430,7 @@ xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
goto fail; goto fail;
} }
if (!(priv->xmlopt = virDomainXMLOptionNew(&xenDomainDefParserConfig, if (!(priv->xmlopt = xenDomainXMLConfInit()))
NULL, NULL)))
goto fail; goto fail;
#if WITH_XEN_INOTIFY #if WITH_XEN_INOTIFY

View File

@ -226,6 +226,8 @@ typedef struct _xenUnifiedPrivate *xenUnifiedPrivatePtr;
char *xenDomainUsedCpus(virDomainPtr dom); char *xenDomainUsedCpus(virDomainPtr dom);
virDomainXMLOptionPtr xenDomainXMLConfInit(void);
void xenUnifiedDomainInfoListFree(xenUnifiedDomainInfoListPtr info); void xenUnifiedDomainInfoListFree(xenUnifiedDomainInfoListPtr info);
int xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr info, int xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr info,
int id, char *name, int id, char *name,

View File

@ -2279,15 +2279,6 @@ struct guest_arch {
}; };
static int xenDefaultConsoleType(const char *ostype,
virArch arch ATTRIBUTE_UNUSED)
{
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, virArch hostarch, xenHypervisorBuildCapabilities(virConnectPtr conn, virArch hostarch,
int host_pae, int host_pae,
@ -2414,8 +2405,6 @@ xenHypervisorBuildCapabilities(virConnectPtr conn, virArch hostarch,
} }
caps->defaultConsoleTargetType = xenDefaultConsoleType;
return caps; return caps;
no_memory: no_memory:

View File

@ -43,16 +43,27 @@
#define VIR_FROM_THIS VIR_FROM_XENAPI #define VIR_FROM_THIS VIR_FROM_XENAPI
static int xenapiDefaultConsoleType(const char *ostype, static int
virArch arch ATTRIBUTE_UNUSED) xenapiDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{ {
if (STREQ(ostype, "hvm")) if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
else dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; STRNEQ(def->os.type, "hvm"))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
return 0;
} }
virDomainDefParserConfig xenapiDomainDefParserConfig = {
.devicesPostParseCallback = xenapiDomainDeviceDefPostParse,
};
/* /*
* getCapsObject * getCapsObject
* *
@ -83,8 +94,6 @@ getCapsObject(void)
if (!domain2) if (!domain2)
goto error_cleanup; goto error_cleanup;
caps->defaultConsoleTargetType = xenapiDefaultConsoleType;
return caps; return caps;
error_cleanup: error_cleanup:
@ -169,7 +178,8 @@ xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
goto error; goto error;
} }
if (!(privP->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL))) { if (!(privP->xmlopt = virDomainXMLOptionNew(&xenapiDomainDefParserConfig,
NULL, NULL))) {
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to create XML conf object")); _("Failed to create XML conf object"));
goto error; goto error;

View File

@ -8,13 +8,6 @@
# include "domain_conf.h" # include "domain_conf.h"
static int testLXCDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
}
virCapsPtr testLXCCapsInit(void) { virCapsPtr testLXCCapsInit(void) {
virCapsPtr caps; virCapsPtr caps;
virCapsGuestPtr guest; virCapsGuestPtr guest;
@ -23,8 +16,6 @@ virCapsPtr testLXCCapsInit(void) {
0, 0)) == NULL) 0, 0)) == NULL)
return NULL; return NULL;
caps->defaultConsoleTargetType = testLXCDefaultConsoleType;
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686, if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686,
"/usr/libexec/libvirt_lxc", NULL, "/usr/libexec/libvirt_lxc", NULL,
0, NULL)) == NULL) 0, NULL)) == NULL)

View File

@ -55,15 +55,6 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
return machines; return machines;
} }
static int testQemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch)
{
if (arch == VIR_ARCH_S390 ||
arch == VIR_ARCH_S390X)
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
else
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static int testQemuAddPPC64Guest(virCapsPtr caps) static int testQemuAddPPC64Guest(virCapsPtr caps)
{ {
@ -200,8 +191,6 @@ 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;

View File

@ -6,20 +6,6 @@
#include "testutilsxen.h" #include "testutilsxen.h"
#include "domain_conf.h" #include "domain_conf.h"
static int testXenDefaultConsoleType(const char *ostype,
virArch arch ATTRIBUTE_UNUSED)
{
if (STREQ(ostype, "hvm"))
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
else
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
}
virDomainXMLOptionPtr
testXenXMLConfInit(void)
{
return virDomainXMLOptionNew(NULL, NULL, NULL);
}
virCapsPtr testXenCapsInit(void) { virCapsPtr testXenCapsInit(void) {
struct utsname utsname; struct utsname utsname;
@ -39,8 +25,6 @@ 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;

View File

@ -1,6 +1,4 @@
#include "capabilities.h" #include "capabilities.h"
#include "domain_conf.h"
virCapsPtr testXenCapsInit(void); virCapsPtr testXenCapsInit(void);
virDomainXMLOptionPtr testXenXMLConfInit(void);

View File

@ -15,11 +15,6 @@ static virCapsPtr caps;
static virDomainXMLOptionPtr xmlopt; static virDomainXMLOptionPtr xmlopt;
static virVMXContext ctx; static virVMXContext ctx;
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static void static void
testCapsInit(void) testCapsInit(void)
@ -32,8 +27,6 @@ testCapsInit(void)
return; return;
} }
caps->defaultConsoleTargetType = testDefaultConsoleType;
virCapabilitiesAddHostMigrateTransport(caps, "esx"); virCapabilitiesAddHostMigrateTransport(caps, "esx");
/* i686 guest */ /* i686 guest */

View File

@ -196,7 +196,7 @@ mymain(void)
if (!(caps = testXenCapsInit())) if (!(caps = testXenCapsInit()))
return EXIT_FAILURE; return EXIT_FAILURE;
if (!(xmlopt = testXenXMLConfInit())) if (!(xmlopt = xenDomainXMLConfInit()))
return EXIT_FAILURE; return EXIT_FAILURE;
#define DO_TEST(name, version) \ #define DO_TEST(name, version) \

View File

@ -10,6 +10,7 @@
#include "internal.h" #include "internal.h"
#include "xen/xend_internal.h" #include "xen/xend_internal.h"
#include "xen/xen_driver.h"
#include "xenxs/xen_sxpr.h" #include "xenxs/xen_sxpr.h"
#include "testutils.h" #include "testutils.h"
#include "testutilsxen.h" #include "testutilsxen.h"
@ -104,7 +105,7 @@ mymain(void)
if (!(caps = testXenCapsInit())) if (!(caps = testXenCapsInit()))
return EXIT_FAILURE; return EXIT_FAILURE;
if (!(xmlopt = testXenXMLConfInit())) if (!(xmlopt = xenDomainXMLConfInit()))
return EXIT_FAILURE; return EXIT_FAILURE;
DO_TEST("pv", "pv", "pvtest", 1); DO_TEST("pv", "pv", "pvtest", 1);

View File

@ -15,11 +15,6 @@ static virCapsPtr caps;
static virVMXContext ctx; static virVMXContext ctx;
static virDomainXMLOptionPtr xmlopt; static virDomainXMLOptionPtr xmlopt;
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
virArch arch ATTRIBUTE_UNUSED)
{
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
static void static void
testCapsInit(void) testCapsInit(void)
@ -32,8 +27,6 @@ testCapsInit(void)
return; return;
} }
caps->defaultConsoleTargetType = testDefaultConsoleType;
virCapabilitiesAddHostMigrateTransport(caps, "esx"); virCapabilitiesAddHostMigrateTransport(caps, "esx");