From nobody Mon Nov 25 13:17:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1715609941; cv=none; d=zohomail.com; s=zohoarc; b=MNOzKrUVRHrGbWD+ajTJUJ2UncnihmqVjPbtoCeDZBQ7YdYoe1bjmHY8yXZVbCT4PyE70Ll7w7lE+sqhECUwnBJaGffv6NXTOPiyNzEYGidVwho/EsqW4+/Fp7SvMAGd7k6z3P4GPOa/snW7tSNlNYP0lksXGWCyoBwk8B83uxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715609941; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xChexl3zJ10AbGiFeV9mOFqYiLCnCKatJG/DJOGNNH4=; b=MLiyGY702Xvt3Fav2ITWD4kFaiuHppO9gX925279y1GVgVIRj8sAZep36q69LM95RW7AXHuUqywAA9tuYEYoJLQGykoUF+P/3Mbq0xyXqm/jax66w+HncFLumZCuYHY6K0f++O2Nl2Nl8Gg7VFr6KQ6fG+hVX9tRrchJQbx3f2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715609941640326.21039708988746; Mon, 13 May 2024 07:19:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6WVo-0001Ng-Op; Mon, 13 May 2024 10:18:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6WV3-0000y5-Ro for qemu-devel@nongnu.org; Mon, 13 May 2024 10:18:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6WV2-0000AZ-9I for qemu-devel@nongnu.org; Mon, 13 May 2024 10:17:57 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-nzLoEgUGNQKFy3h3eVB23g-1; Mon, 13 May 2024 10:17:08 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBB201C0007D; Mon, 13 May 2024 14:17:05 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.193.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A15B491035; Mon, 13 May 2024 14:17:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6A48821E5E77; Mon, 13 May 2024 16:17:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715609873; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=xChexl3zJ10AbGiFeV9mOFqYiLCnCKatJG/DJOGNNH4=; b=bNulMf5v2ael3ZIJQ2GTEEemBNXq8cTWRZOphS1KsUv5EcuBCnFX3GBoEh2s9Cu1xSn+MD KuTSIzYpACd/62JEEUoWIBoMia0omtR1NEC1rZ4poHZfeaHcAjWv0VscmB54xJjYD9Kdr/ 7gkgjGjUv+Lf4yf8N02fTF7/PoniYlE= X-MC-Unique: nzLoEgUGNQKFy3h3eVB23g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: philmd@linaro.org, fam@euphon.net, kwolf@redhat.com, hreitz@redhat.com, marcandre.lureau@redhat.com, peterx@redhat.com, farosas@suse.de, pbonzini@redhat.com, richard.henderson@linaro.org, qemu-block@nongnu.org Subject: [PATCH 5/6] migration: Rephrase message on failure to save / load Xen device state Date: Mon, 13 May 2024 16:17:02 +0200 Message-ID: <20240513141703.549874-6-armbru@redhat.com> In-Reply-To: <20240513141703.549874-1-armbru@redhat.com> References: <20240513141703.549874-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.974, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1715609942896100003 Content-Type: text/plain; charset="utf-8" Functions that use an Error **errp parameter to return errors should not also report them to the user, because reporting is the caller's job. When the caller does, the error is reported twice. When it doesn't (because it recovered from the error), there is no error to report, i.e. the report is bogus. qmp_xen_save_devices_state() and qmp_xen_load_devices_state() violate this principle: they call qemu_save_device_state() and qemu_loadvm_state(), which call error_report_err(). I wish I could clean this up now, but migration's error reporting is too complicated (confused?) for me to mess with it. Instead, I'm merely improving the error reported by qmp_xen_load_devices_state() and qmp_xen_load_devices_state() to the QMP core from An IO error has occurred to saving Xen device state failed and loading Xen device state failed respectively. Signed-off-by: Markus Armbruster Acked-by: Fabiano Rosas Acked-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- migration/savevm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 4509482ec4..a4a856982a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -45,7 +45,6 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/clone-visitor.h" #include "qapi/qapi-builtin-visit.h" -#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "sysemu/cpus.h" #include "exec/memory.h" @@ -3208,7 +3207,7 @@ void qmp_xen_save_devices_state(const char *filename,= bool has_live, bool live, object_unref(OBJECT(ioc)); ret =3D qemu_save_device_state(f); if (ret < 0 || qemu_fclose(f) < 0) { - error_setg(errp, QERR_IO_ERROR); + error_setg(errp, "saving Xen device state failed"); } else { /* libxl calls the QMP command "stop" before calling * "xen-save-devices-state" and in case of migration failure, libxl @@ -3257,7 +3256,7 @@ void qmp_xen_load_devices_state(const char *filename,= Error **errp) ret =3D qemu_loadvm_state(f); qemu_fclose(f); if (ret < 0) { - error_setg(errp, QERR_IO_ERROR); + error_setg(errp, "loading Xen device state failed"); } migration_incoming_state_destroy(); } --=20 2.45.0