From nobody Mon Apr 29 20:13:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1623665936; cv=none; d=zohomail.com; s=zohoarc; b=BkZ5zCikvWWoJNsAELv+g1TJA56ueZpf4HcTir33YbUtQKVB2szc76yliHHBKU3zcyEFAOwJ0pNnsyUMHQSPqM8KpyZGt5AtjPDPcJdZz+4qBAz4zc1c5SEOEwRs58KQYsNKCd+BLnUBhlfvtK+npNU1L26ihI3hKkApdbUcLAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623665936; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=1sKwk7pAvbH0QW/+3ToDueMz0rF2B9GddHW80A7iQg4=; b=e5ADqv84bTjPmEzWIoTopk9CI4aslpdrcaxIB3+RUCjswa1K/oKyALR2Yt3S7thXHDihM9aWcIcJKuNpjk8+aMR2PFoeaB21sEKzVdu9vOB8lZLxwifeZ4SSnYIMu7GcX3EzRmPYNZcpfwt7mzoeM5xzktE8aU7nurkIrioOuYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623665936736756.526189416814; Mon, 14 Jun 2021 03:18:56 -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-506-bnmZTdnpO2iI8UvIVoFpvA-1; Mon, 14 Jun 2021 06:18:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4066E8005A2; Mon, 14 Jun 2021 10:18:49 +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 E31655D6D3; Mon, 14 Jun 2021 10:18:47 +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 4114646F59; Mon, 14 Jun 2021 10:18:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15EAIitS014237 for ; Mon, 14 Jun 2021 06:18:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1B8DA5D9E2; Mon, 14 Jun 2021 10:18:44 +0000 (UTC) Received: from lyarwood-laptop.home (unknown [10.33.36.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82F8E5D9DD; Mon, 14 Jun 2021 10:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623665935; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=1sKwk7pAvbH0QW/+3ToDueMz0rF2B9GddHW80A7iQg4=; b=hhS9c3XON0H/Z5QHIBwVYja9rCdkKxnOGRk2tIxdVnjoEGAfCuVEYBY6zfjbqtMieRxAst Xo+m6tNW+jk/SomJE+xxsR/gPAg1sNxKMqMLp+o8d/m+8eRyYVCrOJmQ6Yq5fpNUlTXOjD EL7VMfyiSXjhmQT8Fu96MCJy83ZrsVE= X-MC-Unique: bnmZTdnpO2iI8UvIVoFpvA-1 From: Lee Yarwood To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu_hotplug: Report VIR_ERR_DEVICE_MISSING when device is not found Date: Mon, 14 Jun 2021 11:18:37 +0100 Message-Id: <20210614101837.459979-1-lyarwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Lee Yarwood 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.79 on 10.5.11.15 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" 126db34a81bc9f9f9710408f88cceaa1e34bbbd7 had previously switched various flows over to this from VIR_ERR_OPERATION_FAILED. This change simply does the same for qemuDomainDetachPrepDisk, qemuDomainDetachPrepInput and qemuDomainDetachPrepVsock to allow management apps to centralise their error handling on just VIR_ERR_DEVICE_MISSING for missing devices during a detach. --- src/qemu/qemu_hotplug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 0640cdd9f7..68bd92cf13 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5322,7 +5322,7 @@ qemuDomainDetachPrepDisk(virDomainObj *vm, int idx; =20 if ((idx =3D qemuFindDisk(vm->def, match->dst)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, + virReportError(VIR_ERR_DEVICE_MISSING, _("disk %s not found"), match->dst); return -1; } @@ -5819,7 +5819,7 @@ qemuDomainDetachPrepInput(virDomainObj *vm, int idx; =20 if ((idx =3D virDomainInputDefFind(vm->def, match)) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("matching input device not found")); return -1; } @@ -5855,7 +5855,7 @@ qemuDomainDetachPrepVsock(virDomainObj *vm, *detach =3D vsock =3D vm->def->vsock; if (!vsock || !virDomainVsockDefEquals(match, vsock)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_DEVICE_MISSING, "%s", _("matching vsock device not found")); return -1; } --=20 2.31.1