From a4ba59ff4ba02f24aeffbfd7f92dfa48a154f3b7 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Fri, 18 Aug 2017 18:19:48 +0200 Subject: [PATCH] conf: separate PTY chardev source parsing There is no reason why to share the same code for PTY and other file based chardev source types. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 49e24d9fe8..9adf333015 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11129,14 +11129,16 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_PTY: - case VIR_DOMAIN_CHR_TYPE_DEV: - case VIR_DOMAIN_CHR_TYPE_PIPE: /* PTY path is only parsed from live xml. */ - if (def->type != VIR_DOMAIN_CHR_TYPE_PTY || - !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) + if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) def->data.file.path = virXMLPropString(cur, "path"); break; + case VIR_DOMAIN_CHR_TYPE_DEV: + case VIR_DOMAIN_CHR_TYPE_PIPE: + def->data.file.path = virXMLPropString(cur, "path"); + break; + case VIR_DOMAIN_CHR_TYPE_UNIX: if (virDomainChrSourceDefParseUnix(def, cur) < 0) goto error; @@ -11209,6 +11211,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, switch ((virDomainChrType) def->type) { case VIR_DOMAIN_CHR_TYPE_NULL: + case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_VC: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_SPICEVMC: @@ -11216,11 +11219,9 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_FILE: - case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_PIPE: - if (!def->data.file.path && - def->type != VIR_DOMAIN_CHR_TYPE_PTY) { + if (!def->data.file.path) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing source path attribute for char device")); goto error; -- GitLab