mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
ch_domain: Allow controller and chr devices
With the console and serial device handling fully functional, allow the required device types to be specified in the domain configuration. The configuration only supports a single serial or console device. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: William Douglas <william.douglas@intel.com>
This commit is contained in:
parent
d79b9a5a17
commit
6a77dd2b67
@ -216,6 +216,8 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
case VIR_DOMAIN_DEVICE_VSOCK:
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
@ -225,12 +227,10 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||
case VIR_DOMAIN_DEVICE_NVRAM:
|
||||
case VIR_DOMAIN_DEVICE_RNG:
|
||||
@ -255,6 +255,35 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((def->nconsoles &&
|
||||
def->consoles[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
|
||||
&& (def->nserials &&
|
||||
def->serials[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Only a single console or serial can be configured for this domain"));
|
||||
return -1;
|
||||
} else if (def->nconsoles > 1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Only a single console can be configured for this domain"));
|
||||
return -1;
|
||||
} else if (def->nserials > 1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Only a single serial can be configured for this domain"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->nconsoles && def->consoles[0]->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Console can only be enabled for a PTY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->nserials && def->serials[0]->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Serial can only be enabled for a PTY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user