From nobody Wed May 8 21:28:02 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547631741676352.1632812619272; Wed, 16 Jan 2019 01:42:21 -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 33FCAC05093A; Wed, 16 Jan 2019 09:42:19 +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 F0AF961090; Wed, 16 Jan 2019 09:42:18 +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 871B43F602; Wed, 16 Jan 2019 09:42:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0G9gHCR032439 for ; Wed, 16 Jan 2019 04:42:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4EE0E5D970; Wed, 16 Jan 2019 09:42:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9ED645D96E; Wed, 16 Jan 2019 09:42:16 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 16 Jan 2019 10:42:09 +0100 Message-Id: <7f645fec02c2b4f7ce9b4a23e4be92b1f61401ac.1547631699.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/2] tests: qemuxml2argv: Add test case for empty CDROM with cache mode 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: , 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.31]); Wed, 16 Jan 2019 09:42:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Upcomming change will influence CDROM with cache mode so add a test case. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- tests/qemuxml2argvdata/disk-cdrom.args | 4 +++- tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args | 7 +++++-- tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args | 7 +++++-- tests/qemuxml2argvdata/disk-cdrom.xml | 6 ++++++ tests/qemuxml2xmloutdata/disk-cdrom.xml | 6 ++++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/qemuxml2argvdata/disk-cdrom.args b/tests/qemuxml2argvdat= a/disk-cdrom.args index 6f78a314a9..0b62e6ee9f 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.args +++ b/tests/qemuxml2argvdata/disk-cdrom.args @@ -24,8 +24,10 @@ server,nowait \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0,\ bootindex=3D1 \ --drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-1-0,me= dia=3Dcdrom,\ +-drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,me= dia=3Dcdrom,\ readonly=3Don \ +-device ide-drive,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-= 1 \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0,media=3Dcdrom,readonly=3Don,cache=3Dn= one \ -device ide-drive,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-= 0 \ -drive if=3Dnone,id=3Ddrive-ide0-1-1,media=3Dcdrom,readonly=3Don \ -device ide-drive,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 diff --git a/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args b/tests/q= emuxml2argvdata/disk-cdrom.x86_64-2.12.0.args index 59607258eb..b51c0919cc 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args @@ -26,8 +26,11 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-1-0,re= adonly=3Don \ --device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0 \ +-drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,re= adonly=3Don \ +-device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don,cache=3Dnone \ +-device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0,\ +write-cache=3Don \ -drive if=3Dnone,id=3Ddrive-ide0-1-1,readonly=3Don \ -device ide-cd,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ diff --git a/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args b/tests/q= emuxml2argvdata/disk-cdrom.x86_64-latest.args index 4c5a599820..8bdcffada3 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args @@ -26,8 +26,11 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-1-0,re= adonly=3Don \ --device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0 \ +-drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,re= adonly=3Don \ +-device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don,cache=3Dnone \ +-device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0,\ +write-cache=3Don \ -drive if=3Dnone,id=3Ddrive-ide0-1-1,readonly=3Don \ -device ide-cd,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ diff --git a/tests/qemuxml2argvdata/disk-cdrom.xml b/tests/qemuxml2argvdata= /disk-cdrom.xml index be229657f7..f5e9f7395d 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.xml +++ b/tests/qemuxml2argvdata/disk-cdrom.xml @@ -23,6 +23,12 @@ + + +
+ + +
diff --git a/tests/qemuxml2xmloutdata/disk-cdrom.xml b/tests/qemuxml2xmlout= data/disk-cdrom.xml index e96c94097a..7696785930 100644 --- a/tests/qemuxml2xmloutdata/disk-cdrom.xml +++ b/tests/qemuxml2xmloutdata/disk-cdrom.xml @@ -23,6 +23,12 @@ + + +
+ + +
--=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 21:28:02 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547631749008663.9109031299281; Wed, 16 Jan 2019 01:42:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9453A404A; Wed, 16 Jan 2019 09:42:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90C25601A5; Wed, 16 Jan 2019 09:42:25 +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 292DC180339C; Wed, 16 Jan 2019 09:42:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0G9gI3q032445 for ; Wed, 16 Jan 2019 04:42:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C22C5D978; Wed, 16 Jan 2019 09:42:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C5F75D970; Wed, 16 Jan 2019 09:42:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 16 Jan 2019 10:42:10 +0100 Message-Id: <41cb5bb54b407f6c7de921e902996d60fed38fcc.1547631699.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] qemu: command: Don't format image properties for empty -drive 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: , 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 16 Jan 2019 09:42:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a -drive has no image, using image properties makes qemu whine that they should not be used. This patch stops formating cache/readonly/... for empty drives for the pre-blockdev syntax. Unfortunately those parameters can't be added later when inserting media, but on the other hand qemu will start with an empty drive. Since we already were able to start a VM with such config previously due to qemu ignoring them I've opted just to skip formatting them. Additionally with -blockdev support it will work as expected as the image properties will be formatted when adding the image itself which is not possible without it. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1651457 Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 47 ++++++++++--------- tests/qemuxml2argvdata/disk-cdrom.args | 4 +- .../disk-cdrom.x86_64-2.12.0.args | 4 +- .../disk-cdrom.x86_64-latest.args | 4 +- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 822d5f8669..3913ac4c15 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1745,37 +1745,38 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, } } - if (disk->src->readonly) - virBufferAddLit(&opt, ",readonly=3Don"); + if (!virStorageSourceIsEmpty(disk->src)) { + if (disk->src->readonly) + virBufferAddLit(&opt, ",readonly=3Don"); + if (disk->cachemode) { + virBufferAsprintf(&opt, ",cache=3D%s", + qemuDiskCacheV2TypeToString(disk->cachemode)= ); + } - if (disk->cachemode) { - virBufferAsprintf(&opt, ",cache=3D%s", - qemuDiskCacheV2TypeToString(disk->cachemode)); - } + if (disk->copy_on_read) { + virBufferAsprintf(&opt, ",copy-on-read=3D%s", + virTristateSwitchTypeToString(disk->copy_on_= read)); + } - if (disk->copy_on_read) { - virBufferAsprintf(&opt, ",copy-on-read=3D%s", - virTristateSwitchTypeToString(disk->copy_on_read= )); - } + if (disk->discard) { + virBufferAsprintf(&opt, ",discard=3D%s", + virDomainDiskDiscardTypeToString(disk->disca= rd)); + } - if (disk->discard) { - virBufferAsprintf(&opt, ",discard=3D%s", - virDomainDiskDiscardTypeToString(disk->discard)); - } + if (detect_zeroes) { + virBufferAsprintf(&opt, ",detect-zeroes=3D%s", + virDomainDiskDetectZeroesTypeToString(detect= _zeroes)); + } - if (detect_zeroes) { - virBufferAsprintf(&opt, ",detect-zeroes=3D%s", - virDomainDiskDetectZeroesTypeToString(detect_zer= oes)); - } + if (disk->iomode) { + virBufferAsprintf(&opt, ",aio=3D%s", + virDomainDiskIoTypeToString(disk->iomode)); + } - if (disk->iomode) { - virBufferAsprintf(&opt, ",aio=3D%s", - virDomainDiskIoTypeToString(disk->iomode)); + qemuBuildDiskThrottling(disk, &opt); } - qemuBuildDiskThrottling(disk, &opt); - if (virBufferCheckError(&opt) < 0) goto error; diff --git a/tests/qemuxml2argvdata/disk-cdrom.args b/tests/qemuxml2argvdat= a/disk-cdrom.args index 0b62e6ee9f..a9f60aa477 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.args +++ b/tests/qemuxml2argvdata/disk-cdrom.args @@ -27,7 +27,7 @@ bootindex=3D1 \ -drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,me= dia=3Dcdrom,\ readonly=3Don \ -device ide-drive,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-= 1 \ --drive if=3Dnone,id=3Ddrive-ide0-1-0,media=3Dcdrom,readonly=3Don,cache=3Dn= one \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0,media=3Dcdrom \ -device ide-drive,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-= 0 \ --drive if=3Dnone,id=3Ddrive-ide0-1-1,media=3Dcdrom,readonly=3Don \ +-drive if=3Dnone,id=3Ddrive-ide0-1-1,media=3Dcdrom \ -device ide-drive,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 diff --git a/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args b/tests/q= emuxml2argvdata/disk-cdrom.x86_64-2.12.0.args index b51c0919cc..a39d920f67 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-cdrom.x86_64-2.12.0.args @@ -28,10 +28,10 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ -drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,re= adonly=3Don \ -device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --drive if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don,cache=3Dnone \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0 \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0,\ write-cache=3Don \ --drive if=3Dnone,id=3Ddrive-ide0-1-1,readonly=3Don \ +-drive if=3Dnone,id=3Ddrive-ide0-1-1 \ -device ide-cd,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ diff --git a/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args b/tests/q= emuxml2argvdata/disk-cdrom.x86_64-latest.args index 8bdcffada3..029ae23dfa 100644 --- a/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom.x86_64-latest.args @@ -28,10 +28,10 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ -drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-1,re= adonly=3Don \ -device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --drive if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don,cache=3Dnone \ +-drive if=3Dnone,id=3Ddrive-ide0-1-0 \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0,\ write-cache=3Don \ --drive if=3Dnone,id=3Ddrive-ide0-1-1,readonly=3Don \ +-drive if=3Dnone,id=3Ddrive-ide0-1-1 \ -device ide-cd,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list