[libvirt] [PATCH] conf: useserial: drop useless check for serial devices

Ján Tomko posted 1 patch 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/408cada38425a0ff0554e5a9e4d24b717950aee1.1503069587.git.jtomko@redhat.com
src/conf/domain_conf.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
[libvirt] [PATCH] conf: useserial: drop useless check for serial devices
Posted by Ján Tomko 6 years, 8 months ago
Since its introduction in commit 874e65aa, if someone requests:
<os><bios useserial="yes"/><os/>
we report an error if we cannot successfully count the number
of serial devices via an XPath query.

Instead of fixing the check (and moving it to the validation phase,
to prevent existing domains from disappearing), drop it completely.
For QEMU, the number of serials is checked when building the command
line.
---
 src/conf/domain_conf.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3bef5bed3..e563007ba 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16127,7 +16127,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
     int n;
     char *tmp = NULL;
     int ret = -1;
-    unsigned long deviceBoot, serialPorts;
+    unsigned long deviceBoot;
 
     if (virXPathULong("count(./devices/disk[boot]"
                       "|./devices/interface[boot]"
@@ -16204,18 +16204,10 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
     if ((node = virXPathNode("./os/bios[1]", ctxt))) {
         tmp = virXMLPropString(node, "useserial");
         if (tmp) {
-            if (STREQ(tmp, "yes")) {
-                if (virXPathULong("count(./devices/serial)",
-                                  ctxt, &serialPorts) < 0) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                                   _("need at least one serial port "
-                                     "for useserial"));
-                    goto cleanup;
-                }
+            if (STREQ(tmp, "yes"))
                 def->os.bios.useserial = VIR_TRISTATE_BOOL_YES;
-            } else {
+            else
                 def->os.bios.useserial = VIR_TRISTATE_BOOL_NO;
-            }
             VIR_FREE(tmp);
         }
 
-- 
2.13.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: useserial: drop useless check for serial devices
Posted by Pavel Hrdina 6 years, 7 months ago
On Fri, Aug 18, 2017 at 05:19:48PM +0200, Ján Tomko wrote:
> Since its introduction in commit 874e65aa, if someone requests:
> <os><bios useserial="yes"/><os/>
> we report an error if we cannot successfully count the number
> of serial devices via an XPath query.
> 
> Instead of fixing the check (and moving it to the validation phase,
> to prevent existing domains from disappearing), drop it completely.
> For QEMU, the number of serials is checked when building the command
> line.

The check from building the command line should be probably moved to
validation code, but that's for a different patch.

> ---
>  src/conf/domain_conf.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list