From 7fa0a72f2eaab6d82853c5659798dd7a409739ef Mon Sep 17 00:00:00 2001 From: Jan Schintag Date: Mon, 16 Sep 2019 10:25:19 +0200 Subject: [PATCH] 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