Skip to content

Commit

Permalink
lxd/instance/drivers: Applying similar fix to deviceAttachPath
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
  • Loading branch information
hamistao committed May 23, 2024
1 parent fa653b3 commit 12900de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,16 @@ func (d *qemu) deviceAttachPath(deviceName string, configCopy map[string]string,
return fmt.Errorf("Failed to connect to QMP monitor: %w", err)
}

addr, err := net.ResolveUnixAddr("unix", virtiofsdSockPath)
virtiofsdSocketDir, err := os.Open(filepath.Dir(virtiofsdSockPath))
if err != nil {
return err
}

defer func() { _ = virtiofsdSocketDir.Close() }()

shortPath := fmt.Sprintf("/proc/self/fd/%d/%s", virtiofsdSocketDir.Fd(), filepath.Base(virtiofsdSockPath))

addr, err := net.ResolveUnixAddr("unix", shortPath)
if err != nil {
return err
}
Expand Down

0 comments on commit 12900de

Please sign in to comment.