On Mon, Aug 28, 2017 at 02:56:50PM +0200, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
docs/formatdomain.html.in     |  11 ++++
docs/schemas/domaincommon.rng |  12 +++++
src/conf/domain_conf.c        | 119 +++++++++++++++++++++++++++++++++++++++---
src/conf/domain_conf.h        |  11 ++++
4 files changed, 145 insertions(+), 8 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fba8cfc6f3..205122f28e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6298,6 +6298,17 @@ qemu-kvm -net nic,model=? /dev/null
      slot.
    </p>

+    <p>
+      For character device with type <code>unix</code> or <code>tcp</code>
+      the <code>source</code> has an optional element <code>reconnect</code>
+      which configures reconnect timeout if the connection is lost.
+      There are two attributes, <code>enabled</code> where possible
+      values are <code>yes</code> and <code>no</code> and <code>timeout</code>

Please put the possible values for 'enabled' attribute in parentheses to
differentiate them from the attribute names.

+      which is in seconds. The <code>reconnect</code> attribute is valid only
+      for <code>connect</code> mode.
+      <span class="since">Since 3.7.0 (QEMU driver only)</span>.
+    </p>
+
    <h5><a id="elementsCharGuestInterface">Guest interface</a></h5>

    <p>
@@ -11115,6 +11127,56 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
    return ret;
}

+static int
+virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
+                                       xmlNodePtr node,
+                                       xmlXPathContextPtr ctxt)
+{
+    int ret = -1;
+    int tmpVal;
+    char *tmp = NULL;
+    xmlNodePtr saveNode = ctxt->node;
+    xmlNodePtr cur;
+
+    ctxt->node = node;
+
+    if ((cur = virXPathNode("./reconnect", ctxt))) {
+        if ((tmp = virXMLPropString(cur, "enabled"))) {
+            if ((tmpVal = virTristateBoolTypeFromString(tmp)) < 0) {
+                virReportError(VIR_ERR_XML_ERROR,
+                               _("invalid reconnect enabled value: '%s'"),
+                               tmp);
+                goto cleanup;
+            }
+            def->enabled = tmpVal;
+            VIR_FREE(tmp);
+        }
+
+        if (def->enabled == VIR_TRISTATE_BOOL_YES) {
+            if ((tmp = virXMLPropString(cur, "timeout"))) {
+                if (virStrToLong_ui(tmp, NULL, 10, &def->timeout) < 0) {
+                    virReportError(VIR_ERR_XML_ERROR,
+                                   _("invalid reconnect enabled value: '%s'"),

s/enabled/timeout/

Jan
+                                   tmp);
+                    goto cleanup;
+                }
+                VIR_FREE(tmp);

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to