From nobody Fri May 3 08:02:59 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 151325030735653.91740482282387; Thu, 14 Dec 2017 03:18:27 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 9DF3D356E2; Thu, 14 Dec 2017 11:18:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 541965D72E; Thu, 14 Dec 2017 11:18:24 +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 282AB1800BDF; Thu, 14 Dec 2017 11:18:22 +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 vBEBIJZw032344 for ; Thu, 14 Dec 2017 06:18:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id E3CCA18B56; Thu, 14 Dec 2017 11:18:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF4E417B3E for ; Thu, 14 Dec 2017 11:18:18 +0000 (UTC) Received: from m15-113.126.com (m15-113.126.com [220.181.15.113]) by mx1.redhat.com (Postfix) with ESMTP id ECFD2883C5 for ; Thu, 14 Dec 2017 11:18:15 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp3 (Coremail) with SMTP id DcmowAB3ZNHnXTJamsM_DQ--.37817S2; Thu, 14 Dec 2017 19:18:13 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=1gxfdV9ztgwBc0r9NH XJiQ1W4tY8CP6yIhMre+fNCFk=; b=IzBeSPRaoo7NzuDDmFIrr0NRp0TRUvfBBI J/Rz1QPmRJPyra6CMQ6MJUT3AmkZjIuVDD9EshHv9cj7klSzzf5+l9bh4ZR2/nPV 8PsRfZ//vdAwLy/eQJzBmqI/D2WqmtxkrobgI2k7m7FEVRrAxacXE7w9sQJs7YzX 7MTnaNW7Y= From: Chen Hanxiao To: libvir-list@redhat.com Date: Thu, 14 Dec 2017 19:16:23 +0800 Message-Id: <20171214111623.16925-1-chen_han_xiao@126.com> X-CM-TRANSID: DcmowAB3ZNHnXTJamsM_DQ--.37817S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxCw1kWrykGFyxKr4DAr4fKrg_yoW5Ww4kpF 48WaykAr4aqr4xX39rWay8Za4j9r97Wry5Kw4rWr12gF1rGryDCrna9rnruay5tr98Aa1a 9Fy3WF4jgr4vkFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jpdgAUUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaBCurlQ9EJymeQAAsC X-Greylist: Delayed for 36:08:15 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 14 Dec 2017 11:18:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 14 Dec 2017 11:18:17 +0000 (UTC) for IP:'220.181.15.113' DOMAIN:'m15-113.126.com' HELO:'m15-113.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Blacklist-Warning: Relay 220.181.15.113 is blacklisted by a RBL system X-RedHat-Spam-Score: -0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_SBL_CSS, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.113 m15-113.126.com 220.181.15.113 m15-113.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH] qemu: hotplug: unify "not found" logs when detaching device 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 14 Dec 2017 11:18:26 +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 Some services, such as Nova, check whether device was not found by errror messages "not found". [1] This patch unify logs of qemuDomainDetachDeviceLive, which will be helpful. [1] https://github.com/openstack/nova/blob/master/nova/virt/libvirt/guest.p= y#L406 Signed-off-by: Chen Hanxiao --- src/qemu/qemu_hotplug.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d97aa6051..925574b92 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5093,7 +5093,7 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver, =20 if ((idx =3D virDomainShmemDefFind(vm->def, dev)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } =20 @@ -5150,7 +5150,7 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver, watchdog->action =3D=3D dev->action && virDomainDeviceInfoAddressIsEqual(&dev->info, &watchdog->info)))= { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("watchdog device not present in domain configurat= ion")); + _("watchdog device not found in domain configuratio= n")); return -1; } =20 @@ -5233,8 +5233,11 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, virDomainNetDefPtr detach =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; =20 - if ((detachidx =3D virDomainNetFindIdx(vm->def, dev->data.net)) < 0) + if ((detachidx =3D virDomainNetFindIdx(vm->def, dev->data.net)) < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("netdev %s not found"), dev->data.net->mac.addr); goto cleanup; + } =20 detach =3D vm->def->nets[detachidx]; =20 @@ -5420,8 +5423,9 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, char *devstr =3D NULL; =20 if (!(tmpChr =3D virDomainChrFind(vmdef, chr))) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("device %s not found in domain configuration"), + chr->target.name); goto cleanup; } =20 @@ -5468,7 +5472,7 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver, =20 if ((idx =3D virDomainRNGFind(vm->def, rng)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } =20 @@ -5511,7 +5515,7 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver, =20 if ((idx =3D virDomainMemoryFindByDef(vm->def, memdef)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list