Skip to content

Commit

Permalink
Merge pull request #23526 from baude/windowsgvisorpidnoterror
Browse files Browse the repository at this point in the history
Ignore ERROR_SHARING_VIOLATION error on windows
  • Loading branch information
openshift-merge-bot[bot] authored Aug 6, 2024
2 parents 4a9942a + 81003f2 commit 64020cd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/machine/gvproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ func CleanupGVProxy(f define.VMFile) error {
if err := waitOnProcess(proxyPid); err != nil {
return err
}
return f.Delete()
return removeGVProxyPIDFile(f)
}
7 changes: 7 additions & 0 deletions pkg/machine/gvproxy_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"syscall"
"time"

"github.com/containers/podman/v5/pkg/machine/define"
psutil "github.com/shirou/gopsutil/v3/process"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
Expand Down Expand Up @@ -72,3 +73,9 @@ func waitOnProcess(processID int) error {
}
return backoffForProcess(p)
}

// removeGVProxyPIDFile is just a wrapper to vmfile delete so we handle differently
// on windows
func removeGVProxyPIDFile(f define.VMFile) error {
return f.Delete()
}
13 changes: 13 additions & 0 deletions pkg/machine/gvproxy_windows.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package machine

import (
"errors"
"os"
"time"

"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/winquit/pkg/winquit"
"github.com/sirupsen/logrus"
"golang.org/x/sys/windows"
)

func waitOnProcess(processID int) error {
Expand Down Expand Up @@ -44,3 +47,13 @@ func waitOnProcess(processID int) error {

return nil
}

// removeGVProxyPIDFile special wrapper for deleting the GVProxyPIDFile on windows in case
// the file has an open handle which we will ignore. unix does not have this problem
func removeGVProxyPIDFile(f define.VMFile) error {
err := f.Delete()
if err != nil && !errors.Is(err, windows.ERROR_SHARING_VIOLATION) {
return err
}
return nil
}

1 comment on commit 64020cd

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

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

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.