From nobody Thu May 15 09:53:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151083661947477.95889888177976; Thu, 16 Nov 2017 04:50:19 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20DE75FD67; Thu, 16 Nov 2017 12:50:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E72005C2E0; Thu, 16 Nov 2017 12:50:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B0B263D386; Thu, 16 Nov 2017 12:50:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAGCmebE004495 for ; Thu, 16 Nov 2017 07:48:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id D981F2C7CE; Thu, 16 Nov 2017 12:48:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3998C2C7C4; Thu, 16 Nov 2017 12:48:39 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 16 Nov 2017 13:48:04 +0100 Message-Id: <59fa3b8975f23b58ae8ed7345175251561e55cc2.1510836337.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 11/11] qemu: command: Mark disks as such in qemu X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 16 Nov 2017 12:50:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Qemu has now an internal mechanism for locking images to fix specific cases of disk corruption. This requires libvirt to mark the image as shared so that qemu lifts certain restrictions. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1378242 --- src/qemu/qemu_command.c | 4 +++ .../qemuxml2argv-disk-drive-shared-locking.args | 28 +++++++++++++++++ .../qemuxml2argv-disk-drive-shared-locking.xml | 36 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 2 ++ 4 files changed, 70 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-l= ocking.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-l= ocking.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 56729e498..e8534771e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2070,6 +2070,10 @@ qemuBuildDriveDevStr(const virDomainDef *def, virBufferAsprintf(&opt, ",num-queues=3D%u", disk->queues); } + if (disk->src->shared && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SHARE_RW)) + virBufferAddLit(&opt, ",share-rw=3Don"); + if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0) goto error; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.= args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.args new file mode 100644 index 000000000..326fde1b3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.args @@ -0,0 +1,28 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0,\ +serial=3DXYZXYZXYZYXXYZYZYXYZY,cache=3Dnone \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,media=3Dcdrom,\ +id=3Ddrive-ide0-1-0,readonly=3Don \ +-device ide-drive,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-= 0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.= xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.xml new file mode 100644 index 000000000..677c2b0b7 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared-locking.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + XYZXYZXYZYXXYZYZYXYZY +
+ + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bfced6dda..e72aabe20 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -909,6 +909,8 @@ mymain(void) DO_TEST("disk-drive-shared", QEMU_CAPS_DRIVE_SERIAL); DO_TEST_PARSE_ERROR("disk-drive-shared-qcow", NONE); + DO_TEST("disk-drive-shared-locking", + QEMU_CAPS_DRIVE_SERIAL, QEMU_CAPS_DRIVE_SHARE_RW); DO_TEST("disk-drive-error-policy-stop", QEMU_CAPS_MONITOR_JSON); DO_TEST("disk-drive-error-policy-enospace", --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list