From nobody Sun Apr 28 20:00:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515665950628835.526003814755; Thu, 11 Jan 2018 02:19:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA7AA7C83C; Thu, 11 Jan 2018 10:19:08 +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 D453160BE9; Thu, 11 Jan 2018 10:19:04 +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 316C83FB18; Thu, 11 Jan 2018 10:19:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0BAJ2J4022246 for ; Thu, 11 Jan 2018 05:19:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id D7DF89075; Thu, 11 Jan 2018 10:19:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D037B906A for ; Thu, 11 Jan 2018 10:18:59 +0000 (UTC) Received: from m15-112.126.com (m15-112.126.com [220.181.15.112]) by mx1.redhat.com (Postfix) with ESMTP id E6BFB780E0 for ; Thu, 11 Jan 2018 10:18:55 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp2 (Coremail) with SMTP id DMmowADXNW4AOldakSluAg--.24409S2; Thu, 11 Jan 2018 18:18:45 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=cl29w0+tjZsUksN6GI 1bRmfQdqbH5aIUfU/FPfN5H7Q=; b=OpsYNv3HjI5BwB9fTpjCpFe/qRQyZVaP3n HgRGtcfxMSyM+di8IVvP6ts04xcl+KmU08JlAY64BcGY9JkFX/Q5tv4A6vxj+SXW K8HysvXIwkAN3CJSZl5tt3vYr2qB0X3kZ4pO6K1qnCDvRApnmO+rhONwpKZeokyQ w8jyP7oSU= From: Chen Hanxiao To: libvir-list@redhat.com Date: Thu, 11 Jan 2018 18:16:37 +0800 Message-Id: <20180111101637.19473-1-chen_han_xiao@126.com> X-CM-TRANSID: DMmowADXNW4AOldakSluAg--.24409S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uF13Cr4fZry3KFW7ZFWkJFb_yoW8CF4rpF 48KFyIvrZ5Kr15G3ZaqFy8ZF90kF4vka1fJr1Sg3y2gr1rGrZYk3yfXr1Fqw15trW8CF13 Ary5XFZ7W3Wqy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jUZ2-UUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaQfKrlpD38h-eAAAsD X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Jan 2018 10:18:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Jan 2018 10:18:57 +0000 (UTC) for IP:'220.181.15.112' DOMAIN:'m15-112.126.com' HELO:'m15-112.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 1.99 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.112 m15-112.126.com 220.181.15.112 m15-112.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH v2] domain_conf: skip boot order check of CD-ROM or floppy device when change-media X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Jan 2018 10:19:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao If we insert or eject a CD-ROM/floppy device by: 'virsh change-media VM --eject/--insert some.iso --live', and the original CD-ROM device was configed with a boot order, we may get: unsupported configuration: boot order 2 is already used by another device We just updated 'source file' section rather than hotplug a new device. This check should be skipped in this case. Signed-off-by: Chen Hanxiao --- v2: commit message updated remove ATTRIBUTE_UNUSED from @device src/conf/domain_conf.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a1c25060f..e006cea0a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26881,17 +26881,26 @@ virDomainDeviceIsUSB(virDomainDeviceDefPtr dev) =20 static int virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED, - virDomainDeviceDefPtr device ATTRIBUTE_U= NUSED, + virDomainDeviceDefPtr device, virDomainDeviceInfoPtr info, void *opaque) { virDomainDeviceInfoPtr newinfo =3D opaque; + virDomainDiskDefPtr disk =3D device->data.disk; + int disk_device =3D disk->device; =20 if (info->bootIndex =3D=3D newinfo->bootIndex) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("boot order %u is already used by another device"= ), - newinfo->bootIndex); - return -1; + /* Skip check for insert or eject CD-ROM device */ + if (disk_device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY || + disk_device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) { + VIR_DEBUG("Skip boot index check for floppy or CDROM"); + return 0; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("boot order %u is already used by another dev= ice"), + newinfo->bootIndex); + return -1; + } } return 0; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list