From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766940; cv=none; d=zohomail.com; s=zohoarc; b=UyGQPJJQdUScJGneO+u2ykJOvRhoz/UZtQKFPI7urc31s9awEfb84EkQqtaPjTS6StVRAHm9Nc9LvSNbvbsDlQba0H03L2/r0ZIVO/F3M19OFUARPOmrtOEF8uz3dgnYwgOx/fXScXwuKJ2Nqdh2TLopwMTQ7s96cx7xY5Q7mxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766940; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=19aSqOBv589rAOWZueDOlzbttYLPCA0GEVDhXo/BLg0=; b=SmY4gK7fK9G+jZrAiTAswGDTBg572X2xEL9lvG9voC3B+LawxgQIcR2bqlIyFNhqf42NxQkKElbZEvlMjMMsp919tc1lYi9pjDJn9wTS1ecTnE9XrEl58ppsQ8Llns6deeN60rC7CcmYTSu/PS8IepQJnlv/QF6jlqRoxr4zJAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 15887669409045.151690750948205; Wed, 6 May 2020 05:09:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-MxhOTkghO3WZnR9x4_nRMw-1; Wed, 06 May 2020 08:08:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6FAF3100CCC2; Wed, 6 May 2020 12:08:51 +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 3D76210002BD; Wed, 6 May 2020 12:08:51 +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 EC3EC54D03; Wed, 6 May 2020 12:08:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8jx0029575 for ; Wed, 6 May 2020 08:08:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0E405C1D6; Wed, 6 May 2020 12:08:45 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CE9D5C1BD for ; Wed, 6 May 2020 12:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766939; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=19aSqOBv589rAOWZueDOlzbttYLPCA0GEVDhXo/BLg0=; b=Z6ZcGMDLVDty7jY69Z6Sz2ODbgnC8/fowMr7tP6stuV6IZR6ddzKXRQ+7qbqerNrU0a01M fHsyseeV8PKhbAdLOyD2B0qxg94az/uIcU2EKy2gipXiYEeZomXArx6bdRrPOmAVmhCTgm 2ANBMzBFkFQCQhmXkzjfXltdj1tAIOw= X-MC-Unique: MxhOTkghO3WZnR9x4_nRMw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/20] qemuxml2(argv|xml): Modernize 'blkdeviotune' tests Date: Wed, 6 May 2020 14:08:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the tests to DO_TEST_CAPS_LATEST. Since switch to blockdev stopped us formatting the tunning parameters on the command line let's also add version cases for qemu-4.1 data which doesn't enable blockdev. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- ... blkdeviotune-group-num.x86_64-4.1.0.args} | 26 ++++++---- .../blkdeviotune-group-num.x86_64-latest.args | 50 +++++++++++++++++++ .../blkdeviotune-group-num.xml | 5 +- ...blkdeviotune-max-length.x86_64-4.1.0.args} | 26 ++++++---- ...blkdeviotune-max-length.x86_64-latest.args | 50 +++++++++++++++++++ .../blkdeviotune-max-length.xml | 5 +- ...rgs =3D> blkdeviotune-max.x86_64-4.1.0.args} | 26 ++++++---- .../blkdeviotune-max.x86_64-latest.args | 50 +++++++++++++++++++ tests/qemuxml2argvdata/blkdeviotune-max.xml | 5 +- tests/qemuxml2argvtest.c | 14 +++--- ... blkdeviotune-group-num.x86_64-latest.xml} | 0 ...blkdeviotune-max-length.x86_64-latest.xml} | 0 ...xml =3D> blkdeviotune-max.x86_64-latest.xml} | 0 ...une.xml =3D> blkdeviotune.x86_64-latest.xml} | 7 ++- tests/qemuxml2xmltest.c | 8 +-- 15 files changed, 228 insertions(+), 44 deletions(-) rename tests/qemuxml2argvdata/{blkdeviotune-group-num.args =3D> blkdeviotu= ne-group-num.x86_64-4.1.0.args} (69%) create mode 100644 tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-la= test.args rename tests/qemuxml2argvdata/{blkdeviotune-max-length.args =3D> blkdeviot= une-max-length.x86_64-4.1.0.args} (71%) create mode 100644 tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-l= atest.args rename tests/qemuxml2argvdata/{blkdeviotune-max.args =3D> blkdeviotune-max= .x86_64-4.1.0.args} (67%) create mode 100644 tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.a= rgs rename tests/qemuxml2xmloutdata/{blkdeviotune-group-num.xml =3D> blkdeviot= une-group-num.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{blkdeviotune-max-length.xml =3D> blkdevio= tune-max-length.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{blkdeviotune-max.xml =3D> blkdeviotune-ma= x.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{blkdeviotune.xml =3D> blkdeviotune.x86_64= -latest.xml} (88%) diff --git a/tests/qemuxml2argvdata/blkdeviotune-group-num.args b/tests/qem= uxml2argvdata/blkdeviotune-group-num.x86_64-4.1.0.args similarity index 69% rename from tests/qemuxml2argvdata/blkdeviotune-group-num.args rename to tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-4.1.0.args index dfa7155b1e..8aa4c2be7d 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-group-num.args +++ b/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-4.1.0.args @@ -8,33 +8,41 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-i386 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-i440fx-4.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --usb \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-0,\ cache=3Dnone,throttling.bps-total=3D5000,throttling.iops-total=3D6000,\ throttling.bps-total-max=3D10000,throttling.iops-total-max=3D11000,\ throttling.group=3Dlibvirt_iotune_group1 \ --device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1,\ +write-cache=3Don \ -drive file=3D/dev/HostVG/QEMUGuest2,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-1,\ cache=3Dnone,throttling.bps-read=3D5000,throttling.bps-write=3D5500,\ throttling.iops-read=3D3500,throttling.iops-write=3D4000,\ throttling.bps-read-max=3D6000,throttling.bps-write-max=3D6500,\ throttling.iops-read-max=3D7000,throttling.iops-write-max=3D7500,\ throttling.iops-size=3D2000,throttling.group=3Dlibvirt_iotune_group2 \ --device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.ar= gs b/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args new file mode 100644 index 0000000000..fe8a845aae --- /dev/null +++ b/tests/qemuxml2argvdata/blkdeviotune-group-num.x86_64-latest.args @@ -0,0 +1,50 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\ +"node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-2-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-2-format,id=3Dide0-0-0= ,bootindex=3D1,\ +write-cache=3Don \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2",\ +"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-1-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Dlibvirt-1-format,id=3Dide0-0-1= ,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-group-num.xml b/tests/qemu= xml2argvdata/blkdeviotune-group-num.xml index c82430a1e9..7b43bfea87 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-group-num.xml +++ b/tests/qemuxml2argvdata/blkdeviotune-group-num.xml @@ -8,6 +8,9 @@ hvm + + qemu64 + destroy restart @@ -45,7 +48,7 @@
- +
diff --git a/tests/qemuxml2argvdata/blkdeviotune-max-length.args b/tests/qe= muxml2argvdata/blkdeviotune-max-length.x86_64-4.1.0.args similarity index 71% rename from tests/qemuxml2argvdata/blkdeviotune-max-length.args rename to tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-4.1.0.args index 5d301a465d..b8416ef3b0 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max-length.args +++ b/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-4.1.0.args @@ -8,28 +8,32 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-i386 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-i440fx-4.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --usb \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-0,\ cache=3Dnone,throttling.bps-total=3D5000,throttling.iops-total=3D6000,\ throttling.bps-total-max=3D10000,throttling.iops-total-max=3D11000,\ throttling.bps-total-max-length=3D3,throttling.iops-total-max-length=3D5 \ --device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1,\ +write-cache=3Don \ -drive file=3D/dev/HostVG/QEMUGuest2,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-1,\ cache=3Dnone,throttling.bps-read=3D5000,throttling.bps-write=3D5500,\ throttling.iops-read=3D3500,throttling.iops-write=3D4000,\ @@ -38,5 +42,9 @@ throttling.iops-read-max=3D7000,throttling.iops-write-max= =3D7500,\ throttling.iops-size=3D2000,throttling.bps-read-max-length=3D3,\ throttling.bps-write-max-length=3D5,throttling.iops-read-max-length=3D7,\ throttling.iops-write-max-length=3D9 \ --device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args new file mode 100644 index 0000000000..fe8a845aae --- /dev/null +++ b/tests/qemuxml2argvdata/blkdeviotune-max-length.x86_64-latest.args @@ -0,0 +1,50 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\ +"node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-2-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-2-format,id=3Dide0-0-0= ,bootindex=3D1,\ +write-cache=3Don \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2",\ +"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-1-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Dlibvirt-1-format,id=3Dide0-0-1= ,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-max-length.xml b/tests/qem= uxml2argvdata/blkdeviotune-max-length.xml index 83fea5c567..f891d15a81 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max-length.xml +++ b/tests/qemuxml2argvdata/blkdeviotune-max-length.xml @@ -8,6 +8,9 @@ hvm + + qemu64 + destroy restart @@ -49,7 +52,7 @@
- +
diff --git a/tests/qemuxml2argvdata/blkdeviotune-max.args b/tests/qemuxml2a= rgvdata/blkdeviotune-max.x86_64-4.1.0.args similarity index 67% rename from tests/qemuxml2argvdata/blkdeviotune-max.args rename to tests/qemuxml2argvdata/blkdeviotune-max.x86_64-4.1.0.args index 4548443377..b03fe20d30 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max.args +++ b/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-4.1.0.args @@ -8,32 +8,40 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-i386 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-i440fx-4.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --usb \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-0,\ cache=3Dnone,throttling.bps-total=3D5000,throttling.iops-total=3D6000,\ throttling.bps-total-max=3D10000,throttling.iops-total-max=3D11000 \ --device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1,\ +write-cache=3Don \ -drive file=3D/dev/HostVG/QEMUGuest2,format=3Dqcow2,if=3Dnone,id=3Ddrive-i= de0-0-1,\ cache=3Dnone,throttling.bps-read=3D5000,throttling.bps-write=3D5500,\ throttling.iops-read=3D3500,throttling.iops-write=3D4000,\ throttling.bps-read-max=3D6000,throttling.bps-write-max=3D6500,\ throttling.iops-read-max=3D7000,throttling.iops-write-max=3D7500,\ throttling.iops-size=3D2000 \ --device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args b/t= ests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args new file mode 100644 index 0000000000..fe8a845aae --- /dev/null +++ b/tests/qemuxml2argvdata/blkdeviotune-max.x86_64-latest.args @@ -0,0 +1,50 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\ +"node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-2-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-2-format,id=3Dide0-0-0= ,bootindex=3D1,\ +write-cache=3Don \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2",\ +"node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},\ +"auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,\ +"cache":{"direct":true,"no-flush":false},"driver":"qcow2",\ +"file":"libvirt-1-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D1,drive=3Dlibvirt-1-format,id=3Dide0-0-1= ,\ +write-cache=3Don \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/blkdeviotune-max.xml b/tests/qemuxml2ar= gvdata/blkdeviotune-max.xml index 3c604c2837..912f22e6cb 100644 --- a/tests/qemuxml2argvdata/blkdeviotune-max.xml +++ b/tests/qemuxml2argvdata/blkdeviotune-max.xml @@ -8,6 +8,9 @@ hvm + + qemu64 + destroy restart @@ -43,7 +46,7 @@
- +
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 04febd1b0c..ff33870581 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1826,14 +1826,12 @@ mymain(void) DO_TEST("numad-auto-memory-vcpu-cpuset", NONE); DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE); DO_TEST("numad-static-memory-auto-vcpu", NONE); - DO_TEST("blkdeviotune-max", - QEMU_CAPS_DRIVE_IOTUNE_MAX); - DO_TEST("blkdeviotune-group-num", - QEMU_CAPS_DRIVE_IOTUNE_MAX, - QEMU_CAPS_DRIVE_IOTUNE_GROUP); - DO_TEST("blkdeviotune-max-length", - QEMU_CAPS_DRIVE_IOTUNE_MAX, - QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH); + DO_TEST_CAPS_VER("blkdeviotune-max", "4.1.0"); + DO_TEST_CAPS_LATEST("blkdeviotune-max"); + DO_TEST_CAPS_VER("blkdeviotune-group-num", "4.1.0"); + DO_TEST_CAPS_LATEST("blkdeviotune-group-num"); + DO_TEST_CAPS_VER("blkdeviotune-max-length", "4.1.0"); + DO_TEST_CAPS_LATEST("blkdeviotune-max-length"); DO_TEST("multifunction-pci-device", QEMU_CAPS_SCSI_LSI); diff --git a/tests/qemuxml2xmloutdata/blkdeviotune-group-num.xml b/tests/qe= muxml2xmloutdata/blkdeviotune-group-num.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/blkdeviotune-group-num.xml rename to tests/qemuxml2xmloutdata/blkdeviotune-group-num.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/blkdeviotune-max-length.xml b/tests/q= emuxml2xmloutdata/blkdeviotune-max-length.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/blkdeviotune-max-length.xml rename to tests/qemuxml2xmloutdata/blkdeviotune-max-length.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/blkdeviotune-max.xml b/tests/qemuxml2= xmloutdata/blkdeviotune-max.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/blkdeviotune-max.xml rename to tests/qemuxml2xmloutdata/blkdeviotune-max.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/blkdeviotune.xml b/tests/qemuxml2xmlo= utdata/blkdeviotune.x86_64-latest.xml similarity index 88% rename from tests/qemuxml2xmloutdata/blkdeviotune.xml rename to tests/qemuxml2xmloutdata/blkdeviotune.x86_64-latest.xml index ed8c8809db..e27f61f2fd 100644 --- a/tests/qemuxml2xmloutdata/blkdeviotune.xml +++ b/tests/qemuxml2xmloutdata/blkdeviotune.x86_64-latest.xml @@ -8,6 +8,9 @@ hvm + + qemu64 + destroy restart @@ -35,7 +38,7 @@
- +
@@ -45,7 +48,7 @@ -
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 86f3d2c1f3..8bfa23cddf 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -603,10 +603,10 @@ mymain(void) DO_TEST("usb-redir", NONE); DO_TEST("usb-redir-filter", NONE); DO_TEST("usb-redir-filter-version", NONE); - DO_TEST("blkdeviotune", NONE); - DO_TEST("blkdeviotune-max", NONE); - DO_TEST("blkdeviotune-group-num", NONE); - DO_TEST("blkdeviotune-max-length", NONE); + DO_TEST_CAPS_LATEST("blkdeviotune"); + DO_TEST_CAPS_LATEST("blkdeviotune-max"); + DO_TEST_CAPS_LATEST("blkdeviotune-group-num"); + DO_TEST_CAPS_LATEST("blkdeviotune-max-length"); DO_TEST("controller-usb-order", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4); --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766943; cv=none; d=zohomail.com; s=zohoarc; b=drpFm5bqc+WQFd6WBdOPVfDSNg7rjLdetE+/JZMXCN/7GtiAcWbTbf2DESNHnjGtmb+tcF+u7RBsA9+tDxp3KxwknR3hbvt57DdVW0sPshJ4P61ZpaE8j3NdCwK5IWeN2Ej66AvohicpD/Kbh0ikpMjd40vyjHa49jXA6s3b/i0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766943; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zwPAWDt9O09MUv9d8xb2g1n1pqdXkSE1OAeGPRY6no4=; b=IEwX/02X70iRSmIZaKZ6RzNdGkSPmoXKwsmgBXZhDhuyxXJA2wlOuD3LeeiTQxnL6mZAY5yUMuDsKGxWshXc1LxtjG182daro084ltB8DvJg2iRyuQNYwdDlrwXleC+4OAbC0kADw0zbkhxtw3I+UkpzF+oH9C2E82L1AGEKBco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588766943167174.22188202893915; Wed, 6 May 2020 05:09:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-lpVSvuBANheG2Zgp3vVQew-1; Wed, 06 May 2020 08:08:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ABC3A53; Wed, 6 May 2020 12:08:50 +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 7CCB45C1D4; Wed, 6 May 2020 12:08:50 +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 2E8E9180954D; Wed, 6 May 2020 12:08:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8kOk029585 for ; Wed, 6 May 2020 08:08:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9B255C1D4; Wed, 6 May 2020 12:08:46 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C0225C1BD for ; Wed, 6 May 2020 12:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766941; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zwPAWDt9O09MUv9d8xb2g1n1pqdXkSE1OAeGPRY6no4=; b=SmN0/+hmbYRL+8IBEkmLnREjQSonWG4J55feOrkpJS6VRpmHQ9rUGq/zR0cmUzAm+duBMD 7ppRJK61P1zgu22kv8Xptys7tcvo5po1faVw1ZQYWNZL0GHZSdkmD6Ho67KnrfliMft31X v3hdfhrQu3Q+0r+xWbl9s4/+JQTNki0= X-MC-Unique: lpVSvuBANheG2Zgp3vVQew-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/20] qemuxml2(argv|xml): Modernize 'discard'/'detect-zero' tests Date: Wed, 6 May 2020 14:08:17 +0200 Message-Id: <1c84d6ba9980b5924c13149177bdee3ac96a88af.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Switch to DO_TEST_CAPS_LATEST for all of them and also add pre-blockdev case for 'disk-discard' as we had it before. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- .../disk-detect-zeroes.x86_64-2.12.0.args | 1 + tests/qemuxml2argvdata/disk-detect-zeroes.xml | 5 +- ...rd.args =3D> disk-discard.x86_64-4.1.0.args} | 22 +++++---- .../disk-discard.x86_64-latest.args | 46 +++++++++++++++++++ tests/qemuxml2argvtest.c | 7 +-- ...l =3D> disk-detect-zeroes.x86_64-latest.xml} | 0 ...ard.xml =3D> disk-discard.x86_64-latest.xml} | 7 ++- tests/qemuxml2xmltest.c | 4 +- 8 files changed, 73 insertions(+), 19 deletions(-) rename tests/qemuxml2argvdata/{disk-discard.args =3D> disk-discard.x86_64-= 4.1.0.args} (59%) create mode 100644 tests/qemuxml2argvdata/disk-discard.x86_64-latest.args rename tests/qemuxml2xmloutdata/{disk-detect-zeroes.xml =3D> disk-detect-z= eroes.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{disk-discard.xml =3D> disk-discard.x86_64= -latest.xml} (87%) diff --git a/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args b= /tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args index 1da46d8987..090cccdb5c 100644 --- a/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args @@ -13,6 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-test/master-key.aes \ -machine pc-i440fx-2.12,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ -m 1024 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/disk-detect-zeroes.xml b/tests/qemuxml2= argvdata/disk-detect-zeroes.xml index d1ae37b81b..851077545e 100644 --- a/tests/qemuxml2argvdata/disk-detect-zeroes.xml +++ b/tests/qemuxml2argvdata/disk-detect-zeroes.xml @@ -10,6 +10,9 @@ + + qemu64 + destroy restart @@ -29,7 +32,7 @@
- +
diff --git a/tests/qemuxml2argvdata/disk-discard.args b/tests/qemuxml2argvd= ata/disk-discard.x86_64-4.1.0.args similarity index 59% rename from tests/qemuxml2argvdata/disk-discard.args rename to tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args index 163b1b0df2..4437922eee 100644 --- a/tests/qemuxml2argvdata/disk-discard.args +++ b/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args @@ -8,29 +8,33 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name test \ +-name guest=3Dtest,debug-threads=3Don \ -S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-test/master-key.aes \ +-machine pc-i440fx-4.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -m 1024 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-test/monitor.so= ck,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --boot menu=3Don \ --usb \ +-boot menu=3Don,strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/var/lib/libvirt/images/f14.img,format=3Dqcow2,if=3Dnone,\ id=3Ddrive-virtio-disk0,discard=3Dunmap \ --device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk0,\ +-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-vir= tio-disk0,\ id=3Dvirtio-disk0,bootindex=3D2 \ -drive file=3D/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,format=3Draw,= if=3Dnone,\ id=3Ddrive-ide0-1-0,readonly=3Don,discard=3Dignore \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0,b= ootindex=3D1 \ --device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-discard.x86_64-latest.args b/tests= /qemuxml2argvdata/disk-discard.x86_64-latest.args new file mode 100644 index 0000000000..a7cbf567c8 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-discard.x86_64-latest.args @@ -0,0 +1,46 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-test/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu64 \ +-m 1024 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot menu=3Don,strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/f14.img",\ +"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,"discard":"un= map",\ +"driver":"qcow2","file":"libvirt-2-storage"}' \ +-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.0,addr=3D0x4,drive=3Dlibvirt-2= -format,\ +id=3Dvirtio-disk0,bootindex=3D2 \ +-blockdev '{"driver":"file",\ +"filename":"/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":true,"discard":"ign= ore",\ +"driver":"raw","file":"libvirt-1-storage"}' \ +-device ide-cd,bus=3Dide.1,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-1-0= ,bootindex=3D1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ff33870581..f45f04548f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1135,11 +1135,8 @@ mymain(void) QEMU_CAPS_VIRTIO_BLK_SCSI); DO_TEST_CAPS_VER("disk-copy_on_read", "2.12.0"); DO_TEST_CAPS_LATEST("disk-copy_on_read"); - DO_TEST("disk-discard", - QEMU_CAPS_DRIVE_DISCARD); - DO_TEST("disk-detect-zeroes", - QEMU_CAPS_DRIVE_DISCARD, - QEMU_CAPS_DRIVE_DETECT_ZEROES); + DO_TEST_CAPS_VER("disk-discard", "4.1.0"); + DO_TEST_CAPS_LATEST("disk-discard"); DO_TEST_CAPS_VER("disk-detect-zeroes", "2.12.0"); DO_TEST_CAPS_LATEST("disk-detect-zeroes"); DO_TEST("disk-snapshot", NONE); diff --git a/tests/qemuxml2xmloutdata/disk-detect-zeroes.xml b/tests/qemuxm= l2xmloutdata/disk-detect-zeroes.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/disk-detect-zeroes.xml rename to tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/disk-discard.xml b/tests/qemuxml2xmlo= utdata/disk-discard.x86_64-latest.xml similarity index 87% rename from tests/qemuxml2xmloutdata/disk-discard.xml rename to tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml index 563a24ae04..e55c5bf6d3 100644 --- a/tests/qemuxml2xmloutdata/disk-discard.xml +++ b/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml @@ -10,6 +10,9 @@ + + qemu64 + destroy restart @@ -29,7 +32,7 @@
- +
@@ -39,7 +42,7 @@ -
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8bfa23cddf..34a9f2803a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -638,8 +638,8 @@ mymain(void) DO_TEST("disk-source-pool", NONE); DO_TEST("disk-source-pool-mode", NONE); - DO_TEST("disk-discard", NONE); - DO_TEST("disk-detect-zeroes", NONE); + DO_TEST_CAPS_LATEST("disk-discard"); + DO_TEST_CAPS_LATEST("disk-detect-zeroes"); DO_TEST("disk-serial", NONE); --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766945; cv=none; d=zohomail.com; s=zohoarc; b=Tydd+LRbFIc9H8HQANZBjmYDtcG6bWHmBAVVB1QedPFv/XuORKvnO8UXK7fhW1LycK3y+xnPiyXv+c27x/dKwaM44+1w8KjQ+TLXILTgi5y7y6FIWXtwuET62Ur33kgJazkKkGrKqFIo8a0r4YCz0tTEfe/PJonZBRlh/Xg1wM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766945; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ar7mbov6nKKqh1ClCTxtkZEda4MPUbzgtQdx3zs1emk=; b=horR8CL7C4XURIErxXiOFX8NM/1D194qe4yKaZrivYidLnhwTVwa98mfiSMTFzov+Sj/s4vADMDcJ9nT/dr+6kpau3OxZaBY6Fm65AegV5oeNrmm4n9IIAjREbFp9XyKJcoPLsSFWMF1QvR7eExkuvC1uaBXaXHP+84dG1IT3Lo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1588766945899974.7839742509937; Wed, 6 May 2020 05:09:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-FAv6YgL_MHuudOwa9XgEow-1; Wed, 06 May 2020 08:09:01 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 078DD84E03F; Wed, 6 May 2020 12:08:55 +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 AC5D7100EBA9; Wed, 6 May 2020 12:08:54 +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 65E6754D06; Wed, 6 May 2020 12:08:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8lxi029594 for ; Wed, 6 May 2020 08:08:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAF7F5C254; Wed, 6 May 2020 12:08:47 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 363605C1BD for ; Wed, 6 May 2020 12:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766944; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ar7mbov6nKKqh1ClCTxtkZEda4MPUbzgtQdx3zs1emk=; b=Qa8/bQ+yd1EZERXEUAx8sC19rO666lTglmKXY1csGlIVljRwtTCsqb+KE7VxyY/DufN6Bm I5c0/date+hZ+aLD9rEbSNdQ9DqzAE6LHS2ijNp1BKrkXi6KTHI3bopsG+35To3OPZ8sb5 pvVnEt4/xYhRMqX1c4wJAqQgfuaPCi0= X-MC-Unique: FAv6YgL_MHuudOwa9XgEow-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/20] qemuValidateDomainDeviceDefDisk: Separate disk frontend config validation Date: Wed, 6 May 2020 14:08:18 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Agregate validation of frontend properties in a new function called qemuValidateDomainDeviceDefDiskFrontend. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 90 ++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 9debac6b30..6f13a1df1b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1897,40 +1897,9 @@ qemuValidateDomainDeviceDefVideo(const virDomainVide= oDef *video, } -int -qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, - virQEMUCapsPtr qemuCaps) +static int +qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk) { - const char *driverName =3D virDomainDiskGetDriver(disk); - virStorageSourcePtr n; - int idx; - int partition; - - if (disk->src->shared && !disk->src->readonly && - !qemuBlockStorageSourceSupportsConcurrentAccess(disk->src)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("shared access for disk '%s' requires use of " - "supported storage format"), disk->dst); - return -1; - } - - if (disk->copy_on_read =3D=3D VIR_TRISTATE_SWITCH_ON) { - if (disk->src->readonly) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("copy_on_read is not compatible with read-onl= y disk '%s'"), - disk->dst); - return -1; - } - - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM || - disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("copy_on_read is not supported with removable= disk '%s'"), - disk->dst); - return -1; - } - } - if (disk->geometry.cylinders > 0 && disk->geometry.heads > 0 && disk->geometry.sectors > 0) { @@ -1958,13 +1927,6 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskD= ef *disk, return -1; } - if (driverName && STRNEQ(driverName, "qemu")) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported driver name '%s' for disk '%s'"), - driverName, disk->dst); - return -1; - } - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM && disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -1973,6 +1935,54 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskD= ef *disk, return -1; } + if (disk->copy_on_read =3D=3D VIR_TRISTATE_SWITCH_ON) { + if (disk->src->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("copy_on_read is not compatible with read-onl= y disk '%s'"), + disk->dst); + return -1; + } + + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM || + disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("copy_on_read is not supported with removable= disk '%s'"), + disk->dst); + return -1; + } + } + + return 0; +} + + +int +qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, + virQEMUCapsPtr qemuCaps) +{ + const char *driverName =3D virDomainDiskGetDriver(disk); + virStorageSourcePtr n; + int idx; + int partition; + + if (qemuValidateDomainDeviceDefDiskFrontend(disk) < 0) + return -1; + + if (disk->src->shared && !disk->src->readonly && + !qemuBlockStorageSourceSupportsConcurrentAccess(disk->src)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("shared access for disk '%s' requires use of " + "supported storage format"), disk->dst); + return -1; + } + + if (driverName && STRNEQ(driverName, "qemu")) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported driver name '%s' for disk '%s'"), + driverName, disk->dst); + return -1; + } + if (virDiskNameParse(disk->dst, &idx, &partition) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid disk target '%s'"), disk->dst); --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766938; cv=none; d=zohomail.com; s=zohoarc; b=CaqHQja73qTCUyFP1Ri1/6Sug/x5Adi42Ge82QvWNX6nNqDSTUVoS1lxrfmzYCLFvf0cvAKnqJlscSKsN1nqTUElgcR4NjJpqmFYavM7UpzWLAsM6pSy0dUR18lsAsCe02W/Ny4v6n55UHGhXm8w1uuaoCPszGVLkgq47zRP4kM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766938; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qHZbGP6O54gMvYsd7m3jzYQp1a8cGlqtzQr71csOSs0=; b=hDzqVFLZmp8K7r2vuEus1GL+Tq1zukBoUuddN9/9JbYP9gFM3AEUyjU5zOBUUD7OwUvb54UXpy3utD24iVM+hDuH82y8yMD0LCfjUCaA72Wtq8al91jzGIvEoZszDf+ht9bnsDkQrovoF5lzqGFV08oNkeJn9ro69BJKXYMkr+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588766938900274.4247070720156; Wed, 6 May 2020 05:08:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-OZYDs8TnM0KZuHGLe1pVvw-1; Wed, 06 May 2020 08:08:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38227872FE1; Wed, 6 May 2020 12:08:50 +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 0E06E5D9DC; Wed, 6 May 2020 12:08:50 +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 AD1EF54D02; Wed, 6 May 2020 12:08:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8mTC029603 for ; Wed, 6 May 2020 08:08:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA1EB5C1BD; Wed, 6 May 2020 12:08:48 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C8B05C1D6 for ; Wed, 6 May 2020 12:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766937; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qHZbGP6O54gMvYsd7m3jzYQp1a8cGlqtzQr71csOSs0=; b=Q20NtMkT8DuUZJLCqcGMBkqQe5OQe2L+xHv1R4YHmWvpT5beHECJV0JROsr4D4/RvtEx9Y sat5GZcRuM9lKlF0hCS+Ozl49+eAmo49HhlkZqCNmVV2CjxaqVJro1GJQ8334P7CZV2kqF G/q/CruEdlJxK/MxcVT2L13L99efnIY= X-MC-Unique: OZYDs8TnM0KZuHGLe1pVvw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/20] qemu: validate: Validate blkdeviotune settings in the validator Date: Wed, 6 May 2020 14:08:19 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the code from qemuCheckDiskConfigBlkdeviotune in src/qemu/qemu_commandline.c to qemuValidateDomainDeviceDefDiskBlkdeviotune. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 101 +------------------------------------- src/qemu/qemu_validate.c | 102 ++++++++++++++++++++++++++++++++++++++- src/qemu/qemu_validate.h | 1 + tests/qemublocktest.c | 2 +- 4 files changed, 104 insertions(+), 102 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 269bdbaf56..87cb78e350 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1131,102 +1131,6 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefP= tr disk) } -/** - * qemuCheckDiskConfigBlkdeviotune: - * @disk: disk configuration - * @qemuCaps: qemu capabilities, NULL if checking cold-configuration - * - * Checks whether block io tuning settings make sense. Returns -1 on error= and - * reports a proper libvirt error. - */ -static int -qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps) -{ - /* group_name by itself is ignored by qemu */ - if (disk->blkdeviotune.group_name && - !virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("group_name can be configured only together with " - "settings")); - return -1; - } - - /* checking def here is only for calling from tests */ - if (disk->blkdeviotune.group_name) { - size_t i; - - for (i =3D 0; i < def->ndisks; i++) { - virDomainDiskDefPtr d =3D def->disks[i]; - - if (STREQ(d->dst, disk->dst) || - STRNEQ_NULLABLE(d->blkdeviotune.group_name, - disk->blkdeviotune.group_name)) - continue; - - if (!virDomainBlockIoTuneInfoEqual(&d->blkdeviotune, - &disk->blkdeviotune)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("different iotunes for disks %s and %s"), - disk->dst, d->dst); - return -1; - } - } - } - - if (disk->blkdeviotune.total_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.size_iops_sec > QEMU_BLOCK_IOTUNE_MAX) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, - _("block I/O throttle limit must " - "be no more than %llu using QEMU"), QEMU_BLOCK_IOT= UNE_MAX); - return -1; - } - - if (qemuCaps) { - /* block I/O throttling 1.7 */ - if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling paramete= rs " - "that are not supported with this QEMU binary= ")); - return -1; - } - - /* block I/O group 2.4 */ - if (disk->blkdeviotune.group_name && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the block I/O throttling group parameter is " - "not supported with this QEMU binary")); - return -1; - } - - /* block I/O throttling length 2.6 */ - if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling length p= arameters " - "that are not supported with this QEMU binary= ")); - return -1; - } - } - - return 0; -} - - /** * qemuCheckDiskConfig: * @disk: disk definition @@ -1237,12 +1141,9 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr = disk, */ int qemuCheckDiskConfig(virDomainDiskDefPtr disk, - const virDomainDef *def, + const virDomainDef *def G_GNUC_UNUSED, virQEMUCapsPtr qemuCaps) { - if (qemuCheckDiskConfigBlkdeviotune(disk, def, qemuCaps) < 0) - return -1; - if (disk->wwn) { if ((disk->bus !=3D VIR_DOMAIN_DISK_BUS_IDE) && (disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI)) { diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 6f13a1df1b..17cfcddd30 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1956,8 +1956,105 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDo= mainDiskDef *disk) } +/** + * qemuValidateDomainDeviceDefDiskBlkdeviotune: + * @disk: disk configuration + * @qemuCaps: qemu capabilities, NULL if checking cold-configuration + * + * Checks whether block io tuning settings make sense. Returns -1 on error= and + * reports a proper libvirt error. + */ +static int +qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef *disk, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + /* group_name by itself is ignored by qemu */ + if (disk->blkdeviotune.group_name && + !virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("group_name can be configured only together with " + "settings")); + return -1; + } + + /* checking def here is only for calling from tests */ + if (disk->blkdeviotune.group_name) { + size_t i; + + for (i =3D 0; i < def->ndisks; i++) { + virDomainDiskDefPtr d =3D def->disks[i]; + + if (STREQ(d->dst, disk->dst) || + STRNEQ_NULLABLE(d->blkdeviotune.group_name, + disk->blkdeviotune.group_name)) + continue; + + if (!virDomainBlockIoTuneInfoEqual(&d->blkdeviotune, + &disk->blkdeviotune)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("different iotunes for disks %s and %s"), + disk->dst, d->dst); + return -1; + } + } + } + + if (disk->blkdeviotune.total_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.read_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.write_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.total_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.read_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.write_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.total_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.read_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.write_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.total_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.read_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.write_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + disk->blkdeviotune.size_iops_sec > QEMU_BLOCK_IOTUNE_MAX) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, + _("block I/O throttle limit must " + "be no more than %llu using QEMU"), QEMU_BLOCK_IOT= UNE_MAX); + return -1; + } + + if (qemuCaps) { + /* block I/O throttling 1.7 */ + if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("there are some block I/O throttling paramete= rs " + "that are not supported with this QEMU binary= ")); + return -1; + } + + /* block I/O group 2.4 */ + if (disk->blkdeviotune.group_name && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the block I/O throttling group parameter is " + "not supported with this QEMU binary")); + return -1; + } + + /* block I/O throttling length 2.6 */ + if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("there are some block I/O throttling length p= arameters " + "that are not supported with this QEMU binary= ")); + return -1; + } + } + + return 0; +} + + int qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, + const virDomainDef *def, virQEMUCapsPtr qemuCaps) { const char *driverName =3D virDomainDiskGetDriver(disk); @@ -1968,6 +2065,9 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, if (qemuValidateDomainDeviceDefDiskFrontend(disk) < 0) return -1; + if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def, qemuCaps) <= 0) + return -1; + if (disk->src->shared && !disk->src->readonly && !qemuBlockStorageSourceSupportsConcurrentAccess(disk->src)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3679,7 +3779,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, break; case VIR_DOMAIN_DEVICE_DISK: - ret =3D qemuValidateDomainDeviceDefDisk(dev->data.disk, qemuCaps); + ret =3D qemuValidateDomainDeviceDefDisk(dev->data.disk, def, qemuC= aps); break; case VIR_DOMAIN_DEVICE_CONTROLLER: diff --git a/src/qemu/qemu_validate.h b/src/qemu/qemu_validate.h index f667a57195..acf7d26ce0 100644 --- a/src/qemu/qemu_validate.h +++ b/src/qemu/qemu_validate.h @@ -28,6 +28,7 @@ int qemuValidateDomainDef(const virDomainDef *def, void *opaque); int qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, + const virDomainDef *def, virQEMUCapsPtr qemuCaps); int qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, const virDomainDef *def, diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 8001807552..fbe4972981 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -284,7 +284,7 @@ testQemuDiskXMLToProps(const void *opaque) return -1; if (qemuCheckDiskConfig(disk, vmdef, data->qemuCaps) < 0 || - qemuValidateDomainDeviceDefDisk(disk, data->qemuCaps) < 0) { + qemuValidateDomainDeviceDefDisk(disk, vmdef, data->qemuCaps) < 0) { VIR_TEST_VERBOSE("invalid configuration for disk"); return -1; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767007; cv=none; d=zohomail.com; s=zohoarc; b=WWfZcUbiVcxbhj5Qe0hmBUo9OI+lHJRdAkBKt0ZqI8WOf5WROWUrOQnchKkfbRzRmaj+cx1FNaVHYa3n2X2qiYX60LK7dMIEjwscZw9KjIj4rWYCh60mIoFehuJBcCwzmzAccB+FpiHupRINUDeLGbL2jHxuNgvIGn/oTR8Yy4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767007; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TQ6VQECC/Z6+LnglFkcTo9npL4cq/hLk/61jGJVxfHg=; b=k5EUJkFr1chQ1VIjVtmNsyfTmLQ9CC/mmo3dZsl+xfe6KdmqEiMK6YtkXdEPV8W82Dz8CXTZaXxGpt9t9RaMoWWNs4hQpvQlcvBIEsoDgdONG7lJ94+r/sNa+uEuxkhbeUwaQhDR/Cqz6OcMK3qe39Lt+EVgSAlEDUiuKzqF4EE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588767007842820.5243193236657; Wed, 6 May 2020 05:10:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-LijR6oraNEqorlf6BAVf2g-1; Wed, 06 May 2020 08:09:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D70B835B5D; Wed, 6 May 2020 12:08:59 +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 538E010001B2; Wed, 6 May 2020 12:08:59 +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 077691809554; Wed, 6 May 2020 12:08:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8nXc029609 for ; Wed, 6 May 2020 08:08:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF6C451580; Wed, 6 May 2020 12:08:49 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 169105C1BD for ; Wed, 6 May 2020 12:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TQ6VQECC/Z6+LnglFkcTo9npL4cq/hLk/61jGJVxfHg=; b=Jw0Go9y2xff7but2H9dGBC3YMAzG2qHrVi6gc9M9te0RaLHHpcbL+OuOq7BBVplqLTF+0V wQrsL8aQciG/AeTT/QxGCPYYLwl1arpXBXDFiNVZIXE5cfllB6f7MAfiS64lF/9eAfRXER iPJD0MxwMEuznbE44/Sj7F22uXmpeVE= X-MC-Unique: LijR6oraNEqorlf6BAVf2g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/20] qemu: Move disk config validation to qemuValidateDomainDeviceDefDiskFrontend Date: Wed, 6 May 2020 14:08:20 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previously we've validated it in qemuCheckDiskConfig which was directly called from the command line generator. Move the checks to the validator where they belong. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 202 +------------------------------------- src/qemu/qemu_validate.c | 204 ++++++++++++++++++++++++++++++++++++++- tests/qemuxml2argvtest.c | 2 +- 3 files changed, 205 insertions(+), 203 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 87cb78e350..2dfd17ad40 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -651,23 +651,6 @@ qemuBuildIoEventFdStr(virBufferPtr buf, return 0; } -#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \ - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+" - -static int -qemuSafeSerialParamValue(const char *value) -{ - if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) !=3D strlen(value)= ) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("driver serial '%s' contains unsafe characters"), - value); - return -1; - } - - return 0; -} - - /** * qemuBuildSecretInfoProps: * @secinfo: pointer to the secret info object @@ -1140,191 +1123,10 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDef= Ptr disk) * error reported. */ int -qemuCheckDiskConfig(virDomainDiskDefPtr disk, +qemuCheckDiskConfig(virDomainDiskDefPtr disk G_GNUC_UNUSED, const virDomainDef *def G_GNUC_UNUSED, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) { - if (disk->wwn) { - if ((disk->bus !=3D VIR_DOMAIN_DISK_BUS_IDE) && - (disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Only ide and scsi disk support wwn")); - return -1; - } - } - - if ((disk->vendor || disk->product) && - disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Only scsi disk supports vendor and product")= ); - return -1; - } - - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { - /* make sure that both the bus supports type=3D'lun' (SG_IO). */ - if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO && - disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device=3D'lun' is not supported for bus= =3D'%s'"), - virDomainDiskBusTypeToString(disk->bus)); - return -1; - } - - if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && - disk->src->format !=3D VIR_STORAGE_FILE_RAW) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device 'lun' using target 'scsi' must u= se " - "'raw' format")); - return -1; - } - - if (qemuDomainDefValidateDiskLunSource(disk->src) < 0) - return -1; - - if (disk->wwn) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting wwn is not supported for lun device"= )); - return -1; - } - if (disk->vendor || disk->product) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting vendor or product is not supported " - "for lun device")); - return -1; - } - } - - switch (disk->bus) { - case VIR_DOMAIN_DISK_BUS_SCSI: - if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for scsi disk")); - return -1; - } - - /* Setting bus=3D attr for SCSI drives, causes a controller - * to be created. Yes this is slightly odd. It is not possible - * to have > 1 bus on a SCSI controller (yet). */ - if (disk->info.addr.drive.bus !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("SCSI controller only supports 1 bus")); - return -1; - } - break; - - case VIR_DOMAIN_DISK_BUS_IDE: - if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for ide disk")); - return -1; - } - /* We can only have 1 IDE controller (currently) */ - if (disk->info.addr.drive.controller !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only 1 IDE controller is supported")); - return -1; - } - break; - - case VIR_DOMAIN_DISK_BUS_FDC: - if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for fdc disk")); - return -1; - } - /* We can only have 1 FDC controller (currently) */ - if (disk->info.addr.drive.controller !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only 1 fdc controller is supported")); - return -1; - } - /* We can only have 1 FDC bus (currently) */ - if (disk->info.addr.drive.bus !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only 1 fdc bus is supported")); - return -1; - } - if (disk->info.addr.drive.target !=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for controller fdc")); - return -1; - } - break; - - case VIR_DOMAIN_DISK_BUS_VIRTIO: - case VIR_DOMAIN_DISK_BUS_XEN: - case VIR_DOMAIN_DISK_BUS_SD: - break; - } - - if (disk->src->readonly && - disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_DISK) { - if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_IDE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("readonly ide disks are not supported")); - return -1; - } - - if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SATA) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("readonly sata disks are not supported")); - return -1; - } - } - - if (disk->transient) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("transient disks not supported yet")); - return -1; - } - - if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_NATIVE && - disk->cachemode !=3D VIR_DOMAIN_DISK_CACHE_DIRECTSYNC && - disk->cachemode !=3D VIR_DOMAIN_DISK_CACHE_DISABLE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("native I/O needs either no disk cache " - "or directsync cache mode, QEMU will fallback " - "to aio=3Dthreads")); - return -1; - } - - if (qemuCaps) { - if (disk->serial && - disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && - disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("scsi-block 'lun' devices do not support the " - "serial property")); - return -1; - } - - if (disk->discard && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("discard is not supported by this QEMU binary= ")); - return -1; - } - - if (disk->detect_zeroes && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DETECT_ZEROES)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("detect_zeroes is not supported by this QEMU = binary")); - return -1; - } - - if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_URING) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("io uring is not supported by this QEMU b= inary")); - return -1; - } - } - } - - if (disk->serial && - qemuSafeSerialParamValue(disk->serial) < 0) - return -1; - return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 17cfcddd30..63cde01762 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1897,8 +1897,26 @@ qemuValidateDomainDeviceDefVideo(const virDomainVide= oDef *video, } +#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \ + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+" + +static int +qemuValidateDomainDeviceDefDiskSerial(const char *value) +{ + if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) !=3D strlen(value)= ) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("driver serial '%s' contains unsafe characters"), + value); + return -1; + } + + return 0; +} + + static int -qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk) +qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk, + virQEMUCapsPtr qemuCaps) { if (disk->geometry.cylinders > 0 && disk->geometry.heads > 0 && @@ -1952,6 +1970,188 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDo= mainDiskDef *disk) } } + if (disk->wwn) { + if ((disk->bus !=3D VIR_DOMAIN_DISK_BUS_IDE) && + (disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only ide and scsi disk support wwn")); + return -1; + } + } + + if ((disk->vendor || disk->product) && + disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only scsi disk supports vendor and product")= ); + return -1; + } + + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { + /* make sure that both the bus supports type=3D'lun' (SG_IO). */ + if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO && + disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device=3D'lun' is not supported for bus= =3D'%s'"), + virDomainDiskBusTypeToString(disk->bus)); + return -1; + } + + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && + disk->src->format !=3D VIR_STORAGE_FILE_RAW) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' using target 'scsi' must u= se " + "'raw' format")); + return -1; + } + + if (qemuDomainDefValidateDiskLunSource(disk->src) < 0) + return -1; + + if (disk->wwn) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting wwn is not supported for lun device"= )); + return -1; + } + if (disk->vendor || disk->product) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting vendor or product is not supported " + "for lun device")); + return -1; + } + } + + switch (disk->bus) { + case VIR_DOMAIN_DISK_BUS_SCSI: + if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for scsi disk")); + return -1; + } + + /* Setting bus=3D attr for SCSI drives, causes a controller + * to be created. Yes this is slightly odd. It is not possible + * to have > 1 bus on a SCSI controller (yet). */ + if (disk->info.addr.drive.bus !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("SCSI controller only supports 1 bus")); + return -1; + } + break; + + case VIR_DOMAIN_DISK_BUS_IDE: + if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for ide disk")); + return -1; + } + /* We can only have 1 IDE controller (currently) */ + if (disk->info.addr.drive.controller !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only 1 IDE controller is supported")); + return -1; + } + break; + + case VIR_DOMAIN_DISK_BUS_FDC: + if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for fdc disk")); + return -1; + } + /* We can only have 1 FDC controller (currently) */ + if (disk->info.addr.drive.controller !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only 1 fdc controller is supported")); + return -1; + } + /* We can only have 1 FDC bus (currently) */ + if (disk->info.addr.drive.bus !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only 1 fdc bus is supported")); + return -1; + } + if (disk->info.addr.drive.target !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for controller fdc")); + return -1; + } + break; + + case VIR_DOMAIN_DISK_BUS_VIRTIO: + case VIR_DOMAIN_DISK_BUS_XEN: + case VIR_DOMAIN_DISK_BUS_SD: + break; + } + + if (disk->src->readonly && + disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_DISK) { + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_IDE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("readonly ide disks are not supported")); + return -1; + } + + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SATA) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("readonly sata disks are not supported")); + return -1; + } + } + + if (disk->transient) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("transient disks not supported yet")); + return -1; + } + + if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_NATIVE && + disk->cachemode !=3D VIR_DOMAIN_DISK_CACHE_DIRECTSYNC && + disk->cachemode !=3D VIR_DOMAIN_DISK_CACHE_DISABLE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("native I/O needs either no disk cache " + "or directsync cache mode, QEMU will fallback " + "to aio=3Dthreads")); + return -1; + } + + if (qemuCaps) { + if (disk->serial && + disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && + disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("scsi-block 'lun' devices do not support the " + "serial property")); + return -1; + } + + if (disk->discard && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("discard is not supported by this QEMU binary= ")); + return -1; + } + + if (disk->detect_zeroes && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DETECT_ZEROES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("detect_zeroes is not supported by this QEMU = binary")); + return -1; + } + + if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_URING) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("io uring is not supported by this QEMU b= inary")); + return -1; + } + } + } + + if (disk->serial && + qemuValidateDomainDeviceDefDiskSerial(disk->serial) < 0) + return -1; + + return 0; } @@ -2062,7 +2262,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, int idx; int partition; - if (qemuValidateDomainDeviceDefDiskFrontend(disk) < 0) + if (qemuValidateDomainDeviceDefDiskFrontend(disk, qemuCaps) < 0) return -1; if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def, qemuCaps) <= 0) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f45f04548f..ad89353910 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1115,7 +1115,7 @@ mymain(void) QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK= _WWN); DO_TEST("disk-scsi-disk-vpd", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK= _WWN); - DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error", + DO_TEST_PARSE_ERROR("disk-scsi-disk-vpd-build-error", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK= _WWN); DO_TEST_CAPS_LATEST("controller-virtio-scsi"); DO_TEST("disk-sata-device", --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767007; cv=none; d=zohomail.com; s=zohoarc; b=L7WPmZQqP6zfAOoEvZoyUtmKEfIRVPo0OJC6T8X/1yEos7ndIhu105+WBTTl+h6lAGHuC8M8SUlT5Xt+rKhYgIDEBGIWcM9irKmSs5Vpf5MwSDkYjU/X/v8ZdZmkcA6I+T0iOXn2W2wT8s491CGH+C2IKSDVIVIcMUrUB07sKvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767007; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tFzM5mr55d1g99JDFC8mgeSjJYo21ntbofxXOMjA3t8=; b=mnEOb4Jo7B+PyY9OZHRDrWXOeAaBPYaDmX31HDLOOt4H1a56/XWcil9yBG4sd/NHI+iQ+hLtt8dJg7Eu2EUCodP85tvu+Fm/QxHxKkt2bTOM7UyWNpo0guDXEJCYzowvfJqQRA8cuiLAtNYAfp4Y0Mr2MYlxwPqtzk59kYKChjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588767007151134.83794237112295; Wed, 6 May 2020 05:10:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-73-4MNYDKBeOMq8BovToXZpTA-1; Wed, 06 May 2020 08:09:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 717B61899525; Wed, 6 May 2020 12:09:03 +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 48D161000079; Wed, 6 May 2020 12:09:03 +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 EBCA554D04; Wed, 6 May 2020 12:09:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8otx029627 for ; Wed, 6 May 2020 08:08:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC2C65C241; Wed, 6 May 2020 12:08:50 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EE665C1BD for ; Wed, 6 May 2020 12:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767005; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tFzM5mr55d1g99JDFC8mgeSjJYo21ntbofxXOMjA3t8=; b=FMs9wCmzg3l5oTL5sM5bcPypfJPmw3C6ndsYJhpxucc7SD56OuKhl/IevdPxjS9+L4x65D rsRIeWNiJTHa6td0j460YPC9v0B+MYvVZ2oH7NuyUl2qkHBunYrxfxiuFpW8vSQ52k0P4D 8cC0kuD+M/hemoCfucIC+B1f02Ctn5A= X-MC-Unique: 4MNYDKBeOMq8BovToXZpTA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/20] qemuCheckDiskConfig: Remove and untangle callers Date: Wed, 6 May 2020 14:08:21 +0200 Message-Id: <5af25423828d10f2879c5174db003818648b65bb.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove the function and passing of 'def' through the callers. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 36 ++++-------------------------------- src/qemu/qemu_command.h | 5 ----- src/qemu/qemu_driver.c | 2 -- src/qemu/qemu_hotplug.c | 2 +- tests/qemublocktest.c | 3 +-- 5 files changed, 6 insertions(+), 42 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2dfd17ad40..d9c3a7a52e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1114,23 +1114,6 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPt= r disk) } -/** - * qemuCheckDiskConfig: - * @disk: disk definition - * @qemuCaps: qemu capabilities, may be NULL for cold-plug check - * - * Perform disk definition config validity checks. Returns -1 on error with - * error reported. - */ -int -qemuCheckDiskConfig(virDomainDiskDefPtr disk G_GNUC_UNUSED, - const virDomainDef *def G_GNUC_UNUSED, - virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) -{ - return 0; -} - - /* QEMU 1.2 and later have a binary flag -enable-fips that must be * used for VNC auth to obey FIPS settings; but the flag only * exists on Linux, and with no way to probe for it via QMP. Our @@ -1449,7 +1432,6 @@ qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr d= isk, static char * qemuBuildDriveStr(virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps) { g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; @@ -1475,10 +1457,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, return NULL; } - /* if we are using -device this will be checked elsewhere */ - if (qemuCheckDiskConfig(disk, def, qemuCaps) < 0) - return NULL; - virBufferAsprintf(&opt, "if=3D%s", virDomainDiskQEMUBusTypeToString(disk->bus)); virBufferAsprintf(&opt, ",index=3D%d", idx); @@ -1618,9 +1596,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, g_autofree char *scsiVPDDeviceId =3D NULL; int controllerModel; - if (qemuCheckDiskConfig(disk, def, qemuCaps) < 0) - return NULL; - if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps, = disk->dst)) return NULL; @@ -2131,7 +2106,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virC= ommandPtr cmd, static int qemuBuildDiskSourceCommandLine(virCommandPtr cmd, virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps) { g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; @@ -2151,7 +2125,7 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd, !(copyOnReadProps =3D qemuBlockStorageGetCopyOnReadProps(disk)= )) return -1; } else { - if (!(data =3D qemuBuildStorageSourceChainAttachPrepareDrive(disk,= def, qemuCaps))) + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareDrive(disk,= qemuCaps))) return -1; } @@ -2181,7 +2155,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd, { g_autofree char *optstr =3D NULL; - if (qemuBuildDiskSourceCommandLine(cmd, disk, def, qemuCaps) < 0) + if (qemuBuildDiskSourceCommandLine(cmd, disk, qemuCaps) < 0) return -1; if (!qemuDiskBusNeedsDriveArg(disk->bus)) { @@ -9979,7 +9953,6 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef = *vcpu) */ qemuBlockStorageSourceAttachDataPtr qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps) { g_autoptr(qemuBlockStorageSourceAttachData) data =3D NULL; @@ -9987,7 +9960,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDis= kDefPtr disk, if (VIR_ALLOC(data) < 0) return NULL; - if (!(data->driveCmd =3D qemuBuildDriveStr(disk, def, qemuCaps)) || + if (!(data->driveCmd =3D qemuBuildDriveStr(disk, qemuCaps)) || !(data->driveAlias =3D qemuAliasDiskDriveFromDisk(disk))) return NULL; @@ -10049,7 +10022,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorag= eSourcePtr src, */ qemuBlockStorageSourceChainDataPtr qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps) { g_autoptr(qemuBlockStorageSourceAttachData) elem =3D NULL; @@ -10058,7 +10030,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDo= mainDiskDefPtr disk, if (VIR_ALLOC(data) < 0) return NULL; - if (!(elem =3D qemuBuildStorageSourceAttachPrepareDrive(disk, def, qem= uCaps))) + if (!(elem =3D qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps= ))) return NULL; if (qemuBuildStorageSourceAttachPrepareCommon(disk->src, elem, qemuCap= s) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index bc3ba44fb3..0bb66c3f0b 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -105,7 +105,6 @@ bool qemuDiskBusNeedsDriveArg(int bus); qemuBlockStorageSourceAttachDataPtr qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps); int qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src, @@ -115,7 +114,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSou= rcePtr src, qemuBlockStorageSourceChainDataPtr qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, - const virDomainDef *def, virQEMUCapsPtr qemuCaps); @@ -200,9 +198,6 @@ int qemuGetDriveSourceString(virStorageSourcePtr src, bool qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk); -int qemuCheckDiskConfig(virDomainDiskDefPtr disk, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps); bool qemuCheckFips(void); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1c7c87128d..c5e6cab817 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8143,8 +8143,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, } if (virDomainDiskTranslateSourcePool(disk) < 0) return -1; - if (qemuCheckDiskConfig(disk, vmdef, NULL) < 0) - return -1; if (qemuCheckDiskConfigAgainstDomain(vmdef, disk) < 0) return -1; if (virDomainDiskInsert(vmdef, disk) < 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 60d0729f1e..641b6f1fe1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -713,7 +713,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, priv= ->qemuCaps))) goto cleanup; } else { - if (!(data =3D qemuBuildStorageSourceChainAttachPrepareDrive(disk,= vm->def, + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareDrive(disk, priv->q= emuCaps))) goto cleanup; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index fbe4972981..b80ee2ae6c 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -283,8 +283,7 @@ testQemuDiskXMLToProps(const void *opaque) virDomainDiskInsert(vmdef, disk) < 0) return -1; - if (qemuCheckDiskConfig(disk, vmdef, data->qemuCaps) < 0 || - qemuValidateDomainDeviceDefDisk(disk, vmdef, data->qemuCaps) < 0) { + if (qemuValidateDomainDeviceDefDisk(disk, vmdef, data->qemuCaps) < 0) { VIR_TEST_VERBOSE("invalid configuration for disk"); return -1; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766956; cv=none; d=zohomail.com; s=zohoarc; b=AlZy8/vLLDBe9HAc/w0sjPboYW04Q8hL5Go7QI91g//ZC6D+5zR50vAnvKj0c42nDQ5zDsH4h69adPgi5MJ/L/ZVpTdtLutdA5NX94fdBYtM7kwLuTU4KpF/VA6+8BWgRO1igs7IgBeRpU0RbkBoUQ6EgTS8esXJFw0MYtGIxIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766956; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NZtCVwOY3ucECIqeQzYB1YBTDjk4KBg1/xyoGSPwp4g=; b=G5kF7l4Hfco0L3679329+zyM3QNXYAGVU3wwW+uL/uDfnEDFSjXlX/tpYnjv9gNMacSmpkJ0mBwRbAV6dNvAGp4CmUTnfiFdjjfd4FTjp5GqI4pRpl7Q5BInorDeoINDRsN4aCgvLIkePWbwzxqsb7iuBIhBB7OYElAaNUznI8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588766956548363.70030068485164; Wed, 6 May 2020 05:09:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-tiUu2OBjORCp89JL7BbXfQ-1; Wed, 06 May 2020 08:09:13 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8C93835BC1; Wed, 6 May 2020 12:09:06 +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 C2D4B5C1BD; Wed, 6 May 2020 12:09:06 +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 7C2A51809543; Wed, 6 May 2020 12:09:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8pmM029634 for ; Wed, 6 May 2020 08:08:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id AD0D45C1D6; Wed, 6 May 2020 12:08:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F8E95C1BD for ; Wed, 6 May 2020 12:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766955; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NZtCVwOY3ucECIqeQzYB1YBTDjk4KBg1/xyoGSPwp4g=; b=HUEPgz0lEmIrwdaUft956Qht2s0lQZqsLoE9BLsAcGzrzQC6he12Y5aYKJWqbrYHz0YVIF 98YWWxSzMNicbPLSH2N6Ij/G4WBuiqF3Kz/qgiU16eVbAGDLECvnItgcxMc/GkAjuOlU2+ npSXLTnqm/5azJGNh0IacAQfau3psyo= X-MC-Unique: tiUu2OBjORCp89JL7BbXfQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/20] qemu: Rename qemuDiskBusNeedsDriveArg to qemuDiskBusIsSD Date: Wed, 6 May 2020 14:08:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The function effectively boils down to whether the disk is 'SD'. Since we'll need to make more decisions based on the fact whether the disk is on the SD bus, rename the function. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 8 ++++---- src/qemu/qemu_command.h | 2 +- src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_process.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d9c3a7a52e..1b3651a758 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1141,7 +1141,7 @@ qemuCheckFips(void) /** - * qemuDiskBusNeedsDriveArg: + * qemuDiskBusIsSD: * @bus: disk bus * * Unfortunately it is not possible to use -device for SD devices. @@ -1149,7 +1149,7 @@ qemuCheckFips(void) * without -device. */ bool -qemuDiskBusNeedsDriveArg(int bus) +qemuDiskBusIsSD(int bus) { return bus =3D=3D VIR_DOMAIN_DISK_BUS_SD; } @@ -1441,7 +1441,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, if (qemuBuildDriveSourceStr(disk, qemuCaps, &opt) < 0) return NULL; - if (!qemuDiskBusNeedsDriveArg(disk->bus)) { + if (!qemuDiskBusIsSD(disk->bus)) { g_autofree char *drivealias =3D qemuAliasDiskDriveFromDisk(disk); if (!drivealias) return NULL; @@ -2158,7 +2158,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd, if (qemuBuildDiskSourceCommandLine(cmd, disk, qemuCaps) < 0) return -1; - if (!qemuDiskBusNeedsDriveArg(disk->bus)) { + if (!qemuDiskBusIsSD(disk->bus)) { if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_FDC || virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { if (qemuCommandAddExtDevice(cmd, &disk->info) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 0bb66c3f0b..53e05777e7 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -101,7 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def, virQEMUCapsPtr qemuCaps); char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk); -bool qemuDiskBusNeedsDriveArg(int bus); +bool qemuDiskBusIsSD(int bus); qemuBlockStorageSourceAttachDataPtr qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 641b6f1fe1..f1b2fbb1a8 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1072,7 +1072,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverP= tr driver, case VIR_DOMAIN_DISK_BUS_SD: /* Note that SD card hotplug support should be added only once * they support '-device' (don't require -drive only). - * See also: qemuDiskBusNeedsDriveArg */ + * See also: qemuDiskBusIsSD */ case VIR_DOMAIN_DISK_BUS_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("disk bus '%s' cannot be hotplugged."), diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8ea470f75f..488ca91435 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5499,7 +5499,7 @@ qemuProcessPrepareQEMUCaps(virDomainObjPtr vm, /* clear the 'blockdev' capability for VMs which have disks that need = -drive */ for (i =3D 0; i < vm->def->ndisks; i++) { - if (qemuDiskBusNeedsDriveArg(vm->def->disks[i]->bus)) { + if (qemuDiskBusIsSD(vm->def->disks[i]->bus)) { virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); break; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767011; cv=none; d=zohomail.com; s=zohoarc; b=h//O4xh91bINhRuJSVgN4TfS/ogNsOdNcRbp7g1bw+S0T9S5PJLhOYPZtFyvfdQ+YS6Zc9Xa6+WlRtECIZ99I/TgoqHNAUvqKOIQHIVYG5/QKDBsx7cAhPdCZqsJqdvjke5n2DPleuijhEoWv2ndzTkPZvBF8kXZ1b3piAG4p7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767011; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yR5vMQkGYXWutTGgkskVTxsvoLwMCqIDqJwtwY9NhRA=; b=hTlIlHKQBQKHg7rhTD7ozwnrphvXyM8c352sfOakVVYYjlPhUh+WUM6hHw/6WwHGoFM5jt3FresZyTrIg3W00xfEmYzTo/w0gkyWDVz8aly+8ITs3DWbYxFOCvYniOpxi3SjbPfuWMcuWv9LXNBCqh1lHFQ/m92q/wtD88B08rc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588767011379762.3173944922787; Wed, 6 May 2020 05:10:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-n8c5uO-jNtGATcDPgSAMJA-1; Wed, 06 May 2020 08:09:01 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 79447102C7F2; Wed, 6 May 2020 12:08:54 +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 4DA885C1D6; Wed, 6 May 2020 12:08:54 +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 0B27954D05; Wed, 6 May 2020 12:08:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8qEh029639 for ; Wed, 6 May 2020 08:08:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id A72565C1D4; Wed, 6 May 2020 12:08:52 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19EA85C1BD for ; Wed, 6 May 2020 12:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yR5vMQkGYXWutTGgkskVTxsvoLwMCqIDqJwtwY9NhRA=; b=LQvUnI/SVEalXm5Eq8dUsBGjMuyiAGrqWP9dIenYU+isjOOscZeWQ1wgXDk6fYZUy+SJyM PZJOgMTHwOMr50SS0Sg3DyCFQnqxLvuSpP2tvFBUAwimn+4ySGSHxJ7xzxcEbVdFQaAbYO dCfQmMbPfcx0J+PeRe7PH/EVAdm3V1g= X-MC-Unique: n8c5uO-jNtGATcDPgSAMJA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/20] qemuBuildDiskCommandLine: Clarify logic around building -device for disks Date: Wed, 6 May 2020 14:08:23 +0200 Message-Id: <5874904fe4640551f90db7bd3cfa45352d003c8c.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For 'SD' disks and floppies in the pre-blockdev era we don't format -device. Extract the logic so that it's more clear and add comments. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1b3651a758..3f3e3b69a8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2158,20 +2158,26 @@ qemuBuildDiskCommandLine(virCommandPtr cmd, if (qemuBuildDiskSourceCommandLine(cmd, disk, qemuCaps) < 0) return -1; - if (!qemuDiskBusIsSD(disk->bus)) { - if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_FDC || - virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { - if (qemuCommandAddExtDevice(cmd, &disk->info) < 0) - return -1; + /* SD cards are currently instantiated via -drive if=3Dsd, so the -dev= ice + * part must be skipped */ + if (qemuDiskBusIsSD(disk->bus)) + return 0; - virCommandAddArg(cmd, "-device"); + /* floppy devices are instantiated via -drive ...,if=3Dnone and bound = to the + * controller via -global isa-fdc.driveA/B options in the pre-blockdev= era */ + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_FDC && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) + return 0; - if (!(optstr =3D qemuBuildDiskDeviceStr(def, disk, bootindex, - qemuCaps))) - return -1; - virCommandAddArg(cmd, optstr); - } - } + if (qemuCommandAddExtDevice(cmd, &disk->info) < 0) + return -1; + + virCommandAddArg(cmd, "-device"); + + if (!(optstr =3D qemuBuildDiskDeviceStr(def, disk, bootindex, + qemuCaps))) + return -1; + virCommandAddArg(cmd, optstr); return 0; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766960; cv=none; d=zohomail.com; s=zohoarc; b=m9LJ1RTzyViI5kkyuYjU2u9Wc2FuHAqbhaSrf7HA0qhJDZ+AqkSqAUn2nwywM0IgFn5IWiZbuoYdW4f2X6k88hJsXoSqM3/w9Y2khvFdt8BgYZq3P8BwBFpLzlPtCyKagwdnXMxHiSslZQjx+QxbZfGyokin7rFEr9fg+mqifBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766960; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ihLVKTBdfWbbA9v3Fk3iRHdH9Ij0UEDlawgRitJMWTI=; b=NbOwTwnyF2/SUerOdzFdhdPPS6KUo/voF4W1YKsNpf+sZcbFGi60V8bmrTnJU0Xbo1mTR+k5rDTuWM4Rr86Xhcv/tPXfZwdAxUn/CfDN5RLZ5OUrnBKtnr7ZOCGWvKuQ0LqySHQvAlWVeHaJkLFC7HqWZ7pGBM89FPpHS9aB7mk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588766960462892.8754842645473; Wed, 6 May 2020 05:09:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-3aFDt_erO3umkczruZy7oQ-1; Wed, 06 May 2020 08:09:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 353BE100CCDE; Wed, 6 May 2020 12:09:11 +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 0651A1002398; Wed, 6 May 2020 12:09:11 +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 9E5571809563; Wed, 6 May 2020 12:09:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8roa029652 for ; Wed, 6 May 2020 08:08:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9939B5C1BD; Wed, 6 May 2020 12:08:53 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C18F5C241 for ; Wed, 6 May 2020 12:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766959; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ihLVKTBdfWbbA9v3Fk3iRHdH9Ij0UEDlawgRitJMWTI=; b=HZfTVjINCjHhjC//azbs8/mMYcV+ikrlhiGA33LqMuj5Gs66xQ29dY29qDZTMoWds+P0Eh 8iDG1+GbjygYXzUfyrZ2VUOZ0brgFFXEsT/TqhOtiUI8Ye32UxGv95X+kLcnZlNbZ+82qM e/wSzRHfQYG8dHDPH2E9eOPfP5rtPKA= X-MC-Unique: 3aFDt_erO3umkczruZy7oQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/20] qemuBuildDriveStr: Refactor formatting of command line for 'sd' cards Date: Wed, 6 May 2020 14:08:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove all the universal code since the 'else' part formats commandline only for the SD card based disk. Note that we can use virDiskNameToIndex without the check as we already validate that 'disk->dst' contains a properly formatted string in the validation code. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3f3e3b69a8..9836972234 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1449,17 +1449,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, virBufferAddLit(&opt, "if=3Dnone"); virBufferAsprintf(&opt, ",id=3D%s", drivealias); } else { - int idx =3D virDiskNameToIndex(disk->dst); - - if (idx < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type '%s'"), disk->dst); - return NULL; - } - - virBufferAsprintf(&opt, "if=3D%s", - virDomainDiskQEMUBusTypeToString(disk->bus)); - virBufferAsprintf(&opt, ",index=3D%d", idx); + virBufferAsprintf(&opt, "if=3Dsd,index=3D%d", + virDiskNameToIndex(disk->dst)); } /* werror/rerror are really frontend attributes, but older --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767133; cv=none; d=zohomail.com; s=zohoarc; b=lAQZ55E7MyOCb5nRCOS46qG6c+VPqafD2Sg3EvSrqIVTYDGcxWl0N3uwmPVQLR+WWEy6tgWkVJj/qd7iaNJ8uoEq65quWJrDW/I/TfyfpQCepfaF4yutV604gMPjMb8H9UuyuZTa4NVGFhpFTgaFxhtywV9ew0DvDGDLWMOjCUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767133; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aO9P7CIAo8yptMUb4eBvo0eyVQ8fPgHKM4eZrQ8EwLw=; b=bC3TYuGFF07SpYI5V47ubkxlIMwjnRdAEAsxHVg652qci1DsWJIfwgKK+sxTsYBkAVTQT7C5RIDOjaIJdfs+gAbM4kwrdQTX3i/jOsPnJl/FF0UBqghMN08BIVmcOmL+cy6TF1R9W5/PKHH/qlR4vOrpfmFHyNE1YH6ZXSGUaCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588767133895974.2844613945189; Wed, 6 May 2020 05:12:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301-bZeymAKBN3ekVEpABE4l_w-1; Wed, 06 May 2020 08:09:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15A91107ACF3; Wed, 6 May 2020 12:09:15 +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 DC8B519C4F; Wed, 6 May 2020 12:09:14 +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 8DFA71809543; Wed, 6 May 2020 12:09:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8sFQ029670 for ; Wed, 6 May 2020 08:08:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 911255C541; Wed, 6 May 2020 12:08:54 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0872E5C1D4 for ; Wed, 6 May 2020 12:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767132; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aO9P7CIAo8yptMUb4eBvo0eyVQ8fPgHKM4eZrQ8EwLw=; b=JmBAZz/ZxSAswmvocGJrsaX60WUovf9nUO3WGGPnOLu0hA/imb1/BRD/FRwkAEUKnT4N9f mvhWz7o0pJdyPbs54Py6oDrxBZZ8WBfnkamOYCzAl80rTr9CKLY4VQD0hOpY0iv8UTgk7h LpXKlqhp/kBiPUIlNCWpudU8hDaYzIw= X-MC-Unique: bZeymAKBN3ekVEpABE4l_w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/20] qemuBuildDiskDeviceStr: Use XML disk bus type names in error message Date: Wed, 6 May 2020 14:08:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There's no point using the qemu-specific disk bus names in the error message. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9836972234..77f0d83054 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1581,7 +1581,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virQEMUCapsPtr qemuCaps) { g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; - const char *bus =3D virDomainDiskQEMUBusTypeToString(disk->bus); const char *contAlias; g_autofree char *backendAlias =3D NULL; g_autofree char *scsiVPDDeviceId =3D NULL; @@ -1838,7 +1837,8 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, case VIR_DOMAIN_DISK_BUS_LAST: default: virReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk bus '%s' with device setup"), b= us); + _("unsupported disk bus '%s' with device setup"), + NULLSTR(virDomainDiskBusTypeToString(disk->bus))); return NULL; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767009; cv=none; d=zohomail.com; s=zohoarc; b=bsSL+r2rUTmEZpWQ+yrQNH/sP5uq9zrsAP4nmqkIcgsnFDE9pIVWnjEQiiOYaJwczAn9TxpX/Wijdd3OA+cR3PlVgQZcu3a76qYXxLNN7n3QwAQ5NDPY++PBNhRRX2vIp+iih43Sxnn7Z5ke5Kp+L3iO+ft+KFiZJje1Whe6vNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767009; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=32VicUHtbXUc98VyRz9uTfgZTmCkANF/nN4CO1i/LbU=; b=nrV+PHDkaZh28VUoAH1ejuAQh3LZ+vrRHxpF1tWzhfDMd3VtfbzLHnVc3hsXHPObavvcgSx+lWzj+iz3HxcJQ7dnXvkGOp4zgWglUQc6lU4DvI6a4X6Q01gzAZdPxtYlSqm1f8gKVR8l9uVtc6fI7weCHBoLwYVBHOyUC2wvWpA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588767009346701.7519753821834; Wed, 6 May 2020 05:10:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-i3E6sh_LODaiqc1r-W_krQ-1; Wed, 06 May 2020 08:09:04 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 011A2189952C; Wed, 6 May 2020 12:08:58 +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 BDDF55D9E4; Wed, 6 May 2020 12:08:57 +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 66BA91809542; Wed, 6 May 2020 12:08:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8thV029679 for ; Wed, 6 May 2020 08:08:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8EA3A5C1D6; Wed, 6 May 2020 12:08:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id F297B5C1BD for ; Wed, 6 May 2020 12:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767008; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=32VicUHtbXUc98VyRz9uTfgZTmCkANF/nN4CO1i/LbU=; b=BtBHyf2yYlClqbEp2hji4vRwMuZw+c1Q/F1+Pfmpb2rm7Pqpu8gLvqSoZSTQcCLz0bi//I Nlxf66HrLfmqoAAH1Zh/c8vdJJXU3wTogfM4RGwqfSwAIzdxHIp312er6jlOgT+JQyYpKM 2ySnY/2RjFIqyPdqhg886O0luRueGlI= X-MC-Unique: i3E6sh_LODaiqc1r-W_krQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/20] qemu: command: Remove 'virDomainDiskQEMUBus' enum converters Date: Wed, 6 May 2020 14:08:26 +0200 Message-Id: <9268a74c1f839f1742b93e34a7bf884336c44f45.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are no users for the qemu-specific enum values. Remove it. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 77f0d83054..07669ded44 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -73,21 +73,6 @@ VIR_LOG_INIT("qemu.qemu_command"); -VIR_ENUM_DECL(virDomainDiskQEMUBus); -VIR_ENUM_IMPL(virDomainDiskQEMUBus, - VIR_DOMAIN_DISK_BUS_LAST, - "ide", - "floppy", - "scsi", - "virtio", - "xen", - "usb", - "uml", - "sata", - "sd", -); - - VIR_ENUM_DECL(qemuDiskCacheV2); VIR_ENUM_IMPL(qemuDiskCacheV2, --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766969; cv=none; d=zohomail.com; s=zohoarc; b=Nuvslxhp8uDKGc6MXaclniT8WXxHS4d963/AVqfqupjw2iTjn85wOm/4d7S4PnBl8sLzXFP2ffhIXLAe+tfET0i7j4nJnt+eA+WAoRDkNlX9A7Ax8cccTQKrPPrcYP4JRFLgQ9v470VwrrtvImCTDMktpzgBtF/4NuGA0KbC/SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766969; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rPF6Vdj39TsNtdDi4jba+FMi9hyVB2lxnErQFGD/Nls=; b=Gwgr9IrVrChc+k7pP4Nw2Lzajex4hwCngHFUyM5Z2d+Xi2+ZY05ULHpDGT+kdMzJxGuuWTod1v3yD9qTvoKilyJvVVNG0ZuYe6LFiHqtsbfFj6NsLPZotriQmUunDxjmlCjR6YphT7XbIZkvZ93bzfylOpBjRmWeRaom3zwmMcs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1588766969126856.4536698379588; Wed, 6 May 2020 05:09:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-t5Ps2A5aPYubSfKZv-TApw-1; Wed, 06 May 2020 08:09:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D4D51899525; Wed, 6 May 2020 12:09: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 DF9B22E18C; Wed, 6 May 2020 12:09: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 8B95554D01; Wed, 6 May 2020 12:09:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8uhI029695 for ; Wed, 6 May 2020 08:08:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E2935C1D4; Wed, 6 May 2020 12:08:56 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED3CC5C1BD for ; Wed, 6 May 2020 12:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766966; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rPF6Vdj39TsNtdDi4jba+FMi9hyVB2lxnErQFGD/Nls=; b=ZzM2c+xNkcok+gwtzr3gePN0NJp9GhtkT3GHVqAUl3kqT6blmEAnHyEzB/w7E7jrI6wSTO 03HzgS+twYx0elO8AxwDy0XhkcmQKCfUraMlrJgaUXjwwqx+mbmJITBSlmNKT7CwKk6HCv gla+avhFi3VUKvPcgOLeda9twYSLtNI= X-MC-Unique: t5Ps2A5aPYubSfKZv-TApw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/20] qemuDomainSetBlockThreshold: Call qemuBlockNodeNamesDetect only without blockdev Date: Wed, 6 May 2020 14:08:27 +0200 Message-Id: <24f37344d484dedf11bb0d0489ebd42922abc759.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Make sure that we don't try to reload node names with -blockdev. If something doesn't have a node name the update will not make the situation better. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c5e6cab817..cb0373bf76 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -22597,7 +22597,8 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (!(src =3D qemuDomainGetStorageSourceByDevstr(dev, vm->def))) goto endjob; - if (!src->nodestorage && + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + !src->nodestorage && qemuBlockNodeNamesDetect(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) goto endjob; --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766971; cv=none; d=zohomail.com; s=zohoarc; b=ifSxykUUCDZ9IEoA5m4TqNSHC1iOXAgr5gUjgRlOwqzYqy4zjIoqTTkW/K9v161CDRt8nF/rBJIpoSBfKEVJaBnStQAyE6UcEdeDPmxH4ZCWXVH3OxXyCZ+dL5ANiP+uroIf1HvFJw+qqoYLxwrlbfxjimoyjCKAXBKazuewkMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766971; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lt0STv64yIfvdp19HIPGpkbFkqO0nXdyDF0wXiV9nTA=; b=bSZUL+QC3Dzp6C1uzNNwW+LRmunmjf/ymUHEGQc96dcdXaGtwbCkeZ1ZCrG9lI4PK5OTT8nWFdmOzqVkQtwzobJyNzoFa2ST3hruZVB8MS2249OOYxw9usDiwLnTVOkKKlsgSajfOJl72528dHq1aSC4pegzJse40a2JD3olF0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 158876697128777.6971361470986; Wed, 6 May 2020 05:09:31 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-117-GHYuUrnjN9KOopDfQG-NiQ-1; Wed, 06 May 2020 08:09:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE202461; Wed, 6 May 2020 12:09:22 +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 8D4CD99D2; Wed, 6 May 2020 12:09:22 +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 4323254D03; Wed, 6 May 2020 12:09:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8vv4029711 for ; Wed, 6 May 2020 08:08:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE5515C541; Wed, 6 May 2020 12:08:57 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE27E5C1D4 for ; Wed, 6 May 2020 12:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766970; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Lt0STv64yIfvdp19HIPGpkbFkqO0nXdyDF0wXiV9nTA=; b=WES1rmhBFrTpSzyRwXYQjrOGH24AjVN/7Www0DB9Uq/rQbp206lPgWqm5ht/Ka4AfvisJ3 VAEj3ZP8RGIjU5dDc3rHp2yHIKIHsbYEHZj6HvpIOqEKHJ+kRs98acdUJjdzk6l5QnD2Fa fHAtm4IimB6OZTOEFxqHwM1oiwPGFz8= X-MC-Unique: GHYuUrnjN9KOopDfQG-NiQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/20] qemuDomainValidateStorageSource: Extract check for BLOCKDEV capability Date: Wed, 6 May 2020 14:08:28 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9c629c31a3..e76a76021e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5140,6 +5140,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, virQEMUCapsPtr qemuCaps) { int actualType =3D virStorageSourceGetActualType(src); + bool blockdev =3D virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV); if (src->format =3D=3D VIR_STORAGE_FILE_COW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -5224,8 +5225,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, /* In pre-blockdev era we can't configure the slice so we can allo= w them * only for detected backing store entries as they are populated * from a place that qemu would be able to read */ - if (!src->detected && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!src->detected && !blockdev) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage slice is not supported by this QEMU = binary")); return -1; @@ -5241,8 +5241,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, return -1; } - if (!src->detected && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!src->detected && !blockdev) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("ssl verification setting is not supported by= this QEMU binary")); return -1; @@ -5258,8 +5257,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, return -1; } - if (!src->detected && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!src->detected && !blockdev) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("http cookies are not supported by this QEMU = binary")); return -1; @@ -5280,8 +5278,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, return -1; } - if (!src->detected && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!src->detected && !blockdev) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("readahead setting is not supported with this= QEMU binary")); return -1; @@ -5299,8 +5296,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, return -1; } - if (!src->detected && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!src->detected && !blockdev) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("timeout setting is not supported with this Q= EMU binary")); return -1; --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766976; cv=none; d=zohomail.com; s=zohoarc; b=DWo2y5zUPy9S6uL2mq+uW4a8ks3wdRxOJllwwJoGjNn2M7g3kLEGBBl/oQorN12IFyJDCfXdX86yWE49lVxTj9Z2uwwfDYXMHDfivNWLEY3bw7wuWp0ObKihCWY+VA3FdsNWpajRYrHNn4XVcvSB1w1Y7eq52ZF8OknG2D4r3l0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766976; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VCFzJGwFLZVWQUQWJAF0QgYUyFuornIZv+smmeQgltg=; b=gUsGBNiuRWRQrjzI1XW/QdXkkCqAQCz+KPlly55eBtjz6UWFMuGCR4MNLnlx/aAtTaEEDwubvdR0GjD8GvU7+Nioz/S1RdYEtGdnCkqpqtzvXIzjmoBKlU0fwdxkYYeZLCWnplyGrWxNNve8pZyvfnvJGzzQ0KzE3aVLhk/X8Pk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1588766976728453.48207065392876; Wed, 6 May 2020 05:09:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-322-RsjDWrtiNnGjOJAtqITFWw-1; Wed, 06 May 2020 08:09:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31DA21899524; Wed, 6 May 2020 12:09:26 +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 0477619C4F; Wed, 6 May 2020 12:09:26 +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 B58E3180954D; Wed, 6 May 2020 12:09:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8wLe029716 for ; Wed, 6 May 2020 08:08:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D32FF5C3FA; Wed, 6 May 2020 12:08:58 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E9CA5C541 for ; Wed, 6 May 2020 12:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766975; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VCFzJGwFLZVWQUQWJAF0QgYUyFuornIZv+smmeQgltg=; b=Dkec/hKelYLrxcpYn3HHbHQy85GA/xEPSDMrKnuWbTWPHHchjmGHZQtC0CGMLZxW9XEGaU ui4NSbI1aNFLLkiZ6cY7INVxIFU0bYxTW6VYXa2dnd9TPV5zfcZeH7eR0XgQzM1PkJ+End CqP3WhpRMOz3L1oFhqAYsArR+urKn7Y= X-MC-Unique: RsjDWrtiNnGjOJAtqITFWw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/20] qemuDomainValidateStorageSource: Allow masking out blockdev support Date: Wed, 6 May 2020 14:08:29 +0200 Message-Id: <8409f234f27f8a9fd0bf383d34680ca73c88ee1f.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In case of 'sd' cards we'll use pre-blockdev code also if qemu supports blockdev. In that specific case we'll need to mask out blockdev support for 'sd' disks. Plumb in a boolean to allow it. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 12 ++++++++---- src/qemu/qemu_domain.h | 3 ++- src/qemu/qemu_validate.c | 2 +- tests/qemublocktest.c | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e76a76021e..01f2792401 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5137,11 +5137,15 @@ qemuDomainValidateActualNetDef(const virDomainNetDe= f *net, int qemuDomainValidateStorageSource(virStorageSourcePtr src, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps, + bool maskBlockdev) { int actualType =3D virStorageSourceGetActualType(src); bool blockdev =3D virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV); + if (maskBlockdev) + blockdev =3D false; + if (src->format =3D=3D VIR_STORAGE_FILE_COW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'cow' storage format is not supported")); @@ -8294,7 +8298,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, if (n->format =3D=3D VIR_STORAGE_FILE_ISO) n->format =3D VIR_STORAGE_FILE_RAW; - if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0) + if (qemuDomainValidateStorageSource(n, priv->qemuCaps, false) < 0) return -1; qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps); @@ -13137,7 +13141,7 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDefP= tr disk, qemuDomainObjPrivatePtr priv, virQEMUDriverConfigPtr cfg) { - if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0) + if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps, true) <= 0) return -1; qemuDomainPrepareStorageSourceConfig(disk->src, cfg, priv->qemuCaps); @@ -13173,7 +13177,7 @@ qemuDomainPrepareStorageSourceBlockdev(virDomainDis= kDefPtr disk, if (qemuBlockStorageSourceNeedsStorageSliceLayer(src)) src->sliceStorage->nodename =3D g_strdup_printf("libvirt-%u-slice-= sto", src->id); - if (qemuDomainValidateStorageSource(src, priv->qemuCaps) < 0) + if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0) return -1; qemuDomainPrepareStorageSourceConfig(src, cfg, priv->qemuCaps); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 639d27d8a5..ea0fce64a8 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1237,7 +1237,8 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr d= isk, int qemuDomainValidateStorageSource(virStorageSourcePtr src, - virQEMUCapsPtr qemuCaps); + virQEMUCapsPtr qemuCaps, + bool maskBlockdev); int diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 63cde01762..a7c918e5fd 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2297,7 +2297,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, } for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { - if (qemuDomainValidateStorageSource(n, qemuCaps) < 0) + if (qemuDomainValidateStorageSource(n, qemuCaps, false) < 0) return -1; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index b80ee2ae6c..82c11311e2 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -294,7 +294,7 @@ testQemuDiskXMLToProps(const void *opaque) if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) return -1; - if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0) + if (qemuDomainValidateStorageSource(n, data->qemuCaps, false) < 0) return -1; qemuDomainPrepareDiskSourceData(disk, n); @@ -529,7 +529,7 @@ testQemuImageCreate(const void *opaque) src->capacity =3D UINT_MAX * 2ULL; src->physical =3D UINT_MAX + 1ULL; - if (qemuDomainValidateStorageSource(src, data->qemuCaps) < 0) + if (qemuDomainValidateStorageSource(src, data->qemuCaps, false) < 0) return -1; if (qemuBlockStorageSourceCreateGetStorageProps(src, &protocolprops) <= 0) --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766955; cv=none; d=zohomail.com; s=zohoarc; b=bsxejsAheg91XdTXFCy6VqbolNKiVv6Tb/Un1e3MY921piZfhDqcEs7P0DYtYsFNs37KXN8+KRLFzy1W4S10Hk8/77mmnUmpC4JQy9z9r6c14sFRQbrF5VO1M+3TjnKTMcYiYEDp+u26nI2zMjcnvm/K3nsb2lmfDzR1dXBX4K8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766955; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=reamrTGLdRPD9RIPuTRrDYoWLQdBQ0Wrje4erzlzqCc=; b=Cdqqb0KIwAaVnj59XYmeLNT49QounJ7rlUdvMB6GjUTBKYRXTbJk0GApx25LdgaSHKfDKLfEwkCiEFMKM3E4vWwXL0DL/yW1gioNUYaLSMIiaZ3xK+qrYLaXRJN0GffEdHLr2P7ZgsByy50t4v/+Zl1yUKC8/1gDGpjBfKqFvPo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1588766955609637.2036064068218; Wed, 6 May 2020 05:09:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-33-sCqSqKIzNOG9KptZljElKQ-1; Wed, 06 May 2020 08:09:12 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E481E835B4A; Wed, 6 May 2020 12:09:02 +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 B962E5C1D4; Wed, 6 May 2020 12:09:02 +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 6A32F54D02; Wed, 6 May 2020 12:09:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C8xEq029721 for ; Wed, 6 May 2020 08:08:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id C82A75C1D4; Wed, 6 May 2020 12:08:59 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 396885C1BD for ; Wed, 6 May 2020 12:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766954; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=reamrTGLdRPD9RIPuTRrDYoWLQdBQ0Wrje4erzlzqCc=; b=Rg7lY+5FghPgxFqpYNf7OvkGwwlOApiy5/NtbMnjz80RVCYs13il8FNBxoCvFvvLCIZFcu gAXayQw523iOJE1nT9NETEZPTUoJvKveSTHV9YCkQrmt7uZgfYY73DzZeuJY/8oFr7cICq I6nTkMps5QQm5cokZfQVdC3GivdebUc= X-MC-Unique: sCqSqKIzNOG9KptZljElKQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/20] tests: Add tests for a virtio and sd disk in a single machine Date: Wed, 6 May 2020 14:08:30 +0200 Message-Id: <678766037d32d611b8f4cfc6394ff88fa1ff8d32.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The 'vexpress-a9' ARM board supports the native 'sd' bus as well as virtio. Add a test case for proving that upcoming changes to handling of 'sd' work. This config was also tested with real qemu and the qemu process starts correctly. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- .../disk-arm-virtio-sd.aarch64-4.0.0.args | 39 ++++++++++++++++++ .../disk-arm-virtio-sd.aarch64-latest.args | 40 ++++++++++++++++++ tests/qemuxml2argvdata/disk-arm-virtio-sd.xml | 36 ++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ .../disk-arm-virtio-sd.aarch64-latest.xml | 41 +++++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 6 files changed, 161 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-4.0.0= .args create mode 100644 tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-lates= t.args create mode 100644 tests/qemuxml2argvdata/disk-arm-virtio-sd.xml create mode 100644 tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-lat= est.xml diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-4.0.0.args b= /tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-4.0.0.args new file mode 100644 index 0000000000..3c2a7cf240 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-4.0.0.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-armtest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-armtest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-armtest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-armtest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-arm \ +-name guest=3Darmtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-armtest/master-key.aes \ +-machine vexpress-a9,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 1024 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 496d7ea8-9739-544b-4ebd-ef08be936e6a \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-kernel /arm.kernel \ +-initrd /arm.initrd \ +-append 'console=3DttyAMA0,\ +115200n8 rw root=3D/dev/vda3 rootwait physmap.enabled=3D0' \ +-dtb /arm.dtb \ +-usb \ +-drive file=3D/arm-sd.qcow2,format=3Dqcow2,if=3Dsd,index=3D0 \ +-drive file=3D/arm-virtio.qcow2,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio= -disk0 \ +-device virtio-blk-device,scsi=3Doff,drive=3Ddrive-virtio-disk0,id=3Dvirti= o-disk0 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args = b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args new file mode 100644 index 0000000000..7147dfee76 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args @@ -0,0 +1,40 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-armtest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-armtest/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-armtest/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-armtest/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-arm \ +-name guest=3Darmtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-armtest/master-key.aes \ +-machine vexpress-a9,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu cortex-a9 \ +-m 1024 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 496d7ea8-9739-544b-4ebd-ef08be936e6a \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-kernel /arm.kernel \ +-initrd /arm.initrd \ +-append 'console=3DttyAMA0,\ +115200n8 rw root=3D/dev/vda3 rootwait physmap.enabled=3D0' \ +-dtb /arm.dtb \ +-usb \ +-drive file=3D/arm-sd.qcow2,format=3Dqcow2,if=3Dsd,index=3D0 \ +-drive file=3D/arm-virtio.qcow2,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio= -disk0 \ +-device virtio-blk-device,scsi=3Doff,drive=3Ddrive-virtio-disk0,id=3Dvirti= o-disk0 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml b/tests/qemuxml2= argvdata/disk-arm-virtio-sd.xml new file mode 100644 index 0000000000..0a6482fd4a --- /dev/null +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.xml @@ -0,0 +1,36 @@ + + armtest + 496d7ea8-9739-544b-4ebd-ef08be936e6a + 1048576 + 1048576 + 1 + + hvm + /arm.kernel + /arm.initrd + /arm.dtb + console=3DttyAMA0,115200n8 rw root=3D/dev/vda3 rootwait physm= ap.enabled=3D0 + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-arm + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ad89353910..4ab664a846 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1175,6 +1175,9 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-slices"); + DO_TEST_CAPS_ARCH_VER("disk-arm-virtio-sd", "aarch64", "4.0.0"); + DO_TEST_CAPS_ARCH_LATEST("disk-arm-virtio-sd", "aarch64"); + DO_TEST("graphics-egl-headless", QEMU_CAPS_EGL_HEADLESS, QEMU_CAPS_DEVICE_CIRRUS_VGA); diff --git a/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml= b/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml new file mode 100644 index 0000000000..024db53ffb --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-arm-virtio-sd.aarch64-latest.xml @@ -0,0 +1,41 @@ + + armtest + 496d7ea8-9739-544b-4ebd-ef08be936e6a + 1048576 + 1048576 + 1 + + hvm + /arm.kernel + /arm.initrd + console=3DttyAMA0,115200n8 rw root=3D/dev/vda3 rootwait physm= ap.enabled=3D0 + /arm.dtb + + + + + + + + + cortex-a9 + + + destroy + restart + restart + + /usr/bin/qemu-system-arm + + + + + + + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 34a9f2803a..e7480fcf9d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -643,6 +643,8 @@ mymain(void) DO_TEST("disk-serial", NONE); + DO_TEST_CAPS_ARCH_LATEST("disk-arm-virtio-sd", "aarch64"); + DO_TEST("virtio-rng-random", QEMU_CAPS_DEVICE_VIRTIO_RNG); DO_TEST("virtio-rng-egd", --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766978; cv=none; d=zohomail.com; s=zohoarc; b=KxiSWZpubw3EJNUGKSTDX3Ir55S8+bdMi7bry+0ZeeiZCMd/GyaNN2h+RAouwVCqWM4AFoSXpZQW3Wc8QCtIs+2Ccwsn4TJFjZBCIx8vwV0KAYJGG610UEK8yVRqr10W3wRFMxMwWQQcrS9x15mmTPaEuvTfFQ89Oxn9VYx1CFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766978; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mQjoHYMDaDQPRkgSCE/ABq5KFVByLzLOOX/Q97whTkQ=; b=ivN+mPwBoOG2UbMUkE3o9BbCRKjtyvy1TmpocszTvYb7Zh91444zcdSiaaUNDH73ulip1EXsXaZ+0DMH5AIWmsXyKLAAqC1HoJFRTnlunHFVrS+AM8WWl3GnuwQ1hEwtH5Q6l/QKz9c/0F5RgoMDDvQElHA8XijtAmgJtDQvbvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1588766978705208.5110303022161; Wed, 6 May 2020 05:09:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-cXpfVe6wPcqhGhaNVX-0dQ-1; Wed, 06 May 2020 08:09:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 007A0EC1A8; Wed, 6 May 2020 12:09:30 +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 C91021C933; Wed, 6 May 2020 12:09:29 +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 7FFEF54D01; Wed, 6 May 2020 12:09:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C90CL029737 for ; Wed, 6 May 2020 08:09:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id C4FF65C1BD; Wed, 6 May 2020 12:09:00 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 371FA5C1D6 for ; Wed, 6 May 2020 12:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mQjoHYMDaDQPRkgSCE/ABq5KFVByLzLOOX/Q97whTkQ=; b=OGEyhkU/mqrXqLHuYLB9j2yikEdh2yJgdsVfBMYwqDWzYOZ1E/gZtItPmv1reLCIMbCa+s tkxo287/JpllkOevjB0CTUaKQiYfAbeEZvDj3dNG6r59FIRYVe7lBDuPM7t3GJWq9egtp3 uVZgx079+OBR9OBtBKhyMrnI0gEUeEw= X-MC-Unique: cXpfVe6wPcqhGhaNVX-0dQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/20] qemu: Forbid 'cdrom' on 'sd' bus Date: Wed, 6 May 2020 14:08:31 +0200 Message-Id: <11d12bfa3af0f89916b64735b45645fcc56cce6e.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We can't set the type of the device on the 'sd' bus and realistically a cdrom doesn't even make sense there. Forbid it. Note that the output of in disk-cdrom-bus-other.x86_64-latest.args switched to blockdev as it's no longer locked out due to use of a disk on 'sd' bus. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 5 +++-- .../disk-cdrom-bus-other.x86_64-latest.args | 13 ++++++------- tests/qemuxml2argvdata/disk-cdrom-bus-other.xml | 11 ----------- tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml | 11 ----------- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a7c918e5fd..f49181b639 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1946,9 +1946,10 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, } if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM && - disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { + (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO || + disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SD)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk type 'virtio' of '%s' does not support ejec= table media"), + _("disk type of '%s' does not support ejectable med= ia"), disk->dst); return -1; } diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args= b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args index b1c30dd4d8..be091f150f 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args @@ -28,14 +28,13 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -no-acpi \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ --drive file=3D/root/boot.iso,format=3Draw,if=3Dnone,id=3Ddrive-usb-disk0,r= eadonly=3Don \ --device usb-storage,bus=3Dusb.0,port=3D1,drive=3Ddrive-usb-disk0,id=3Dusb-= disk0,\ +-blockdev '{"driver":"file","filename":"/root/boot.iso",\ +"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw"= ,\ +"file":"libvirt-2-storage"}' \ +-device usb-storage,bus=3Dusb.0,port=3D1,drive=3Dlibvirt-2-format,id=3Dusb= -disk0,\ removable=3Doff \ --drive if=3Dnone,id=3Ddrive-usb-disk1,readonly=3Don \ --device usb-storage,bus=3Dusb.0,port=3D2,drive=3Ddrive-usb-disk1,id=3Dusb-= disk1,\ -removable=3Doff \ --drive file=3D/root/boot2.iso,format=3Draw,if=3Dsd,index=3D2,readonly=3Don= \ --drive if=3Dsd,index=3D3,readonly=3Don \ +-device usb-storage,bus=3Dusb.0,port=3D2,id=3Dusb-disk1,removable=3Doff \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml b/tests/qemuxm= l2argvdata/disk-cdrom-bus-other.xml index e73db8c6ab..e6bf1ea797 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml +++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml @@ -26,17 +26,6 @@ - - - - - - - - - - - diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml b/tests/qemu= xml2xmloutdata/disk-cdrom-bus-other.xml index 10262e40d7..ec86d19f1d 100644 --- a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml +++ b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml @@ -26,17 +26,6 @@ - - - - - - - - - - -
--=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767004; cv=none; d=zohomail.com; s=zohoarc; b=Y22AHlqhR/yCk12C8dthLexiDUjEATCkGrRU/VFXikj/L96B+ci/OUCfz09QhXR2spc5vC6zSTX2nMd72mqWA5jKABxuh4WTdIKpUaqmgHw0ZaRpIx4WcNUjGwxBKyT37GSLRdeFs6yzIGwrhpdbmM96t6DlX3fGMYMGCyrqUpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767004; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VJxLxYvgs0aNvr3G3xsBrQ0FJUab0Sp73BE2/Fn8THQ=; b=cSe17cgQ0CcPbygOzLJKm73J0wAZuGhMCIafJSuvuZTjDqD1qZqVaxSdFfiDoP2P26IV0+UuGI7PYm5pVag2yD3MbBnh57H8TI9fO+TH9uT6qfiw1nOQejjssZ1DgwXP92hvARre9eL/ZbSYlnqx4OEhox+xgB9dz3rQzlJ0jk8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588767004380348.80988813426995; Wed, 6 May 2020 05:10:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-gW8XhbN6PZSXIV7p6aZUCA-1; Wed, 06 May 2020 08:09:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EF90835BC2; Wed, 6 May 2020 12:09:07 +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 D37FE1002389; Wed, 6 May 2020 12:09:06 +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 84662180954D; Wed, 6 May 2020 12:09:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C91GV029746 for ; Wed, 6 May 2020 08:09:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id B66335C254; Wed, 6 May 2020 12:09:01 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3157C5C1D6 for ; Wed, 6 May 2020 12:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767003; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VJxLxYvgs0aNvr3G3xsBrQ0FJUab0Sp73BE2/Fn8THQ=; b=IXsHc1wLaCMhZ58NOGoeuqvLNP2eH8sbDqHbSFK9J5W/1TnIkdGCiqelXj5Rjory1PYOUx shME8GcoqBMCXnCRJnL26SZxYw/ME9rJ23620ZPgfwgUqg5W+FZ+azsrRSWLrhMyKvbBqi ZoE5ro+HVXbsMzg8LR0Ij4HnD0208mc= X-MC-Unique: gW8XhbN6PZSXIV7p6aZUCA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/20] qemu: Refuse blockjobs on disk bus='sd' with -blockdev Date: Wed, 6 May 2020 14:08:32 +0200 Message-Id: <15c4ed09d5a35f7da71f3741e6d936ff30597c76.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We still have to use -drive to instantiate sd disks. Combining that with the new logic for blockjobs would be very complicated and not worth it given that 'sd' cards work only on few rarely used machine types of non-common architectures and libvirt didn't implement support for 'sd' bus controllers. This will allow us to use -blockdev for other kinds on such machines while sacrificing block jobs. Note: this is currently no-op as we mask-out the QEMU_CAPS_BLOCKDEV capability if any of the disks has bus=3D'sd'. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_backup.c | 3 +++ src/qemu/qemu_checkpoint.c | 3 +++ src/qemu/qemu_domain.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ src/qemu/qemu_driver.c | 22 ++++++++++++++++++---- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 80fc5d77f8..b317b841cd 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -315,6 +315,9 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, return -1; } + if (!qemuDomainDiskBlockJobIsSupported(vm, dd->domdisk)) + return -1; + if (!dd->store->format) dd->store->format =3D VIR_STORAGE_FILE_QCOW2; diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 3f6aa36ef3..b71b4a7d14 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -445,6 +445,9 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver, vm->def->disks[i]->src->format)); return -1; } + + if (!qemuDomainDiskBlockJobIsSupported(vm, vm->def->disks[i])) + return -1; } return 0; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 01f2792401..395cc3daee 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13620,3 +13620,29 @@ qemuDomainInitializePflashStorageSource(virDomainO= bjPtr vm) return 0; } + + +/** + * qemuDomainDiskBlockJobIsSupported: + * + * Returns true if block jobs are supported on @disk by @vm or false and r= eports + * an error otherwise. + * + * Note that this does not verify whether other block jobs are running etc. + */ +bool +qemuDomainDiskBlockJobIsSupported(virDomainObjPtr vm, + virDomainDiskDefPtr disk) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + qemuDiskBusIsSD(disk->bus)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("block jobs are not supported on disk '%s' using = bus 'sd'"), + disk->dst); + return false; + } + + return true; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ea0fce64a8..41d3f1561d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1293,3 +1293,7 @@ qemuDomainMakeCPUMigratable(virCPUDefPtr cpu); int qemuDomainInitializePflashStorageSource(virDomainObjPtr vm); + +bool +qemuDomainDiskBlockJobIsSupported(virDomainObjPtr vm, + virDomainDiskDefPtr disk); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cb0373bf76..c7eb62f10d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14603,7 +14603,8 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDo= mainSnapshotDiskDefPtr snapdi static int -qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr sn= apdisk, +qemuDomainSnapshotPrepareDiskExternalActive(virDomainObjPtr vm, + virDomainSnapshotDiskDefPtr sn= apdisk, virDomainDiskDefPtr domdisk, bool blockdev) { @@ -14616,6 +14617,9 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDoma= inSnapshotDiskDefPtr snapdisk return -1; } + if (!qemuDomainDiskBlockJobIsSupported(vm, domdisk)) + return -1; + switch ((virStorageType)actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: @@ -14671,7 +14675,8 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDoma= inSnapshotDiskDefPtr snapdisk static int -qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk, +qemuDomainSnapshotPrepareDiskExternal(virDomainObjPtr vm, + virDomainDiskDefPtr disk, virDomainSnapshotDiskDefPtr snapdisk, bool active, bool reuse, @@ -14698,7 +14703,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDisk= DefPtr disk, if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) = < 0) return -1; } else { - if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk, bl= ockdev) < 0) + if (qemuDomainSnapshotPrepareDiskExternalActive(vm, snapdisk, disk= , blockdev) < 0) return -1; } @@ -14857,7 +14862,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm, return -1; } - if (qemuDomainSnapshotPrepareDiskExternal(dom_disk, disk, + if (qemuDomainSnapshotPrepareDiskExternal(vm, dom_disk, disk, active, reuse, block= dev) < 0) return -1; @@ -17444,6 +17449,9 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; + if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) + goto endjob; + if (base && (virStorageFileParseChainIndex(disk->dst, base, &baseIndex) < 0 || !(baseSource =3D virStorageFileChainLookup(disk->src, disk->src, @@ -18002,6 +18010,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; + if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) + goto endjob; + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN && qemuDomainDefValidateDiskLunSource(mirror) < 0) goto endjob; @@ -18483,6 +18494,9 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; + if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) + goto endjob; + blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); /* Convert bandwidth MiB to bytes, if necessary */ --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588767015; cv=none; d=zohomail.com; s=zohoarc; b=UAMB93ODnstu7zVFaGQMaOkrngCEj2L/goAs1B8yqCXEzsZhHOLrGvSCZmFE6/AXm83UVFNhGDy1XjFfARechZ0s5aEZUS6HbWy7Z3U+whSFCTIfxCNvEsX8RFUmYEaBrh34QJP6o/UPcWEAh7YU4mudGQOtX6tOXoZodIkCyvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588767015; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rjfEcqFcGNrSxKrp5ONKSgZQh7rV80lL8c0yYa+RrYE=; b=ao8FBS08Y7mwT2nNSBZFTnRPf1KloWPLCCTapcaEo+7qPzXFJuX/21cUMArzeTFZa25YchEvkH0AE82ZNXEC3EWU6HtmJZe2/1T9qFT1t/e6F/yQMpyZxZ4adx5RdZyg3sUC2fxFzO85lbJk1xQ4aK/Z9lX3Btwqx+tF+gY6YZI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15887670156251011.3732386269457; Wed, 6 May 2020 05:10:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-OLHudsU4M9yyusDrynJ5Gw-1; Wed, 06 May 2020 08:09:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CC9E108BD14; Wed, 6 May 2020 12:09:11 +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 E20185D9C5; Wed, 6 May 2020 12:09:10 +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 7FEB81809561; Wed, 6 May 2020 12:09:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C92oS029771 for ; Wed, 6 May 2020 08:09:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id A992B5C1D6; Wed, 6 May 2020 12:09:02 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 196895C1BD for ; Wed, 6 May 2020 12:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588767014; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rjfEcqFcGNrSxKrp5ONKSgZQh7rV80lL8c0yYa+RrYE=; b=SZcgtLHvBCsD/QLq5atTtCdn9mECCyTo5iT8QUPfm80KaQCvtU2ohy4jDiVB9oLPID30qh mJCkpjHMqyPdEx1dxL0vwIO3cWEIPA0dgSdTFoBQYTBLhswzOLln3W1n4+vv1LRU1Jkg85 RCUcsnkncGIw05IkykRcN0W4aS5HnWs= X-MC-Unique: OLHudsU4M9yyusDrynJ5Gw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 18/20] qemu: Handle cases when 'qomName' isn't present Date: Wed, 6 May 2020 14:08:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use the drive alias for all cases when we can't generate qomName. This is meant to handle disks on 'sd' bus which are instantiated via -drive if=3Dsd as there isn't any specific QOM name for them. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 16 ++++++++++------ src/qemu/qemu_process.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c7eb62f10d..1617f79d34 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10892,7 +10892,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, goto cleanup; } - if (blockdev) { + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { entryname =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!disk->info.alias) { @@ -10948,7 +10948,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, disk =3D vm->def->disks[i]; entryname =3D disk->info.alias; - if (blockdev) + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) entryname =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; if (!entryname) @@ -19283,7 +19283,8 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (!(disk =3D qemuDomainDiskByName(def, path))) goto endjob; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) @@ -19473,7 +19474,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!(disk =3D qemuDomainDiskByName(def, path))) goto endjob; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) @@ -19608,7 +19610,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(dis= k); const char *entryname =3D disk->info.alias; - if (blockdev) + if (blockdev && diskPriv->qomName) entryname =3D diskPriv->qomName; if ((info =3D virHashLookup(table, entryname)) && @@ -21426,7 +21428,9 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefP= tr disk, for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { g_autofree char *alias =3D NULL; - if (blockdev) { + /* for 'sd' disks we won't be displaying stats for the backing cha= in + * as we don't update the stats correctly */ + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { frontendalias =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; backendalias =3D n->nodeformat; backendstoragealias =3D n->nodestorage; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 488ca91435..fe2ac2dcfe 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7729,7 +7729,7 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, struct qemuDomainDiskInfo *info; const char *entryname =3D disk->info.alias; - if (blockdev) + if (blockdev && diskpriv->qomName) entryname =3D diskpriv->qomName; if (!(info =3D virHashLookup(table, entryname))) --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766954; cv=none; d=zohomail.com; s=zohoarc; b=BdQensQkoiwAxNqU15RVjRGUZ9NXQahMxWh0QxSqjdcFibZS8gpWt2DQ9zpEoSUp7V0z7OHrX0rCzBxh5p9p8bwZ7gU1hNyDwNk1I+N/dqVhY+Wmp6CdNUJllY1tAuopIg2NUoSGnu+KQtSSpzbsHvgp8o4z67pgtKtr25mAQbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766954; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9agSns27Pl1uwRdaMOGV2ZyWKfQtbAOhOuG4+lPyDkA=; b=mu5wKRhU1asmVYp+K2qVrsy4ogz+NU5E98pEf7rC1hjMXhS1GMrVv18x1HMHyDIeUNjapnGbwgoMPts99YgBE5ajU37mSQ03YJkNlnSmpCQEf6zNJlHi5uK7tTtWA11JVUcZsRxcofaIDCStBx9yhArOOCUyi38vxQV+qPSfy9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588766954592199.05500109612808; Wed, 6 May 2020 05:09:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-465-EJawg8h_N4mDgm8Yn-ZIBA-1; Wed, 06 May 2020 08:09:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2137F1005510; Wed, 6 May 2020 12:09:06 +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 C4F6F5C1D6; Wed, 6 May 2020 12:09:05 +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 5C62E54D04; Wed, 6 May 2020 12:09:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C93hP029779 for ; Wed, 6 May 2020 08:09:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 990885C241; Wed, 6 May 2020 12:09:03 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15CFD5C1BD for ; Wed, 6 May 2020 12:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766953; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9agSns27Pl1uwRdaMOGV2ZyWKfQtbAOhOuG4+lPyDkA=; b=NAHDflQBMNn+lPAz3GwsqXA9EfcGBIpz/kRg2q8SvW/INiOz0UnI5Hvisgfldzu2oFAEcz pifEI+ATKgxwEh/nV4ac8sBHdn8ranRE/UOaP7PqXKvIUGJIDKzFis7OZPXOY8ABN8MSFV j65Xbqthf6oy6fYnoszhCJ7+Cufh1Xs= X-MC-Unique: EJawg8h_N4mDgm8Yn-ZIBA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/20] qemu: Prepare for 'sd' card use together with blockdev Date: Wed, 6 May 2020 14:08:34 +0200 Message-Id: <3bf2929f5285a5bafd5eabb5054de2edb62cc896.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" SD cards need to be instantiated via -drive if=3Dsd. This means that all cases where we use the blockdev path need to be special-cased for SD cards. Note that at this point QEMU_CAPS_BLOCKDEV is still cleared if the VM config has a SD card. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 3 ++- src/qemu/qemu_domain.c | 13 +++++++++---- src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_hotplug.c | 3 ++- src/qemu/qemu_process.c | 6 +++++- src/qemu/qemu_validate.c | 4 +++- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 07669ded44..5b803f106b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2089,7 +2089,8 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd, g_autofree char *copyOnReadPropsStr =3D NULL; size_t i; - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (virStorageSourceIsEmpty(disk->src)) return 0; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 395cc3daee..0c122f300d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8216,6 +8216,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, virStorageSourcePtr src; /* iterator for the backing chain declared in= XML */ virStorageSourcePtr n; /* iterator for the backing chain detected from= disk */ qemuDomainObjPrivatePtr priv =3D vm->privateData; + bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); + bool isSD =3D qemuDiskBusIsSD(disk->bus); uid_t uid; gid_t gid; @@ -8298,13 +8300,14 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr drive= r, if (n->format =3D=3D VIR_STORAGE_FILE_ISO) n->format =3D VIR_STORAGE_FILE_RAW; - if (qemuDomainValidateStorageSource(n, priv->qemuCaps, false) < 0) + /* mask-out blockdev for 'sd' disks */ + if (qemuDomainValidateStorageSource(n, priv->qemuCaps, isSD) < 0) return -1; qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps); qemuDomainPrepareDiskSourceData(disk, n); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + if (blockdev && !isSD && qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0) return -1; } @@ -8362,7 +8365,8 @@ qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr dis= k, { *backendAlias =3D NULL; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) || + qemuDiskBusIsSD(disk->bus)) { if (!(*backendAlias =3D qemuAliasDiskDriveFromDisk(disk))) return -1; @@ -13238,7 +13242,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr dis= k, disk->src->format =3D VIR_STORAGE_FILE_RAW; } - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0) return -1; } else { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1617f79d34..63b4a49c3c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10808,7 +10808,8 @@ qemuDomainBlockResize(virDomainPtr dom, disk->src->format =3D=3D VIR_STORAGE_FILE_QED) size =3D VIR_ROUND_UP(size, 512); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("can't resize empty or readonly disk '%s'"), diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f1b2fbb1a8..ab5a7aef84 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4270,7 +4270,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, disk->info.alias, vm, vm->def->name); - if (blockdev) { + if (blockdev && + !qemuDiskBusIsSD(disk->bus)) { corAlias =3D g_strdup(diskPriv->nodeCopyOnRead); if (diskPriv->blockjob) { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fe2ac2dcfe..b1751d4b52 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6405,7 +6405,7 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver, continue; /* backing chain needs to be redetected if we aren't using blockde= v */ - if (!blockdev) + if (!blockdev || qemuDiskBusIsSD(disk->bus)) virStorageSourceBackingStoreClear(disk->src); /* @@ -6634,6 +6634,10 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver= Ptr driver, virDomainDiskDefPtr disk =3D vm->def->disks[i]; qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(dis= k); + /* sd-cards are instantiated via -drive */ + if (qemuDiskBusIsSD(disk->bus)) + continue; + if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f49181b639..2cde678ca0 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2259,6 +2259,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, virQEMUCapsPtr qemuCaps) { const char *driverName =3D virDomainDiskGetDriver(disk); + bool isSD =3D qemuDiskBusIsSD(disk->bus); virStorageSourcePtr n; int idx; int partition; @@ -2298,7 +2299,8 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, } for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { - if (qemuDomainValidateStorageSource(n, qemuCaps, false) < 0) + /* blockdev support is masked out for 'sd' disks */ + if (qemuDomainValidateStorageSource(n, qemuCaps, isSD) < 0) return -1; } --=20 2.26.2 From nobody Mon May 6 10:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588766958; cv=none; d=zohomail.com; s=zohoarc; b=UFjMSRZfxKjQrLxMv/L76qqAse7CvJjcuvwgcvK5w1UX0WCONkeM5tgEWyF+Ch38pi1lOd6l2UKRM/j+R5rTl2UVETc0cDHhUvsbTeTXk1PmLlyuXjfWLOoGNJ0wevJih4hxdAbb3V+69eW8EEdnwqoZK5aMrlYv5VIPGn5a/Ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588766958; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ScYc2FuhnhukSS38GYyyalHB0sJMJkYj9CyO+U50q1Q=; b=RI2Q2UYaTyQthTuFERXygLZYhykoZMh71whNrpq1tg0Nre/tr70l8AsHbIklH02Q8vDv0D7WOp4XY/LbfNM3pYhthhzvrml70he3YuVLGrXcYcNQOksGf7rNWK048o7CieZ2teQQdWU8QwRQf4uFihn/i5GqSPASrbUkJTUfdFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1588766958329553.4389397825671; Wed, 6 May 2020 05:09:18 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-FItVeM8cPgynlb2k9ijE7A-1; Wed, 06 May 2020 08:09:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A50A88014D9; Wed, 6 May 2020 12:09:09 +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 782F31001B07; Wed, 6 May 2020 12:09:09 +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 29AC6180954D; Wed, 6 May 2020 12:09:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046C94jC029784 for ; Wed, 6 May 2020 08:09:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96AA95C1D4; Wed, 6 May 2020 12:09:04 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 081465C1BD for ; Wed, 6 May 2020 12:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588766957; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ScYc2FuhnhukSS38GYyyalHB0sJMJkYj9CyO+U50q1Q=; b=gwZgTLMGxyyR07kHUqmRqvd/Nc5SV679irrCFligCIiU8LDtGU2Y3lnOz4E8H9rdAV7/GT RHYJ+75BDmGy1mNrYq8STFL7MUnKSeehiQDTule9aryXl/jlZnJaE6lFiRYTSdEwrXzbq0 el92bgdGgzA0zkAsFKA7BzDH+f5o3oE= X-MC-Unique: FItVeM8cPgynlb2k9ijE7A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/20] qemu: process: Don't clear QEMU_CAPS_BLOCKDEV when SD card is present Date: Wed, 6 May 2020 14:08:35 +0200 Message-Id: <186291011d1a42c5abb5a328248234996d5fd677.1588766791.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Help QEMU in deprecation of -drive if=3Dnone without the need to refactor all old boards. Stop masking out -blockdev support when -drive if=3Dsd needs to be used. We achieve this by forbidding blockjobs and special-casing all other code paths. Blockjobs are sacrificed in this case as SD cards are a corner case for some ARM boards and are thus not used commonly. https://bugzilla.redhat.com/show_bug.cgi?id=3D1821692 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 9 --------- .../disk-arm-virtio-sd.aarch64-latest.args | 7 +++++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b1751d4b52..dee3f3fb63 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5488,7 +5488,6 @@ qemuProcessPrepareQEMUCaps(virDomainObjPtr vm, unsigned int processStartFlags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - size_t i; virObjectUnref(priv->qemuCaps); if (!(priv->qemuCaps =3D virQEMUCapsCacheLookupCopy(qemuCapsCache, @@ -5497,14 +5496,6 @@ qemuProcessPrepareQEMUCaps(virDomainObjPtr vm, vm->def->os.machine)= )) return -1; - /* clear the 'blockdev' capability for VMs which have disks that need = -drive */ - for (i =3D 0; i < vm->def->ndisks; i++) { - if (qemuDiskBusIsSD(vm->def->disks[i]->bus)) { - virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - break; - } - } - if (processStartFlags & VIR_QEMU_PROCESS_START_STANDALONE) virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS); diff --git a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args = b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args index 7147dfee76..f17dd2157a 100644 --- a/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args +++ b/tests/qemuxml2argvdata/disk-arm-virtio-sd.aarch64-latest.args @@ -33,8 +33,11 @@ file=3D/tmp/lib/domain--1-armtest/master-key.aes \ -dtb /arm.dtb \ -usb \ -drive file=3D/arm-sd.qcow2,format=3Dqcow2,if=3Dsd,index=3D0 \ --drive file=3D/arm-virtio.qcow2,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio= -disk0 \ --device virtio-blk-device,scsi=3Doff,drive=3Ddrive-virtio-disk0,id=3Dvirti= o-disk0 \ +-blockdev '{"driver":"file","filename":"/arm-virtio.qcow2",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qco= w2",\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-device,scsi=3Doff,drive=3Dlibvirt-1-format,id=3Dvirtio-= disk0 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ -msg timestamp=3Don --=20 2.26.2