From nobody Wed May 15 09:43:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1609845766; cv=none; d=zohomail.com; s=zohoarc; b=Uo6uZI9BGK+UQPhbGuzOGRJ9OxmrlyL2GWG7ckQmrWj3ZP0ugtzYsW2eTixi33EOHhgfhusC43RQQb7Fz/0EpKsEMT5OWJIfpXjAsnZsZfjpzcilCIWefZLuvBf+ouO9F1npFAL3KPLwqIzuM7mrDhA6x+pT6YRPXR5Q7vagPyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609845766; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=aoctHhguKVPcgqFpCu95ayaJLoCGw6tXbbae22nJRrc=; b=WEE/fr7KsA75LJz+pyYUdt/vsvr8rZ3Ci1wZ9fszjayf87wjmQRDvrows1tkewknaBVldKykTMOwNcaarYrPHfBDk7CeTmY0nxQisp78dpdwgMTkaeNKsE+QY5xZAuh+kSvxB5+evzmhXUgnUsF37BuFYCBQQ+h7cNajugZE4EI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609845766238495.11466837822286; Tue, 5 Jan 2021 03:22:46 -0800 (PST) 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-175-98hnVUZ6Otuukz8AxYG6ew-1; Tue, 05 Jan 2021 06:22:42 -0500 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 F0D73180A096; Tue, 5 Jan 2021 11:22:35 +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 7D93B19C46; Tue, 5 Jan 2021 11:22:34 +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 3D7634A7C6; Tue, 5 Jan 2021 11:22:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 105BMTiU023581 for ; Tue, 5 Jan 2021 06:22:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 647355D735; Tue, 5 Jan 2021 11:22:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B7166A05 for ; Tue, 5 Jan 2021 11:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609845765; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aoctHhguKVPcgqFpCu95ayaJLoCGw6tXbbae22nJRrc=; b=EJJmTkFpSr4blbfhP0GFtxJ1KHF3GIy27smxulWMvyaDU3Q5uO8WuAIe25TsGO9Vo+iYAQ +1T4RlU301LyhldM6kOJU7CU1nbngIV7vtKWTdAa1zBe7M9bxbVTEWZE7QXdEpDUHqMYV4 j+FAlKvwiPVahC3G0PTd9siN3IdO4ww= X-MC-Unique: 98hnVUZ6Otuukz8AxYG6ew-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemu: Properly handle setting of for empty cdrom Date: Tue, 5 Jan 2021 12:22:24 +0100 Message-Id: <06bc72bdab3bc3639f1043b8c6de7deb9cbb653c.1609845744.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" When starting a VM with an empty cdrom which has configured the startup fails as qemu is not happy about setting tuning for an empty drive: error: internal error: unable to execute 'block_set_io_throttle', unexpect= ed error: 'Device has no medium' Resolve this by skipping the setting of throttling for empty drives and updating the throttling when new medium is inserted into the drive. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/111 Signed-off-by: Peter Krempa Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 10 ++++++++++ src/qemu/qemu_process.c | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9b93f256e8..57635cd419 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -558,6 +558,16 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver, nodename); } + /* set throttling for the new image */ + if (rc =3D=3D 0 && + !virStorageSourceIsEmpty(newsrc) && + qemuDiskConfigBlkdeviotuneEnabled(disk)) { + rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, NULL, + diskPriv->qomName, + &disk->blkdeviotune, + true, true, true); + } + if (rc =3D=3D 0) rc =3D qemuMonitorBlockdevTrayClose(priv->mon, diskPriv->qomName); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e7421b415f..414e9327d2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6838,6 +6838,10 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver= Ptr driver, if (qemuDiskBusIsSD(disk->bus)) continue; + /* Setting throttling for empty drives fails */ + if (virStorageSourceIsEmpty(disk->src)) + continue; + if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; --=20 2.29.2