}
+static void
+virDomainGraphicsDefFormatListnes(virBuffer *childBuf,
+ virDomainGraphicsDef *def,
+ unsigned int flags)
+{
+ size_t i;
+
+ for (i = 0; i < def->nListens; i++) {
+ if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) {
+ /* If the listen is based on config options from qemu.conf we need
+ * to skip it. It's up to user to properly configure both hosts for
+ * migration. */
+ if (def->listens[i].fromConfig)
+ continue;
+
+ /* If the socket is provided by user in the XML we need to skip this
+ * listen type to support migration back to old libvirt since old
+ * libvirt supports specifying socket path inside graphics element
+ * as 'socket' attribute. Auto-generated socket is a new feature
+ * thus we can generate it in the migrateble XML. */
+ if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
+ def->listens[i].socket &&
+ !def->listens[i].autoGenerated)
+ continue;
+
+ /* The new listen type none is in the migratable XML represented as
+ * port=0 and autoport=no because old libvirt support this
+ * configuration for spice. */
+ if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE)
+ continue;
+ }
+ virDomainGraphicsListenDefFormat(childBuf, &def->listens[i], flags);
+ }
+}
+
+
/**
* virDomainGraphicsListenDefFormatAddr:
* @buf: buffer where the output XML is written
break;
}
- for (i = 0; i < def->nListens; i++) {
- if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) {
- /* If the listen is based on config options from qemu.conf we need
- * to skip it. It's up to user to properly configure both hosts for
- * migration. */
- if (def->listens[i].fromConfig)
- continue;
-
- /* If the socket is provided by user in the XML we need to skip this
- * listen type to support migration back to old libvirt since old
- * libvirt supports specifying socket path inside graphics element
- * as 'socket' attribute. Auto-generated socket is a new feature
- * thus we can generate it in the migrateble XML. */
- if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
- def->listens[i].socket &&
- !def->listens[i].autoGenerated)
- continue;
-
- /* The new listen type none is in the migratable XML represented as
- * port=0 and autoport=no because old libvirt support this
- * configuration for spice. */
- if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE)
- continue;
- }
- virDomainGraphicsListenDefFormat(&childBuf, &def->listens[i], flags);
- }
+ virDomainGraphicsDefFormatListnes(&childBuf, def, flags);
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
g_auto(virBuffer) spiceBuf = VIR_BUFFER_INITIALIZER;