incus: apply qemu 9.1 patches

This commit is contained in:
Adam Stephens 2024-09-07 10:42:49 -04:00
parent 77e1f40eed
commit 17ed2a5b50
No known key found for this signature in database
4 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 0c37b7e3ec65b4d0e166e2127d9f1835320165b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Fri, 6 Sep 2024 17:07:11 -0400
Subject: [PATCH] incusd/instance/qemu: Make O_DIRECT conditional on
directCache
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
internal/server/instance/drivers/driver_qemu.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go
index 5a94c9db43..9609b73c1b 100644
--- a/internal/server/instance/drivers/driver_qemu.go
+++ b/internal/server/instance/drivers/driver_qemu.go
@@ -4276,7 +4276,9 @@ func (d *qemu) addDriveConfig(qemuDev map[string]string, bootIndexes map[string]
permissions = unix.O_RDONLY
}
- permissions |= unix.O_DIRECT
+ if directCache {
+ permissions |= unix.O_DIRECT
+ }
f, err := os.OpenFile(driveConf.DevPath, permissions, 0)
if err != nil {

View File

@ -0,0 +1,28 @@
From 572afb06f66f83ca95efa1b9386fceeaa1c9e11b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Fri, 6 Sep 2024 15:51:35 -0400
Subject: [PATCH] incusd/instance/qemu: Set O_DIRECT when passing in FDs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is required in most cases with QEMU 9.1.0.
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
internal/server/instance/drivers/driver_qemu.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go
index 37da21f42f..e25aab0667 100644
--- a/internal/server/instance/drivers/driver_qemu.go
+++ b/internal/server/instance/drivers/driver_qemu.go
@@ -4277,6 +4277,8 @@ func (d *qemu) addDriveConfig(qemuDev map[string]string, bootIndexes map[string]
permissions = unix.O_RDONLY
}
+ permissions |= unix.O_DIRECT
+
f, err := os.OpenFile(driveConf.DevPath, permissions, 0)
if err != nil {
return fmt.Errorf("Failed opening file descriptor for disk device %q: %w", driveConf.DevName, err)

View File

@ -0,0 +1,33 @@
From 58eeb4eeee8a9e7f9fa9c62443d00f0ec6797078 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Fri, 6 Sep 2024 17:10:01 -0400
Subject: [PATCH] incusd/instance/qemu: Force threads I/O mode for
unsafe/writeback
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The default "native" aioMode requires direct I/O which is incompatible
with unsafe/writeback.
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
internal/server/instance/drivers/driver_qemu.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go
index 9609b73c1b..a5a4944d40 100644
--- a/internal/server/instance/drivers/driver_qemu.go
+++ b/internal/server/instance/drivers/driver_qemu.go
@@ -4088,9 +4088,11 @@ func (d *qemu) addDriveConfig(qemuDev map[string]string, bootIndexes map[string]
noFlushCache := false // Don't ignore any flush requests for the device.
if cacheMode == "unsafe" {
+ aioMode = "threads"
directCache = false
noFlushCache = true
} else if cacheMode == "writeback" {
+ aioMode = "threads"
directCache = false
}

View File

@ -2,5 +2,10 @@ import ./generic.nix {
hash = "sha256-FdoJI0SUH8KS3Epyw/HejgyhISWGLePsIjYUS2YTBvc=";
version = "6.5.0";
vendorHash = "sha256-8e2X7HIy1IEx6p41SHJyq5dNUJ3rRC2maXC4uNaSlnk=";
patches = [ ];
patches = [
# qemu 9.1 compat, remove in 6.6
./572afb06f66f83ca95efa1b9386fceeaa1c9e11b.patch
./58eeb4eeee8a9e7f9fa9c62443d00f0ec6797078.patch
./0c37b7e3ec65b4d0e166e2127d9f1835320165b8.patch
];
}