[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Redundant listen address entry in quest xml



On Thu, Aug 14, 2014 at 12:12:33PM +0100, Daniel P. Berrange wrote:
On Thu, Aug 14, 2014 at 01:09:32PM +0200, Erik Skultety wrote:
When editing guest's XML (on QEMU), it was possible to add multiple
listen elements into graphics parent element. However QEMU does not
support listening on multiple addresses. This patch causes qemu
post-parse callback to remove any redundant entries, leaving only 1
listening address if provided, otherwise the configuration remains
untouched.

Discarding part of the users requested config like this is not
the right thing todo. If the user requests multiple listen addresses
and we cannot honour that request that we must report that as an
error with code VIR_ERR_CONFIG_UNSUPPORTED


But if we didn't failed parsing that before, domains with such XMLs
will disappear from the list after daemon restart.

---
 src/qemu/qemu_domain.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4f63c88..75a4446 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -827,6 +827,25 @@ qemuDomainDefPostParse(virDomainDefPtr def,
                                   VIR_DOMAIN_INPUT_BUS_USB) < 0)
         return -1;

+    /* loop over all graphics connections and all listening addresses,
+     * removing all redundant listening address entries, thus leaving
+     * only 1 entry
+     */
+    if (def->ngraphics > 0 && def->graphics) {
+        size_t i, j;
+        for (i = 0; i < def->ngraphics; i++) {
+            virDomainGraphicsListenDefPtr listens = def->graphics[i]->listens;
+            size_t nListens = def->graphics[i]->nListens;
+            if (nListens <= 1 || !listens)
+                continue;
+            for (j = 1; j < nListens; j++) {
+                VIR_FREE(listens[j].address);
+                VIR_FREE(listens[j].network);
+            }
+            def->graphics[i]->nListens = 1;
+        }
+    }
+
     return 0;
 }


Regards,
Daniel
--
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]