From nobody Fri Dec 19 16:06:46 2025 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 --- 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