Skip to content

Bind QEMU GA socket only in virtio mode #3393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkg/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Config struct {
LimaYAML *limayaml.LimaYAML
SSHLocalPort int
SSHAddress string
VirtioGA bool
}

// MinimumQemuVersion is the minimum supported QEMU version.
Expand Down Expand Up @@ -987,11 +988,13 @@ func Cmdline(ctx context.Context, cfg Config) (exe string, args []string, err er
args = append(args, "-chardev", fmt.Sprintf("socket,id=%s,path=%s,server=on,wait=off", qmpChardev, qmpSock))
args = append(args, "-qmp", "chardev:"+qmpChardev)

// Guest agent via serialport
guestSock := filepath.Join(cfg.InstanceDir, filenames.GuestAgentSock)
args = append(args, "-chardev", fmt.Sprintf("socket,path=%s,server=on,wait=off,id=qga0", guestSock))
args = append(args, "-device", "virtio-serial")
args = append(args, "-device", "virtserialport,chardev=qga0,name="+filenames.VirtioPort)
if cfg.VirtioGA {
// Guest agent via serialport
guestSock := filepath.Join(cfg.InstanceDir, filenames.GuestAgentSock)
args = append(args, "-chardev", fmt.Sprintf("socket,path=%s,server=on,wait=off,id=qga0", guestSock))
args = append(args, "-device", "virtio-serial")
args = append(args, "-device", "virtserialport,chardev=qga0,name="+filenames.VirtioPort)
}

// QEMU process
args = append(args, "-name", "lima-"+cfg.Name)
Expand Down
1 change: 1 addition & 0 deletions pkg/qemu/qemu_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (l *LimaQemuDriver) Start(ctx context.Context) (chan error, error) {
LimaYAML: l.Instance.Config,
SSHLocalPort: l.SSHLocalPort,
SSHAddress: l.Instance.SSHAddress,
VirtioGA: l.VirtioPort != "",
}
qExe, qArgs, err := Cmdline(ctx, qCfg)
if err != nil {
Expand Down
Loading