conf: also mark the implicit video as primary

Commit 119cd06 started setting the primary bool for the first
user-specified video even if user omitted the 'primary' attribute.

However this was done before the addition of the implicit device.
This broke startup of transient qemu domains with no <video>:
https://bugzilla.redhat.com/show_bug.cgi?id=1325757

Move this default to virDomainDefPostParseInternal,
after the addition of the implicit video device, to catch the implicit
video as well.

(cherry picked from commit 6d8b6d2847f31a3d7a234536c12b8feca751a02f)
This commit is contained in:
Ján Tomko 2016-04-11 14:26:06 +02:00 committed by Cole Robinson
parent c273d72de6
commit 9bf5347469
68 changed files with 72 additions and 70 deletions

View File

@ -3926,6 +3926,11 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
if (virDomainDefAddImplicitDevices(def) < 0) if (virDomainDefAddImplicitDevices(def) < 0)
return -1; return -1;
/* Mark the first video as primary. If the user specified primary="yes",
* the parser already inserted the device at def->videos[0] */
if (def->nvideos != 0)
def->videos[0]->primary = true;
/* clean up possibly duplicated metadata entries */ /* clean up possibly duplicated metadata entries */
virDomainDefMetadataSanitize(def); virDomainDefMetadataSanitize(def);
@ -16368,9 +16373,6 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
} }
} }
/* if not specified by user mark the first video as primary */
if (n && !primaryVideo)
def->videos[0]->primary = true;
VIR_FREE(nodes); VIR_FREE(nodes);

View File

@ -27,7 +27,7 @@
<input type='keyboard' bus='ps2'/> <input type='keyboard' bus='ps2'/>
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -27,7 +27,7 @@
<input type='keyboard' bus='ps2'/> <input type='keyboard' bus='ps2'/>
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
<video> <video>
<model type='vga' vram='16384' heads='1'/> <model type='vga' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -29,7 +29,7 @@
<listen type='address' address='::'/> <listen type='address' address='::'/>
</graphics> </graphics>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -29,7 +29,7 @@
<listen type='address' address='127.0.0.1'/> <listen type='address' address='127.0.0.1'/>
</graphics> </graphics>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -27,7 +27,7 @@
<input type='keyboard' bus='ps2'/> <input type='keyboard' bus='ps2'/>
<graphics type='vnc' socket='/tmp/foo.socket'/> <graphics type='vnc' socket='/tmp/foo.socket'/>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -29,7 +29,7 @@
<listen type='address' address='127.0.0.1'/> <listen type='address' address='127.0.0.1'/>
</graphics> </graphics>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -22,7 +22,7 @@
<listen type='address' address='127.0.0.1'/> <listen type='address' address='127.0.0.1'/>
</graphics> </graphics>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -29,7 +29,7 @@
<listen type='address' address='2001:1:2:3:4:5:1234:1234'/> <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
</graphics> </graphics>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>

View File

@ -34,7 +34,7 @@
<input type='mouse' bus='usb'/> <input type='mouse' bus='usb'/>
<graphics type='sdl'/> <graphics type='sdl'/>
<video> <video>
<model type='cirrus' vram='16384' heads='1'/> <model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video> </video>
<memballoon model='none'/> <memballoon model='none'/>
<panic model='pseries'/> <panic model='pseries'/>

View File

@ -13,7 +13,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -26,7 +26,7 @@
<source bridge='VM NETWORK'/> <source bridge='VM NETWORK'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -26,7 +26,7 @@
<source bridge='vm network'/> <source bridge='vm network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -17,7 +17,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -17,7 +17,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -12,7 +12,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
<vmware:datacenterpath>folder1/folder2/datacenter1</vmware:datacenterpath> <vmware:datacenterpath>folder1/folder2/datacenter1</vmware:datacenterpath>

View File

@ -26,7 +26,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -53,7 +53,7 @@
<model type='vlance'/> <model type='vlance'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -35,7 +35,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -42,7 +42,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -37,7 +37,7 @@
<model type='e1000'/> <model type='e1000'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -30,7 +30,7 @@
<model type='vmxnet3'/> <model type='vmxnet3'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='8192'/> <model type='vmvga' vram='8192' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -29,7 +29,7 @@
<model type='vmxnet3'/> <model type='vmxnet3'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='8192'/> <model type='vmvga' vram='8192' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -17,7 +17,7 @@
<target dev='vmnet7'/> <target dev='vmnet7'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -17,7 +17,7 @@
<model type='e1000'/> <model type='e1000'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -15,7 +15,7 @@
<mac address='00:50:56:11:22:33'/> <mac address='00:50:56:11:22:33'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -17,7 +17,7 @@
<model type='vmxnet2'/> <model type='vmxnet2'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<source bridge='VM Network'/> <source bridge='VM Network'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='fdc' index='0'/> <controller type='fdc' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -23,7 +23,7 @@
</disk> </disk>
<controller type='fdc' index='0'/> <controller type='fdc' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -33,7 +33,7 @@
<source bridge=''/> <source bridge=''/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -13,7 +13,7 @@
<devices> <devices>
<graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/> <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -24,7 +24,7 @@
<target dev='/dev/vmnet1'/> <target dev='/dev/vmnet1'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -24,7 +24,7 @@
<target dev='/dev/vmnet1'/> <target dev='/dev/vmnet1'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -29,7 +29,7 @@
<target dev='/dev/vmnet2'/> <target dev='/dev/vmnet2'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -24,7 +24,7 @@
<target dev='/dev/vmnet2'/> <target dev='/dev/vmnet2'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -18,7 +18,7 @@
</disk> </disk>
<controller type='scsi' index='0'/> <controller type='scsi' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -19,7 +19,7 @@
</disk> </disk>
<controller type='ide' index='0'/> <controller type='ide' index='0'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -12,7 +12,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -12,7 +12,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<target port='0'/> <target port='0'/>
</parallel> </parallel>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<target port='0'/> <target port='0'/>
</parallel> </parallel>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -36,7 +36,7 @@
<controller type='scsi' index='2' model='lsisas1068'/> <controller type='scsi' index='2' model='lsisas1068'/>
<controller type='scsi' index='3' model='vmpvscsi'/> <controller type='scsi' index='3' model='vmpvscsi'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -19,7 +19,7 @@
</disk> </disk>
<controller type='scsi' index='0' model='buslogic'/> <controller type='scsi' index='0' model='buslogic'/>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -24,7 +24,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -20,7 +20,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -22,7 +22,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -22,7 +22,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -20,7 +20,7 @@
<target type='serial' port='0'/> <target type='serial' port='0'/>
</console> </console>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -16,7 +16,7 @@
<target dir='shared'/> <target dir='shared'/>
</filesystem> </filesystem>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -13,7 +13,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -12,7 +12,7 @@
<on_crash>destroy</on_crash> <on_crash>destroy</on_crash>
<devices> <devices>
<video> <video>
<model type='vmvga' vram='8192'/> <model type='vmvga' vram='8192' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -29,7 +29,7 @@
<model type='e1000'/> <model type='e1000'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>

View File

@ -30,7 +30,7 @@
<model type='e1000'/> <model type='e1000'/>
</interface> </interface>
<video> <video>
<model type='vmvga' vram='4096'/> <model type='vmvga' vram='4096' primary='yes'/>
</video> </video>
</devices> </devices>
</domain> </domain>