From patchwork Wed Jun 21 12:38:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejus GK X-Patchwork-Id: 13287237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE3A9EB64D8 for ; Wed, 21 Jun 2023 12:40:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBx7P-0005Kk-3X; Wed, 21 Jun 2023 08:39:27 -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 1qBx7M-0005KT-Ld for qemu-devel@nongnu.org; Wed, 21 Jun 2023 08:39:24 -0400 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBx7K-0002ZC-Nv for qemu-devel@nongnu.org; Wed, 21 Jun 2023 08:39:24 -0400 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35LBv888014880; Wed, 21 Jun 2023 05:39:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=NycAyCqw/JBaqV1yuSQvQn7KLKBLbYiKafE2Rt7ulPA=; b=QKalGs0G7+Hcl+U1LMVzQ4q6C3a/tK9ns3wDywSfLqLgXcVVfy94oTE9uo3G/mjtrIi2 2j1x4cGsGgRd0nGYfdASmVOuR1Ze493hjAji7sOpzCw86TO58MYjM4FTA2tn9RJcVwRI RN+/87RilBmX1iNGFevsRjJZWyq9RzKoiaBJ+OKWOu8M75Q1hCMF5LqLfZ99t11BaZO+ 7Z5GKXRW+bVRcAYz0oabH6BFwg2BZiGic1YMNEigRvlyywVhkOnwhFxLFb3xZ+oc6LWu QoGANoS02+7SDGuVG/gBzFSNnPAEs9vBYpHg3ph4JdPJCVMdqoYk1iYNCLbJHsTIq3wV sQ== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3r98r5y9rf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 05:39:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VW5rqrnFAeo8/o+OSdp4asP/0F/QSZQ2kylgWuXmxnMVKE0kLZ4TOX0IvnTKlZfzWyI79uh1S8i25ZJV/icKP9tBvPJD5clCejPE9JP4uCXZBJh3mlmCGk8pa77DVyn+jI3V9o87CIdAq0tRhjAZ6POhvjDIT8gkUh53UUKANdL/x8ftztkFRKIKCQ+C3UPpHumLpEr/cXsCKlBAdgujPmL+Yy/8mBokc6m6hwEoQvjqDdd1FNUDrW1H2AL68c0jdbNvHE4L8tAK5F7cSnsnFqaURVXT29xPRGOEkOip+SyRJtA7mpf1BsNAsXRNsWvGSFYmk1aNTKXOwaiNAuGF6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NycAyCqw/JBaqV1yuSQvQn7KLKBLbYiKafE2Rt7ulPA=; b=fXnUphAKhNzFrusUPfH8NTNrUh93ExjUga4gUlXgiAtYK1JD+Y8RUoiuvLRCXf+MAkqvwuFlB3L94E6KH5cO2XYM46QdsHHBx9bJKkXCOHCEsfaXKSLfOCaDSXcv5Wp+y6h7Nr8omeaUb8dtzoUEqpU8xuyJAJbXYKbqgqvobbzZhAgGHcAfqV13UlPaDqDd04PpRBFT30D5Iy8x61FRfjEVXdZDu9KHh/LZ79VCeFy7B+G73aXHeCncyJIym06o+7ov6SZPKBOPaZstgM5tmgdAoAYo12MjwktVUHc6xzjiKM4+MVxtR4n1z2o78+B1k8segEfjkH62OPkfng6BWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NycAyCqw/JBaqV1yuSQvQn7KLKBLbYiKafE2Rt7ulPA=; b=ubO4lfzGCr/WbFJGOEfB9HDkVrXNCIUHVoiLwGdhvLA/mTqEU+25no7lBPlWF/or88fO+53zL/hTpa780cBAVdoNkavSUy+iG/pUrj/Vzs00f0b/pChHHkxy6XIB6/6qMxfQSiqi5tPYpdz39sIgFVhrXptW5W1O3+d/nuXMoM2+jOLDgxblM1BlrHHfQUZS4IJGmn4whu9MnzdFY4fwYK12SN26EmafDZ5Kiq79NSMUTInpN68UPbPZhcexNb9QgJszL3+JHxz1GOPgRhgrJqAy/PEkw0p3g23sbH5Hx0PaGpNdJAD8A/n93J/vt7CsLkqTyFZcIhnwKKH9ueTHZA== Received: from BYAPR02MB4806.namprd02.prod.outlook.com (2603:10b6:a03:42::30) by SN4PR0201MB8725.namprd02.prod.outlook.com (2603:10b6:806:1e8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Wed, 21 Jun 2023 12:39:18 +0000 Received: from BYAPR02MB4806.namprd02.prod.outlook.com ([fe80::4f5f:3660:5304:57f7]) by BYAPR02MB4806.namprd02.prod.outlook.com ([fe80::4f5f:3660:5304:57f7%7]) with mapi id 15.20.6500.036; Wed, 21 Jun 2023 12:39:18 +0000 From: Tejus GK To: qemu-devel@nongnu.org Cc: quintela@redhat.com, peterx@redhat.com, leobras@redhat.com, berrange@redhat.com, aravind.retnakaran@nutanix.com, shivam.kumar1@nutanix.com, Tejus GK Subject: [PATCH v2 1/2] migration/vmstate: Introduce vmstate_save_state_with_err Date: Wed, 21 Jun 2023 12:38:43 +0000 Message-Id: <20230621123844.177739-2-tejus.gk@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230621123844.177739-1-tejus.gk@nutanix.com> References: <20230621123844.177739-1-tejus.gk@nutanix.com> X-ClientProxiedBy: SJ0PR13CA0072.namprd13.prod.outlook.com (2603:10b6:a03:2c4::17) To BYAPR02MB4806.namprd02.prod.outlook.com (2603:10b6:a03:42::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4806:EE_|SN4PR0201MB8725:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f9d6c09-7fab-48d1-34bf-08db725487e9 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8FYNQmLwsM5A2G1i33HuGqYcuSlITa/vRFl/voZMbIJLVym0uy2w+l7bN0pDsF3YZ7egbMsuR6b/Y+XUi5tTSV0Eet662Hshk41UH/FB0OKKeV+P/TtKuvSHt6G3dVZhwsDbAIzKgL/feEHvNv2P0qBWMEz10mJ96G6kuCkrlMlmroOVOU0wQQWFqmh3UsMMt7uToBkdy6yuyun2fST3aEE0mz0iDAfcc5DEN+PW+SJuQkt55+2SKzcC7yrCRAJPL8589ZKsMb4dPh204CIqgSDlB9YZ8Lai3QhbzK69FkeS84b4lJgf3yhvbDICiaT7fzNKNa1CWbS3XAH20NJzjgn5FcBj7vIWFZSzACINAMCuFPA/bYn7aXVfg99NalxcYcAnjzQt/f0NpJgIX9rqxOOEz+mQFGdbCY4LU9P/K+Pp+9qWVygkdkVD0kjj+p8UuZuWfuOz/oJ1Q/vthHGYJAVihlVF4EqgIc5VaPBws9k+h0ZcrJcmRt4sYFWztPNwtWIwmeRsrtFaJST9bJKKGAttaEWZN4m5yNbOZJJPHiU38Fi22LBpgyd+hwsjSPD6roloUGH6LLKuH2312oR/sU4mQ1YUnqEMwdIakScRLiOoJQhT0H6Cw2Wv/j33MXjj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4806.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(39860400002)(346002)(366004)(136003)(376002)(451199021)(6512007)(36756003)(5660300002)(66556008)(66476007)(8676002)(41300700001)(8936002)(6916009)(38350700002)(38100700002)(86362001)(4326008)(66946007)(316002)(107886003)(6506007)(6486002)(1076003)(26005)(2906002)(186003)(52116002)(2616005)(478600001)(6666004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oBwJ5hAX/5+t8UcUkLUxgmSZlQOeqLnwqk+MX0L8AxtpB51Mp0gFrH3BNw5VC9WFm24SSw84P8ryu1i9V/XnyfFTVg0ZXAvfabAnDhZwWm+UVxMxw3FCVE4iA4Cz4hdWLaWfQyhEPBGMTQCWy8IQzPez49F184AF3dR9QNLHarQ47MWR9LC+X4Bw0fSEumeMxApbQ0mlpAAjAW6/0kq/ju1erwY++4SNmP7i201oPVmm30PcnRHnqOoz6m+sPIo7509Z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1ifAVnv39xyjTynhnNBRUwGZmQMrh6bZp144jk94CwXB7OOzC3d5xe8OY3C5vO1Ez/9Dz8u9fkoHmOBWC5Kpe3B/ShALsnGJb8GX6olDsesc6WwSypd1jMJqbVGI2MVY/GJGQ6XjNQU0TxWRLsQehd3pPP/lPsnAiSP8xbLqQfJRALqQaCmcW/idDt4IU7aDytDu/w/Fw9bbtImKrPx1ydeuYhMqaLm/xXLnnayp1AJzNkFKystFIOUgQS X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f9d6c09-7fab-48d1-34bf-08db725487e9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4806.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2023 12:39:18.7533 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kHP9+mPqqJLQ1p0JoUbwm+vwPRLmQyonOkiluFwjtZ3QTLJRmGtUmckUoueCH8mJOqriwu+UrxtTmhBvNM0K2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB8725 X-Proofpoint-ORIG-GUID: 74LVcYIQ9S-hd2bhU7ulMqRy5EeY2kcw X-Proofpoint-GUID: 74LVcYIQ9S-hd2bhU7ulMqRy5EeY2kcw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_07,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=tejus.gk@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Currently, a few code paths exist in the function vmstate_save_state_v, which ultimately leads to a migration failure. However, an update in the current MigrationState for the error description is never done. vmstate.c somehow doesn't seem to allow the use of migrate_set_error due to some dependencies for unit tests. Hence, this patch introduces a new function vmstate_save_state_with_err, which will eventually propagate the error message to savevm.c where a migrate_set_error call can be eventually done. Acked-by: Peter Xu Signed-off-by: Tejus GK --- include/migration/vmstate.h | 4 +++- migration/savevm.c | 2 +- migration/vmstate.c | 12 +++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 084f5e784a..244d00ca74 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1194,9 +1194,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, int version_id); int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc); +int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription *vmsd, + void *opaque, JSONWriter *vmdesc, Error **errp); int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc, - int version_id); + int version_id, Error **errp); bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque); diff --git a/migration/savevm.c b/migration/savevm.c index bc284087f9..846aebd412 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1000,7 +1000,7 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) if (!se->vmsd) { vmstate_save_old_style(f, se, vmdesc); } else { - ret = vmstate_save_state(f, se->vmsd, se->opaque, vmdesc); + ret = vmstate_save_state_with_err(f, se->vmsd, se->opaque, vmdesc, &local_err); if (ret) { return ret; } diff --git a/migration/vmstate.c b/migration/vmstate.c index af01d54b6f..35a9b67afc 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -315,11 +315,17 @@ bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque) int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, JSONWriter *vmdesc_id) { - return vmstate_save_state_v(f, vmsd, opaque, vmdesc_id, vmsd->version_id); + return vmstate_save_state_v(f, vmsd, opaque, vmdesc_id, vmsd->version_id, NULL); +} + +int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription *vmsd, + void *opaque, JSONWriter *vmdesc_id, Error **errp) +{ + return vmstate_save_state_v(f, vmsd, opaque, vmdesc_id, vmsd->version_id, errp); } int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, - void *opaque, JSONWriter *vmdesc, int version_id) + void *opaque, JSONWriter *vmdesc, int version_id, Error **errp) { int ret = 0; const VMStateField *field = vmsd->fields; @@ -377,7 +383,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, } else if (field->flags & VMS_VSTRUCT) { ret = vmstate_save_state_v(f, field->vmsd, curr_elem, vmdesc_loop, - field->struct_version_id); + field->struct_version_id, errp); } else { ret = field->info->put(f, curr_elem, size, field, vmdesc_loop); From patchwork Wed Jun 21 12:38:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejus GK X-Patchwork-Id: 13287239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01E5AEB64D7 for ; Wed, 21 Jun 2023 12:40:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBx7P-0005LB-Mf; Wed, 21 Jun 2023 08:39:27 -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 1qBx7M-0005KR-IZ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 08:39:24 -0400 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBx7K-0002ZI-Nx for qemu-devel@nongnu.org; Wed, 21 Jun 2023 08:39:24 -0400 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35LBv889014880; Wed, 21 Jun 2023 05:39:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=kHk1kWFT1i669NA+60oVKMJacA/VAy7E9TMbeOWZI4o=; b=1EtxvphO3MfFCQu8NzxQ19fZIgknUF6cW31XZeA+rYPQXxfMODs2otvr8lHj6CJA6Hm9 y5+MmyOzskobNlvpMVz6X8kWd2wEt/Y31+ffSgMbTHpILByRXHS9yCQf4ZbRnOZcWWnC QOxYSh0YHPA0EDcR/axWtOo09I0aCKEe070pf5DTrb8TVlOrHxj6KEH0kokFGdB6iNND LIDEcu0ZE6ULSncX11YLsn+N3Ce6HS1OU/wJWFfHc8VfuJSlNzKMG/nCF7I4/esuY61g dsO4Z7Jq7Vam7FP+vnk5KV410+KtCj4dX+hHUvvoToBL/NG1TtckmozOr+llWKYiUCqs JA== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3r98r5y9rf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 05:39:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzxBKRdtEilZuAMOZWxz/E3fel8Mffgy24EzIHcr8Gxny2ebVy2UQ1jVWbugX0X+HOSTKMQeplcsLxzmQa7rg5np7AAOVPb9Sh/UrJkPegZf69KGX0vG78lDdF8hXEUfv+Fd44lkwX6HnlrMAUpRxFsqdXOoysH3TakeeEor0FYmCbpcl+IYpNMmtYAerXGOHNsSNI4ja1jCds2codoxx+NSrASSQQKLOvxUCKhXnBOAxlglGOAO/whPf2VMogm1/2xSHdj0gy8xYIPBcUb+XwKyU11A67fr93TJFtpZXxmL4n9ggEYvuxNyPYiqiAZT/KzPYnapDAK/3qG0aEjn5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kHk1kWFT1i669NA+60oVKMJacA/VAy7E9TMbeOWZI4o=; b=U3twOUs2CPvCG0jkLqawDqtim/kZw9+VX23u2A4Nh9XNe5u63sexbAQTr2UUVPCBIG0zpQo7raLCk7MqoPqXa13jTraC0ucDIro7C5eLIC8G1ekxfYxlWHPu2IFjhIBTWIGA2Yw2W/ewZ/ojLZuqNAURQV7fut54Z/HaeHSe+5c5xGwUgxX8tiDM/3XG4M84w4NzQkwjjrGhIQ3i+glgNiNQGd6OQ3NZnIwf5njxY6/KymF/0/VxqRormefYnvJ+IEV+s7s8jvCj+L6NW41WhO1v2wXxWV+7sCUe3We4uf+NmUNOPStdKxPCbAnFS/1+G7qvVHIYtEIq/Fxx7+3vqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kHk1kWFT1i669NA+60oVKMJacA/VAy7E9TMbeOWZI4o=; b=uy3QTKB3FamQSksl+LS7345z3G59avOTaA+ApcDgjELuoyiEfdevvZHJfdzCi3zgYPqy6diRQ3BbkHFTKPCM33rADMw9wKpQQXAvfGBrV9ehADvG9a8R1OAlYq7lYB/diuf9LHe0OJQa8wTQVWigmGZUkON5QSYm1MOz5K7yuxKq4iHGBeY+bHFPYE06xcDF23w++TzL+CZx+PzhoVAmM3JqFU7waGITlUv/aiQ/vhwQun5MViEJU9/seI4+4UsI4wabrJenD/+TyWeN/JylTUZDw0i2cjCEPPGSsP9IiAKcdIaTpIniXy98/EW7qLWUYuzL/pHo+Y/UIFMbpb9csw== Received: from BYAPR02MB4806.namprd02.prod.outlook.com (2603:10b6:a03:42::30) by SN4PR0201MB8725.namprd02.prod.outlook.com (2603:10b6:806:1e8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Wed, 21 Jun 2023 12:39:19 +0000 Received: from BYAPR02MB4806.namprd02.prod.outlook.com ([fe80::4f5f:3660:5304:57f7]) by BYAPR02MB4806.namprd02.prod.outlook.com ([fe80::4f5f:3660:5304:57f7%7]) with mapi id 15.20.6500.036; Wed, 21 Jun 2023 12:39:19 +0000 From: Tejus GK To: qemu-devel@nongnu.org Cc: quintela@redhat.com, peterx@redhat.com, leobras@redhat.com, berrange@redhat.com, aravind.retnakaran@nutanix.com, shivam.kumar1@nutanix.com, Tejus GK Subject: [PATCH v2 2/2] migration: Update error description outside migration.c Date: Wed, 21 Jun 2023 12:38:44 +0000 Message-Id: <20230621123844.177739-3-tejus.gk@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230621123844.177739-1-tejus.gk@nutanix.com> References: <20230621123844.177739-1-tejus.gk@nutanix.com> X-ClientProxiedBy: SJ0PR13CA0072.namprd13.prod.outlook.com (2603:10b6:a03:2c4::17) To BYAPR02MB4806.namprd02.prod.outlook.com (2603:10b6:a03:42::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4806:EE_|SN4PR0201MB8725:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e15753d-2562-4184-f570-08db7254882b x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PTKtLhdVeemkjG1zS5ReweBpovn4OHtZ4HE0aYjR1GqnA/Ho8phlaZ/WkK9Tvr4vSynjidFgBElipv5RdBKfiFSy5+GDJbNxWfhDB5A1Zc4zTyGw88gHeO0foJhp0sheIB7Dj7xJd18o6yI1QqSfvHaBS98L61Fi3U3W3kpzuY2h5ax81Sb58dRle5J9WNRtDrR15H6ZXHFhj7xlefRtk9qmAYo40ZvhNA4iVYR1dGCCqZXk7nosnBMAzWkMUDShlY+tDGfNkGzyaDhmoNINq85xQ8r7vXUF2LrmKD66bB4iZ3V7k+zkJkZq/uHdsMfAbjbjzXu6q1Oeto351oTx56kbOFRJUQ6ajPZOiG88XqS/nb4hT7FJ1HaGc6ER2LRvM9zPml+NuZvpupNVDwG1y2K8I7ev2+EDuROqnX7NcGOFakzevc7XMGNkv0JQDPRETWBlen8iqXeLd9/KIKXUYhJc8qcCSGzyQ48kyVY0OYWNsUf6Ap3QeO5oYs9zd3s2OPzCWhMMMXt3jHKJP1w4cvouYAZRXddO7ZJ3DTywgcAdGov9AZShmDP7cjv8PYYNgFUfbV2qYpD8R3n3LRgqpef51ZGDqDu0H6lMjQ7lJmeLUuqHnjqLUzXxvZyZvri8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4806.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(39860400002)(346002)(366004)(136003)(376002)(451199021)(6512007)(36756003)(5660300002)(66556008)(66476007)(8676002)(41300700001)(8936002)(6916009)(38350700002)(38100700002)(86362001)(4326008)(66946007)(316002)(107886003)(6506007)(6486002)(15650500001)(1076003)(26005)(2906002)(186003)(52116002)(2616005)(478600001)(6666004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SaRHNZRAgXyV3bqENNKPYt83PHO+i9EketepVgEYL62Rvrg2r4MFIoMwthlP9FKFHpnhML3GaaKtE9jlpokZVpm8Ytg1+1Ynhf7fYyUy1/ZAzDw7sxSXJLu+NvrhP5n1Wxz5YNmv3sbTrQIzMsPdy+EIUME/FzfoeP9qccpfulGIqOtXAe53e6xV26dXBrbqzUqodwMohZKjZ2p3KCRkGdQMF0U3LoG6D+P+kKny2cmssNi8Eo1w/i28rHxk5gzHQuO9NqZ4KX2oYbc4VCU12XJ60D9ma2kGtYZqaBJH3S261uhdy9TyddlHyto1FX2Qwhy2CKhVHQXVwYshKrlvINygTQ0GRb3U4OBAdNxOzmSOnjQX/E3ojcuZQaVX5UWKHT5FK2j8D1vhPdnnBtn9rNEoSgy/jeNnVQTBZcR10g5tcT5KHK1su4KuDIKQ6c0mEqVDpiE0jmXrMsr3e9pd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CByVpW9AdX2olIBxkljNs/EYvHgX8qZ+p8ahX/oWAdslVc2eEUha77CXXn X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e15753d-2562-4184-f570-08db7254882b X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4806.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2023 12:39:19.1688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZyDVjopjapoFHzPEbG/lwqrg6OAOXuvUKhjYt/N368nAa4ATTj6Ke+v717JSZdzmIBQB5Mkt8fJgCIEOs7p2vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB8725 X-Proofpoint-ORIG-GUID: lleDKoaDZ5Qm7RybfFVoGIsghGoCsX9w X-Proofpoint-GUID: lleDKoaDZ5Qm7RybfFVoGIsghGoCsX9w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_07,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=tejus.gk@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A few code paths exist in the source code,where a migration is marked as failed via MIGRATION_STATUS_FAILED, but the failure happens outside of migration.c In such cases, an error_report() call is made, however the current MigrationState is never updated with the error description, and hence clients like libvirt never know the actual reason for the failure. This patch covers such cases outside of migration.c and updates the error description at the appropriate places. Acked-by: Peter Xu Signed-off-by: Tejus GK --- migration/savevm.c | 17 ++++++++++++++--- migration/vmstate.c | 7 ++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 846aebd412..b8f564cb86 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -979,6 +979,8 @@ static void save_section_footer(QEMUFile *f, SaveStateEntry *se) static int vmstate_save(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { int ret; + Error *local_err = NULL; + MigrationState *s = migrate_get_current(); if ((!se->ops || !se->ops->save_state) && !se->vmsd) { return 0; @@ -1002,6 +1004,8 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) } else { ret = vmstate_save_state_with_err(f, se->vmsd, se->opaque, vmdesc, &local_err); if (ret) { + migrate_set_error(s, local_err); + error_report_err(local_err); return ret; } } @@ -1068,10 +1072,14 @@ void qemu_savevm_send_open_return_path(QEMUFile *f) int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len) { uint32_t tmp; + MigrationState *ms = migrate_get_current(); + Error *local_err = NULL; if (len > MAX_VM_CMD_PACKAGED_SIZE) { - error_report("%s: Unreasonably large packaged state: %zu", + error_setg(&local_err, "%s: Unreasonably large packaged state: %zu", __func__, len); + migrate_set_error(ms, local_err); + error_report_err(local_err); return -1; } @@ -1475,8 +1483,11 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, * bdrv_activate_all() on the other end won't fail. */ ret = bdrv_inactivate_all(); if (ret) { - error_report("%s: bdrv_inactivate_all() failed (%d)", - __func__, ret); + Error *local_err = NULL; + error_setg(&local_err, "%s: bdrv_inactivate_all() failed (%d)", + __func__, ret); + migrate_set_error(ms, local_err); + error_report_err(local_err); qemu_file_set_error(f, ret); return ret; } diff --git a/migration/vmstate.c b/migration/vmstate.c index 35a9b67afc..71dc21c273 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -14,6 +14,7 @@ #include "migration.h" #include "migration/vmstate.h" #include "savevm.h" +#include "qapi/error.h" #include "qapi/qmp/json-writer.h" #include "qemu-file.h" #include "qemu/bitops.h" @@ -336,7 +337,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, ret = vmsd->pre_save(opaque); trace_vmstate_save_state_pre_save_res(vmsd->name, ret); if (ret) { - error_report("pre-save failed: %s", vmsd->name); + error_setg(errp, "pre-save failed: %s", vmsd->name); return ret; } } @@ -389,8 +390,8 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd, vmdesc_loop); } if (ret) { - error_report("Save of field %s/%s failed", - vmsd->name, field->name); + error_setg(errp, "Save of field %s/%s failed", + vmsd->name, field->name); if (vmsd->post_save) { vmsd->post_save(opaque); }