Skip to content

Commit

Permalink
kata-runtime: add patch for compatibility with QEMU 9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Aug 2, 2024
1 parent dee3954 commit dcb904a
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
From 08d7d998c183f8beb92a334f0e08b5baab1cc866 Mon Sep 17 00:00:00 2001
From: Tom Dohrmann <[email protected]>
Date: Thu, 1 Aug 2024 14:42:17 +0200
Subject: [PATCH 4/4] qemu: don't emit scsi parameter

This parameter has been deprecated for a long time and QEMU 9.1.0 finally removes it.

Fixes: #10112
Signed-off-by: Tom Dohrmann <[email protected]>
---
.../crates/hypervisor/src/qemu/cmdline_generator.rs | 13 -------------
src/runtime/pkg/govmm/qemu/qemu.go | 4 ----
src/runtime/pkg/govmm/qemu/qemu_arch_base_test.go | 2 +-
src/runtime/pkg/govmm/qemu/qemu_s390x_test.go | 2 +-
src/runtime/pkg/govmm/qemu/qemu_test.go | 1 -
5 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/runtime-rs/crates/hypervisor/src/qemu/cmdline_generator.rs b/src/runtime-rs/crates/hypervisor/src/qemu/cmdline_generator.rs
index c5e5de3c2..c00f3204f 100644
--- a/src/runtime-rs/crates/hypervisor/src/qemu/cmdline_generator.rs
+++ b/src/runtime-rs/crates/hypervisor/src/qemu/cmdline_generator.rs
@@ -820,7 +820,6 @@ impl ToQemuParams for BlockBackend {
struct DeviceVirtioBlk {
bus_type: VirtioBusType,
id: String,
- scsi: bool,
config_wce: bool,
share_rw: bool,
}
@@ -830,18 +829,11 @@ impl DeviceVirtioBlk {
DeviceVirtioBlk {
bus_type,
id: id.to_owned(),
- scsi: false,
config_wce: false,
share_rw: true,
}
}

- #[allow(dead_code)]
- fn set_scsi(&mut self, scsi: bool) -> &mut Self {
- self.scsi = scsi;
- self
- }
-
#[allow(dead_code)]
fn set_config_wce(&mut self, config_wce: bool) -> &mut Self {
self.config_wce = config_wce;
@@ -861,11 +853,6 @@ impl ToQemuParams for DeviceVirtioBlk {
let mut params = Vec::new();
params.push(format!("virtio-blk-{}", self.bus_type));
params.push(format!("drive=image-{}", self.id));
- if self.scsi {
- params.push("scsi=on".to_owned());
- } else {
- params.push("scsi=off".to_owned());
- }
if self.config_wce {
params.push("config-wce=on".to_owned());
} else {
diff --git a/src/runtime/pkg/govmm/qemu/qemu.go b/src/runtime/pkg/govmm/qemu/qemu.go
index f5ff0fc95..bcb6cd2ad 100644
--- a/src/runtime/pkg/govmm/qemu/qemu.go
+++ b/src/runtime/pkg/govmm/qemu/qemu.go
@@ -1317,10 +1317,6 @@ func (blkdev BlockDevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, s)
}
deviceParams = append(deviceParams, fmt.Sprintf("drive=%s", blkdev.ID))
- if !blkdev.SCSI {
- deviceParams = append(deviceParams, "scsi=off")
- }
-
if !blkdev.WCE {
deviceParams = append(deviceParams, "config-wce=off")
}
diff --git a/src/runtime/pkg/govmm/qemu/qemu_arch_base_test.go b/src/runtime/pkg/govmm/qemu/qemu_arch_base_test.go
index ec70767d7..10fd0bdff 100644
--- a/src/runtime/pkg/govmm/qemu/qemu_arch_base_test.go
+++ b/src/runtime/pkg/govmm/qemu/qemu_arch_base_test.go
@@ -25,7 +25,7 @@ var (
deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true,iothread=iothread1,romfile=efi-virtio.rom"
deviceVhostUserSCSIString = "-chardev socket,id=char1,path=/tmp/nonexistentsocket.socket -device vhost-user-scsi-pci,id=scsi1,chardev=char1,romfile=efi-virtio.rom"
deviceVhostUserBlkString = "-chardev socket,id=char2,path=/tmp/nonexistentsocket.socket -device vhost-user-blk-pci,logical_block_size=4096,size=512M,chardev=char2,romfile=efi-virtio.rom"
- deviceBlockString = "-device virtio-blk-pci,disable-modern=true,drive=hd0,scsi=off,config-wce=off,romfile=efi-virtio.rom,share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly=on"
+ deviceBlockString = "-device virtio-blk-pci,disable-modern=true,drive=hd0,config-wce=off,romfile=efi-virtio.rom,share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly=on"
devicePCIBridgeString = "-device pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,chassis_nr=5,shpc=on,addr=ff,romfile=efi-virtio.rom"
devicePCIBridgeStringReserved = "-device pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,chassis_nr=5,shpc=off,addr=ff,romfile=efi-virtio.rom,io-reserve=4k,mem-reserve=1m,pref64-reserve=1m"
devicePCIEBridgeString = "-device pcie-pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,addr=ff,romfile=efi-virtio.rom"
diff --git a/src/runtime/pkg/govmm/qemu/qemu_s390x_test.go b/src/runtime/pkg/govmm/qemu/qemu_s390x_test.go
index 90dbecca1..311e286e9 100644
--- a/src/runtime/pkg/govmm/qemu/qemu_s390x_test.go
+++ b/src/runtime/pkg/govmm/qemu/qemu_s390x_test.go
@@ -19,7 +19,7 @@ var (
deviceVFIOString = "-device vfio-ccw,host=02:10.0,devno=" + DevNo
deviceSCSIControllerStr = "-device virtio-scsi-ccw,id=foo,devno=" + DevNo
deviceSCSIControllerBusAddrStr = "-device virtio-scsi-ccw,id=foo,bus=pci.0,addr=00:04.0,iothread=iothread1,devno=" + DevNo
- deviceBlockString = "-device virtio-blk-ccw,drive=hd0,scsi=off,config-wce=off,devno=" + DevNo + ",share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly=on"
+ deviceBlockString = "-device virtio-blk-ccw,drive=hd0,config-wce=off,devno=" + DevNo + ",share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly=on"
romfile = ""
)

diff --git a/src/runtime/pkg/govmm/qemu/qemu_test.go b/src/runtime/pkg/govmm/qemu/qemu_test.go
index 8fc960905..181eb6506 100644
--- a/src/runtime/pkg/govmm/qemu/qemu_test.go
+++ b/src/runtime/pkg/govmm/qemu/qemu_test.go
@@ -281,7 +281,6 @@ func TestAppendDeviceBlock(t *testing.T) {
AIO: Threads,
Format: QCOW2,
Interface: NoInterface,
- SCSI: false,
WCE: false,
DisableModern: true,
ROMFile: romfile,
--
2.45.1

3 changes: 3 additions & 0 deletions packages/by-name/kata/kata-runtime/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ buildGoModule rec {
# delegates hash verification to the AA. Until that effort lands, we're
# sticking with the policy verification from AKS CoCo.
./0003-runtime-agent-verify-the-agent-policy-hash.patch
# This patches fixes compatibility issues with QEMU 9.1.
# https://github.com/kata-containers/kata-containers/pull/10113
./0004-qemu-don-t-emit-scsi-parameter.patch
];
};

Expand Down

0 comments on commit dcb904a

Please sign in to comment.