Skip to content

Commit 9f90a4b

Browse files
jonnereskultety
authored andcommitted
qemu: maintain user alias for video type 'none'
After parsing a video device with a model type of VIR_DOMAIN_VIDEO_TYPE_NONE, all device info is cleared (see virDomainDefPostParseVideo()) in order to avoid formatting any auto-generated values for the XML. Subsequently, however, an alias is generated for the video device (e.g. 'video0'), which results in an alias property being formatted in the XML output anyway. This creates confusion if the user has explicitly provided an alias for the video device since the alias will change. To avoid this, don't clear the user-defined alias for video devices of type "none". https://bugzilla.redhat.com/show_bug.cgi?id=1720612 Signed-off-by: Jonathon Jongsma <[email protected]> Reviewed-by: Erik Skultety <[email protected]>
1 parent 0bd4ad1 commit 9f90a4b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/conf/domain_conf.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5635,11 +5635,15 @@ virDomainDefPostParseVideo(virDomainDefPtr def,
56355635
return 0;
56365636

56375637
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_NONE) {
5638+
char *alias;
5639+
56385640
/* we don't want to format any values we automatically fill in for
5639-
* videos into the XML, so clear them
5640-
*/
5641+
* videos into the XML, so clear them, but retain any user-assigned
5642+
* alias */
5643+
VIR_STEAL_PTR(alias, def->videos[0]->info.alias);
56415644
virDomainVideoDefClear(def->videos[0]);
56425645
def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_NONE;
5646+
VIR_STEAL_PTR(def->videos[0]->info.alias, alias);
56435647
} else {
56445648
virDomainDeviceDef device = {
56455649
.type = VIR_DOMAIN_DEVICE_VIDEO,

tests/qemuxml2argvdata/video-none-device.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<graphics type='vnc'/>
3232
<video>
3333
<model type='none'/>
34+
<alias name='ua-user-video-alias'/>
3435
</video>
3536
<memballoon model='virtio'>
3637
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

tests/qemuxml2xmloutdata/video-none-device.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
</graphics>
3535
<video>
3636
<model type='none'/>
37+
<alias name='ua-user-video-alias'/>
3738
</video>
3839
<memballoon model='virtio'>
3940
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

0 commit comments

Comments
 (0)