From a0984bcabb0c9cf052f2dd40fe908f086df348f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 9 May 2025 18:30:55 -0400 Subject: [PATCH] incus-agent: Skip /dev/incus on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- cmd/incus-agent/api_1.0.go | 8 ++++++++ cmd/incus-agent/os_linux.go | 1 + cmd/incus-agent/os_windows.go | 1 + 3 files changed, 10 insertions(+) diff --git a/cmd/incus-agent/api_1.0.go b/cmd/incus-agent/api_1.0.go index 7ce7e1756..ba0b3b5ff 100644 --- a/cmd/incus-agent/api_1.0.go +++ b/cmd/incus-agent/api_1.0.go @@ -111,6 +111,10 @@ func api10Put(d *Daemon, r *http.Request) response.Response { } func startDevIncusServer(d *Daemon) error { + if !osGuestAPISupport { + return nil + } + d.DevIncusMu.Lock() defer d.DevIncusMu.Unlock() @@ -148,6 +152,10 @@ func startDevIncusServer(d *Daemon) error { } func stopDevIncusServer(d *Daemon) error { + if !osGuestAPISupport { + return nil + } + d.DevIncusMu.Lock() d.DevIncusRunning = false d.DevIncusMu.Unlock() diff --git a/cmd/incus-agent/os_linux.go b/cmd/incus-agent/os_linux.go index 5bfb4f5bd..036dafeb0 100644 --- a/cmd/incus-agent/os_linux.go +++ b/cmd/incus-agent/os_linux.go @@ -49,6 +49,7 @@ var ( osExitStatus = linux.ExitStatus osBaseWorkingDirectory = "/" osMetricsSupported = true + osGuestAPISupport = true ) func osGetEnvironment() (*api.ServerEnvironment, error) { diff --git a/cmd/incus-agent/os_windows.go b/cmd/incus-agent/os_windows.go index 2da8d7be1..1f268403b 100644 --- a/cmd/incus-agent/os_windows.go +++ b/cmd/incus-agent/os_windows.go @@ -26,6 +26,7 @@ var ( osShutdownSignal = os.Interrupt osBaseWorkingDirectory = "C:\\" osMetricsSupported = false + osGuestAPISupport = false ) func osGetEnvironment() (*api.ServerEnvironment, error) {