Skip to content

[BUG] Update displays produces new id for displays #7145

Description

@naveenrajm7

Describe the issue
Updating/removing displays results in id of the display object being changed

Configuration

  • UTM Version: 4.5.6
  • macOS Version:
  • Mac Chip (Intel, M1, ...):

Debug

# Add first display
%osascript add_qemu_display.applescript F0B3F201-7C68-41F8-BDE6-9C63A6EC70E7 --hardware "virtio-gpu-pci"            
000D1CC3-61B4-4A0D-B60E-AE6151248467

# Get display , the id is same 
%osascript display_qemu_get.applescript alpine-3
downscaling filter:linear, upscaling filter:nearest, dynamic resolution:true, hardware:virtio-gpu-pci, id:000D1CC3-61B4-4A0D-B60E-AE6151248467, native resolution:false

# add second display
%osascript add_qemu_display.applescript F0B3F201-7C68-41F8-BDE6-9C63A6EC70E7 --hardware "virtio-ramfb"  
C3329FF7-B083-425C-B022-4E709650B270

# get display, first display id is different  
%osascript display_qemu_get.applescript alpine-3
native resolution:false, upscaling filter:nearest, downscaling filter:linear, hardware:virtio-gpu-pci, id:DF475EE4-9BA5-4D23-AFC7-67D6D2B48B27, dynamic resolution:true, id:C3329FF7-B083-425C-B022-4E709650B270, downscaling filter:linear, upscaling filter:nearest, hardware:virtio-ramfb, dynamic resolution:true, native resolution:false

# remove display
%osascript remove_qemu_display.applescript F0B3F201-7C68-41F8-BDE6-9C63A6EC70E7 C3329FF7-B083-425C-B022-4E709650B270

# get display, id changed again
%osascript display_qemu_get.applescript alpine-3
downscaling filter:linear, upscaling filter:nearest, native resolution:false, hardware:virtio-gpu-pci, id:87C7F14D-8FF0-4D5B-9194-10EA07C67429, dynamic resolution:true

I tried the solution below,
In updateQemuDisplays use updateIdentifiedElements instead of updateElements.
Do same in updateAppleDisplays.

I am not sure what is contributing to cause new id to be generated for every update, this make it harder to track the added display.
Any pointers appreciated.

Script used :

on run argv
  set vmName to item 1 of argv

  tell application "UTM"
      set vm to virtual machine named vmName
      set config to configuration of vm
      set currentDisplay to displays of config

      set newDisplay to ¬
          { ¬
              hardware: "virtio-gpu-pci", ¬
              dynamic resolution: false, ¬
              native resolution: true, ¬
              upscaling filter: "QsLi", ¬
              downscaling filter: "QsNe" ¬
          }
      
      set end of currentDisplay to newDisplay
      set displays of config to currentDisplay
      


      update configuration of vm with config
  end tell
end run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions