From nobody Mon Feb 9 09:32:32 2026 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 1516682112780417.39989819785626; Mon, 22 Jan 2018 20:35:12 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 2193E1A4081; Tue, 23 Jan 2018 04:35:10 +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 41FA95C258; Tue, 23 Jan 2018 04:35: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 63E6F410B3; Tue, 23 Jan 2018 04:35:08 +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 w0N4RP19019169 for ; Mon, 22 Jan 2018 23:27:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD2039CDD; Tue, 23 Jan 2018 04:27:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C78386444E for ; Tue, 23 Jan 2018 04:27:23 +0000 (UTC) Received: from m15-111.126.com (m15-111.126.com [220.181.15.111]) by mx1.redhat.com (Postfix) with ESMTP id 8D6841112 for ; Tue, 23 Jan 2018 04:27:20 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp1 (Coremail) with SMTP id C8mowADndq+euWZaa360BA--.31488S6; Tue, 23 Jan 2018 12:27:17 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=dXegU2kyy4SXRoVdeL KumpzcA1olHDAdUCh4FeAHP48=; b=DtPBx7GgJK5J5fonef2fgi5Qnxe63G8mKa tlN1JVADOOttQsOLD34ngscZXbneQCbTVLll4TJTgOJJPGU8J6pAUV11/9Fnb90P YjTYpjN24plWS6qfyK7NbPMc76Rosn4LPdiDTicPLoIvSUdFk3lUu+rI63jam61R wuc6vmKyo= From: Chen Hanxiao To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 12:24:45 +0800 Message-Id: <20180123042446.7931-5-chen_han_xiao@126.com> In-Reply-To: <20180123042446.7931-1-chen_han_xiao@126.com> References: <20180123042446.7931-1-chen_han_xiao@126.com> X-CM-TRANSID: C8mowADndq+euWZaa360BA--.31488S6 X-Coremail-Antispam: 1Uf129KBjvJXoWxXr4rXFWxJr4DZrW3CFyfJFb_yoWrWr4DpF yrCanayr4jqr4DA393Ka4DW34UZa4kXr1UKr95WFnFgF1fW3y8Jrn3Zr4S9ry5tryDAayr uryxXFW7u3Z5taDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j1FAJUUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbikgXWrlpD4CjVUAAAs7 X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 23 Jan 2018 04:27:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 23 Jan 2018 04:27:22 +0000 (UTC) for IP:'220.181.15.111' DOMAIN:'m15-111.126.com' HELO:'m15-111.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.111 m15-111.126.com 220.181.15.111 m15-111.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH v3 4/5] qemu: Use VIR_ERR_DEVICE_MISSING for various DetachDeviceConfig messages 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 23 Jan 2018 04:35:10 +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 Modify OPERATION_FAILED error codes to use DEVICE_MISSING instead. Signed-off-by: Chen Hanxiao Reviewed-by: John Ferlan --- src/qemu/qemu_driver.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a203c9297..10eebd61c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8172,7 +8172,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_HOSTDEV: { hostdev =3D dev->data.hostdev; if ((idx =3D virDomainHostdevFind(vmdef, hostdev, &det_hostdev)) <= 0) { - virReportError(VIR_ERR_INVALID_ARG, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("device not present in domain configuration")= ); return -1; } @@ -8184,7 +8184,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_LEASE: lease =3D dev->data.lease; if (!(det_lease =3D virDomainLeaseRemove(vmdef, lease))) { - virReportError(VIR_ERR_INVALID_ARG, + virReportError(VIR_ERR_DEVICE_MISSING, _("Lease %s in lockspace %s does not exist"), lease->key, NULLSTR(lease->lockspace)); return -1; @@ -8196,7 +8196,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, cont =3D dev->data.controller; if ((idx =3D virDomainControllerFind(vmdef, cont->type, cont->idx)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("device not present in domain configuration")= ); return -1; } @@ -8218,7 +8218,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, fs =3D dev->data.fs; idx =3D virDomainFSIndexByName(vmdef, fs->dst); if (idx < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("no matching filesystem device was found")); return -1; } @@ -8229,7 +8229,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, =20 case VIR_DOMAIN_DEVICE_RNG: if ((idx =3D virDomainRNGFind(vmdef, dev->data.rng)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("no matching RNG device was found")); return -1; } @@ -8240,7 +8240,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_MEMORY: if ((idx =3D virDomainMemoryFindInactiveByDef(vmdef, dev->data.memory)) < 0= ) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("matching memory device was not found")); return -1; } @@ -8252,7 +8252,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_REDIRDEV: if ((idx =3D virDomainRedirdevDefFind(vmdef, dev->data.redirdev)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("no matching redirdev was not found")); return -1; } @@ -8262,7 +8262,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, =20 case VIR_DOMAIN_DEVICE_SHMEM: if ((idx =3D virDomainShmemDefFind(vmdef, dev->data.shmem)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("matching shmem device was not found")); return -1; } @@ -8273,7 +8273,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, =20 case VIR_DOMAIN_DEVICE_WATCHDOG: if (!vmdef->watchdog) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("domain has no watchdog")); return -1; } @@ -8283,7 +8283,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, =20 case VIR_DOMAIN_DEVICE_INPUT: if ((idx =3D virDomainInputDefFind(vmdef, dev->data.input)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("matching input device not found")); return -1; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list