[libvirt] [PATCH v2 1/4] domain_conf: always set primary video device as primary

Martin Kletzander mkletzan at redhat.com
Wed Feb 24 13:08:40 UTC 2016

On Tue, Feb 23, 2016 at 05:58:08PM +0100, Pavel Hrdina wrote:
>We always place primary video device at first place, to make it easier
>to create a qemu command or format an xml, but we should also set the
>primary boolean for primary video device to 'true'.
>Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 3b15cb4..5e9c096 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -11918,7 +11918,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
>                 if ((primary = virXMLPropString(cur, "primary")) != NULL) {
>                     if (STREQ(primary, "yes"))
>-                        def->primary = 1;
>+                        def->primary = true;
>                     VIR_FREE(primary);
>                 }

So we already had this property, support it and behave based on it, we
just don't document it or use it very much, nice.  If I could, I would
put it somewhere else than in the <model/>, but that's gone...

>@@ -16060,6 +16060,10 @@ virDomainDefParseXML(xmlDocPtr xml,
>             goto error;
>         }
>     }
>+    /* if not specified by user mark the first video as primary */
>+    if (n && !primaryVideo)
>+        def->videos[0]->primary = true;

We basically used the first video as primary and we reorder them in
order for this to be true.  So this is true even if primaryVideo ==
true.  Anyway, I still see it as a good way to save that info as well.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160224/5ea46656/attachment-0001.sig>

More information about the libvir-list mailing list