ch: Do not add stub console to ch VMs

virDomainDefAddConsoleCompat in post parsing step appends a stub console
of type VIR_DOMAIN_CHR_TYPE_NULL to ch VMs' Domain XML. Cloud-hypervisor's
deviceValidateCallback (chValidateDomainDeviceDef) checks that the type of
stub console is not of type VIR_DOMAIN_CHR_TYPE_PTY and throws an error.

This commit introduces NO_STUB_CONSOLE feature check to Domain features and
uses it to skip adding stub console to ch VMs.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Praveen K Paladugu 2023-02-09 22:09:28 +00:00 committed by Michal Privoznik
parent 03f76e577d
commit 092176e5ec
3 changed files with 6 additions and 3 deletions

View File

@ -262,6 +262,7 @@ virDomainDefParserConfig virCHDriverDomainDefParserConfig = {
.domainPostParseBasicCallback = virCHDomainDefPostParseBasic,
.domainPostParseCallback = virCHDomainDefPostParse,
.deviceValidateCallback = chValidateDomainDeviceDef,
.features = VIR_DOMAIN_DEF_FEATURE_NO_STUB_CONSOLE,
};
virCHMonitor *

View File

@ -21751,9 +21751,10 @@ virDomainDefAddImplicitVideo(virDomainDef *def, virDomainXMLOption *xmlopt)
int
virDomainDefAddImplicitDevices(virDomainDef *def, virDomainXMLOption *xmlopt)
{
if (virDomainDefAddConsoleCompat(def) < 0)
return -1;
if ((xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_NO_STUB_CONSOLE) == 0) {
if (virDomainDefAddConsoleCompat(def) < 0)
return -1;
}
if (virDomainDefAddImplicitControllers(def) < 0)
return -1;

View File

@ -3231,6 +3231,7 @@ typedef enum {
VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT = (1 << 7),
VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING = (1 << 8),
VIR_DOMAIN_DEF_FEATURE_DISK_FD = (1 << 9),
VIR_DOMAIN_DEF_FEATURE_NO_STUB_CONSOLE = (1 << 10),
} virDomainDefFeatures;