From 7965baab6251632da8afa0e4c88391133dee0e1d Mon Sep 17 00:00:00 2001 From: Jan Schintag Date: Mon, 16 Sep 2019 10:14:30 +0200 Subject: [PATCH 1/2] vendor: update govmm s390x doesn't support memory backend file and needs to share the image instead Fixes: #2049 details vendor changes: cb9f640 virtio-blk: Add support for share-rw flag Signed-off-by: Jan Schintag --- Gopkg.lock | 4 ++-- Gopkg.toml | 2 +- vendor/github.com/intel/govmm/qemu/qemu.go | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 260abfcaaf..4c8ab706ed 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -390,11 +390,11 @@ revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" [[projects]] - digest = "1:1a7407072d9447e0e39148aa462f0be26261e29ff14679ccee4fbed106c1a766" + digest = "1:b3ab3b3615583d7a374d4803ea2b71f173a4d8f4d594210e0fc8e9fc7c5a49c9" name = "github.com/intel/govmm" packages = ["qemu"] pruneopts = "NUT" - revision = "ee460e3008d48043f8561628d1d5308357d72cf6" + revision = "8cba5a8e5f2816f26f9dc34b8ea968279a5a76eb" [[projects]] digest = "1:22e399f891fccaac4700943a9465f2623bb361653d5e0d4a9974573cd5e69070" diff --git a/Gopkg.toml b/Gopkg.toml index a4a4663e84..bde6de1c00 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -48,7 +48,7 @@ [[constraint]] name = "github.com/intel/govmm" - revision = "ee460e3008d48043f8561628d1d5308357d72cf6" + revision = "8cba5a8e5f2816f26f9dc34b8ea968279a5a76eb" [[constraint]] name = "github.com/kata-containers/agent" diff --git a/vendor/github.com/intel/govmm/qemu/qemu.go b/vendor/github.com/intel/govmm/qemu/qemu.go index daac268bdb..f2b80ccd16 100644 --- a/vendor/github.com/intel/govmm/qemu/qemu.go +++ b/vendor/github.com/intel/govmm/qemu/qemu.go @@ -728,6 +728,9 @@ type BlockDevice struct { // DevNo identifies the ccw devices for s390x architecture DevNo string + + // ShareRW enables multiple qemu instances to share the File + ShareRW bool } // Valid returns true if the BlockDevice structure is valid and complete. @@ -766,6 +769,10 @@ func (blkdev BlockDevice) QemuParams(config *Config) []string { deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", blkdev.DevNo)) } + if blkdev.ShareRW { + deviceParams = append(deviceParams, fmt.Sprintf(",share-rw=on")) + } + blkParams = append(blkParams, fmt.Sprintf("id=%s", blkdev.ID)) blkParams = append(blkParams, fmt.Sprintf(",file=%s", blkdev.File)) blkParams = append(blkParams, fmt.Sprintf(",aio=%s", blkdev.AIO)) From 7fa0a72f2eaab6d82853c5659798dd7a409739ef Mon Sep 17 00:00:00 2001 From: Jan Schintag Date: Mon, 16 Sep 2019 10:25:19 +0200 Subject: [PATCH 2/2] s390x: Share image between qemu instances This commit enables the `share-rw` flag for the image file in s390x. This enables multiple instances of qemu to share the same image. Fixes: #2049 Signed-off-by: Jan Schintag --- virtcontainers/device/config/config.go | 3 +++ virtcontainers/qemu_arch_base.go | 1 + virtcontainers/qemu_s390x.go | 1 + 3 files changed, 5 insertions(+) diff --git a/virtcontainers/device/config/config.go b/virtcontainers/device/config/config.go index 4eda53b997..9a30134576 100644 --- a/virtcontainers/device/config/config.go +++ b/virtcontainers/device/config/config.go @@ -144,6 +144,9 @@ type BlockDrive struct { // DevNo identifies the css bus id for virtio-blk-ccw DevNo string + + // ShareRW enables multiple qemu instances to share the File + ShareRW bool } // VFIODeviceType indicates VFIO device type diff --git a/virtcontainers/qemu_arch_base.go b/virtcontainers/qemu_arch_base.go index 64792ba613..4408648bc1 100644 --- a/virtcontainers/qemu_arch_base.go +++ b/virtcontainers/qemu_arch_base.go @@ -548,6 +548,7 @@ func genericBlockDevice(drive config.BlockDrive, nestedRun bool) (govmmQemu.Bloc Format: govmmQemu.BlockDeviceFormat(drive.Format), Interface: "none", DisableModern: nestedRun, + ShareRW: drive.ShareRW, }, nil } diff --git a/virtcontainers/qemu_s390x.go b/virtcontainers/qemu_s390x.go index 26cfb1e1a1..c5d0b8be00 100644 --- a/virtcontainers/qemu_s390x.go +++ b/virtcontainers/qemu_s390x.go @@ -131,6 +131,7 @@ func (q *qemuS390x) appendImage(devices []govmmQemu.Device, path string) ([]govm if err != nil { return nil, err } + drive.ShareRW = true devices, err = q.appendBlockDevice(devices, drive) if err != nil { return nil, err