will add a default <code>video</code> according to the guest type.
For a guest of type "kvm", the default <code>video</code> for it is:
<code>type</code> with value "cirrus", <code>vram</code> with value
- "9216", and <code>heads</code> with value "1".
+ "9216", and <code>heads</code> with value "1". By default, the first
+ video device in domain xml is the primary one, but the optional
+ attribute <code>primary</code> (<span class="since">since 1.0.2</span>)
+ with value 'yes' can be used to mark the primary in cases of mutiple
+ video device. The non-primary must be type of "qxl".
</dd>
<dt><code>model</code></dt>
char *type = NULL;
char *heads = NULL;
char *vram = NULL;
+ char *primary = NULL;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
type = virXMLPropString(cur, "type");
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
+
+ if ((primary = virXMLPropString(cur, "primary")) != NULL)
+ if (STREQ(primary, "yes"))
+ def->primary = 1;
+
def->accel = virDomainVideoAccelDefParseXML(cur);
}
}
xmlNodePtr cur;
bool usb_none = false;
bool usb_other = false;
+ bool primaryVideo = false;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
if (n && VIR_ALLOC_N(def->videos, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
+ size_t ii = def->nvideos;
virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[i],
def,
flags);
if (!video)
goto error;
- def->videos[def->nvideos++] = video;
+
+ if (video->primary) {
+ if (primaryVideo) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only one primary video device is supported"));
+ goto error;
+ }
+
+ ii = 0;
+ primaryVideo = true;
+ }
+ if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
+ ii,
+ def->nvideos,
+ video) < 0)
+ goto error;
}
VIR_FREE(nodes);
virBufferAsprintf(buf, " vram='%u'", def->vram);
if (def->heads)
virBufferAsprintf(buf, " heads='%u'", def->heads);
+ if (def->primary)
+ virBufferAddLit(buf, " primary='yes'");
if (def->accel) {
virBufferAddLit(buf, ">\n");
virDomainVideoAccelDefFormat(buf, def->accel);