"on" and "off" (default). <span class="since">Since 1.3.1</span>.
</p>
+ <p>
+ Regardless of the<code>type</code>, character devices can
+ have an optional log file associated with them. This is
+ expressed via a <code>log</code> sub-element, with a
+ <code>file</code> attribute. There can also be a <code>append</code>
+ attribute which takes teh same values described above.
+ <span class="since">1.3.3</span>.
+ </p>
+
+ <pre>
+ ...
+ <log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>
+ ...</pre>
+
<p>
Each character device element has an optional
sub-element <code><address></code> which can tie the
VIR_FREE(def->data.spiceport.channel);
break;
}
+
+ VIR_FREE(def->logfile);
}
/* Deep copies the contents of src into dest. Return -1 and report
char *connectHost = NULL;
char *connectService = NULL;
char *path = NULL;
+ char *logfile = NULL;
+ char *logappend = NULL;
char *mode = NULL;
char *protocol = NULL;
char *channel = NULL;
}
ctxt->node = saved_node;
}
+ } else if (xmlStrEqual(cur->name, BAD_CAST "log")) {
+ if (!logfile)
+ logfile = virXMLPropString(cur, "file");
+ if (!logappend)
+ logappend = virXMLPropString(cur, "append");
} else if (xmlStrEqual(cur->name, BAD_CAST "protocol")) {
if (!protocol)
protocol = virXMLPropString(cur, "type");
break;
}
+ def->logfile = logfile;
+ logfile = NULL;
+
+ if (logappend != NULL &&
+ (def->logappend = virTristateSwitchTypeFromString(logappend)) <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid append attribute value '%s'"), logappend);
+ goto error;
+ }
+
cleanup:
VIR_FREE(mode);
VIR_FREE(protocol);
VIR_FREE(path);
VIR_FREE(channel);
VIR_FREE(append);
+ VIR_FREE(logappend);
+ VIR_FREE(logfile);
return remaining;
}
+ if (def->logfile) {
+ virBufferEscapeString(buf, "<log file='%s'", def->logfile);
+ if (def->logappend != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(buf, " append='%s'",
+ virTristateSwitchTypeToString(def->logappend));
+ }
+ virBufferAddLit(buf, "/>\n");
+ }
+
return 0;
}