Skip to content

Commit bf08ddb

Browse files
authored
Merge pull request #3393 from arixmkii/fix-qemu-socket
Bind QEMU GA socket only in virtio mode
2 parents c2833b8 + 940a2f8 commit bf08ddb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/qemu/qemu.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Config struct {
4444
LimaYAML *limayaml.LimaYAML
4545
SSHLocalPort int
4646
SSHAddress string
47+
VirtioGA bool
4748
}
4849

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

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

995998
// QEMU process
996999
args = append(args, "-name", "lima-"+cfg.Name)

pkg/qemu/qemu_driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func (l *LimaQemuDriver) Start(ctx context.Context) (chan error, error) {
7777
LimaYAML: l.Instance.Config,
7878
SSHLocalPort: l.SSHLocalPort,
7979
SSHAddress: l.Instance.SSHAddress,
80+
VirtioGA: l.VirtioPort != "",
8081
}
8182
qExe, qArgs, err := Cmdline(ctx, qCfg)
8283
if err != nil {

0 commit comments

Comments
 (0)