Skip to content

Conversation

@stuffbucket
Copy link

Adds SPICE protocol support for QEMU VMs. SPICE provides remote display with audio streaming, clipboard sharing, and optional OpenGL acceleration.

Changes:

  • qemu_driver.go - Detect SPICE in the display string, add audio backend args
  • qemu.go - Parse SPICE display options
  • qemu_test.go - Test cases for SPICE args
  • lima_yaml.go - Add video.spice config struct (audio, gl, agent bools)

Templates:

  • spice-audio.yaml: Minimal SPICE with audio
  • ubuntu-desktop-spice.yaml: Full desktop with GL acceleration
  • ubuntu-desktop-simple.yaml: Cloud image + XFCE
  • ubuntu-desktop-iso.yaml: Installer ISO approach

- Add SPICEOptions to YAML schema (GL, streamingVideo, agent, audio)
- Detect SPICE audio configuration and route through spice audiodev
- Query SPICE port via QMP for display connection
- Add SPICE password change support via QMP
- Add unit tests for SPICE audio detection

Signed-off-by: stuffbucket <231133237+stuffbucket@users.noreply.github.com>
@stuffbucket stuffbucket force-pushed the pr/qemu-spice-support branch from d90ead1 to 9337bf6 Compare December 19, 2025 03:20
@stuffbucket
Copy link
Author

There is a trailing new line on the ubuntu-desktop-spice.yaml template. I can resubmit the PR if you'd like. I tried to catch all the linting in the branch but this one got through. I don't want to trigger CI runners for a blank line at the end of the file unless that's what is desired (assuming the PR gets accepted).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems too many templates; they could be consolidated with params?

param:
containerdSnapshotter: true

Copy link
Member

@afbjorklund afbjorklund Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only add the minimal template, the rest (ubuntu desktop) are better off downstream?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine with me. I can put them on my github page if folks are ok with that. I'm not sure what the convention is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubuntu-desktop

This seems xubuntu, not ubuntu

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I wasn't sure if the naming convention should reflect Ubuntu or Xubuntu. I can change or reduce the number of templates and host them elsewhere. These were only intended as examples.

loadDotSSHPubKeys: true

firmware:
legacyBIOS: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default configurations do not need to be copied


ssh:
localPort: 0
loadDotSSHPubKeys: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?


cpus: 4
memory: "8GiB"
disk: "50GiB"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the default values?
They are automatically adjusted depending on the amount of the host resources.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specified resources in the template so that it was clearer what a well performing VM with a full desktop would probably need. I've run the debian-trixie-plasma template on 2 vCPUS with less RAM. These could be removed or turned into a comment that points to the distro's resource suggestions.

This will take several minutes and the VM will reboot automatically.

After the VM reboots, connect to the SPICE display:
remote-viewer spice://127.0.0.1:5930
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Password?

like

* VNC Password: see <file://{{.Dir}}/vncpassword>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, the code is reusing the VNC password for the SPICE password.

We might want to make the messages and filenames more generic, some day?

macOS: brew install virt-viewer
Linux: sudo apt-get install virt-viewer

The desktop will auto-login as user: lima
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the user name changed?

@afbjorklund
Copy link
Member

afbjorklund commented Dec 19, 2025

I'm getting an error from the message:

  Configuration:
    Display: {{.Video.Display}}
    Audio: SPICE streaming (enabled)

template: format:21:19: executing "format" at <.Video.Display>: can't evaluate field Video in type store.FormatData]

@afbjorklund
Copy link
Member

Will need some better checking and reporting, right now the driver will crash with only a debug message.

"qemu[stderr]: qemu-system-x86_64: -audiodev spice,id=default: Parameter 'driver' does not accept value 'spice'"

@afbjorklund
Copy link
Member

@stuffbucket the DCO will require you to use your real name for signing the commits:

Signed-off-by: stuffbucket <231133237+stuffbucket@users.noreply.github.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants