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(a)linux.microsoft.com>
---
src/ch/ch_domain.c | 1 +
src/conf/domain_conf.c | 7 ++++---
src/conf/domain_conf.h | 1 +
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c
index 83defbb416..cf98654479 100644
--- a/src/ch/ch_domain.c
+++ b/src/ch/ch_domain.c
@@ -262,6 +262,7 @@ virDomainDefParserConfig virCHDriverDomainDefParserConfig = {
.domainPostParseBasicCallback = virCHDomainDefPostParseBasic,
.domainPostParseCallback = virCHDomainDefPostParse,
.deviceValidateCallback = chValidateDomainDeviceDef,
+ .features = VIR_DOMAIN_DEF_FEATURE_NO_STUB_CONSOLE,
};
virCHMonitor *
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ff1c78ecd1..a5578324b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e684edcf95..62f80d653d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -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;
--
2.34.1