From patchwork Thu Feb 9 10:27:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134299 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 9D1B8C05027 for ; Thu, 9 Feb 2023 10:28:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4A0-0001AJ-TA; Thu, 09 Feb 2023 05:28:13 -0500 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 1pQ49y-00019p-1g for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:10 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQ49u-0007zt-SU for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:09 -0500 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3198BkWL002442; Thu, 9 Feb 2023 02:28:03 -0800 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=fCEGGXwlIQHmiilvUneTH/8MMuIQUtrcL/2BVsc5n8k=; b=A5GB4gU0ScvKTWEj8iRAwwbKEAEluZV5dSz00zxqT3qYyH5y5+EoVoPHcnIy2QFr/B0n R1oZ+YWwgw2fNj/PnDFXX8SY7RGe/goYVno04A7nMZr2ckMy57PY0z2PY7j5OxNPVVFs 88ZhOWJ8QrrKKNJ5JolmpFC6gascAllgyzGUMGfQSovIanMbnyaqv+bupCy59cFws18z UXm16NnPa+PEYI80L4DVh8GSIKZu6il7QO30zPt+NxqMm7NVREy+DYJ6DRUQlHgvkXCG YxAeLuVcfRD505xEKhVlWlxakfIMnXxJUbVIt+XLFhG6a2dtWutvBo+IEuuAZwxfRvMB fw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqjp1bye-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nkb9uCnHGLSPMWoMHTeU32vXSd+pA3NSpdRBrkk/jF2op9w4yjqgV8WpstpfwaOCVXPuMQJWMY0qUe0araC2pXPKr/NGCxhiCjNu6ig7uX1N6XpjLaOCyrrc0DPH4SInwlxrgsQ4XVRfiYKGzOBkBpe4kZypzc/Znnw0tRTbOIMHJ/IpILE9cmjlovXkhg0fYoErhNVkrdEfAA4/h3yg+aIhGV5R+126wcICO1Qrk9sOL0tOqhCKnZZcpyRNpzbmkgbzfa1ZVGXBQCFztZX/9SHsmj3PpfHwOrU2vMINdWpzH+9yWzg8dyNxY/cyL/jh2wJDdq4bg6jF17+J6y90ew== 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=fCEGGXwlIQHmiilvUneTH/8MMuIQUtrcL/2BVsc5n8k=; b=gCCN8uZGkjNrhlDq+blodsskkdG53cMBY9uuk1BFXf5o11AycV/VzTzO2LGi1UOhRKODoe20n2cT77+EiODMw2ue0YaoYLh3C5LpVJLypBnBBZ/uh2+mIW3ZU/6ltpKQn5mnsSVmfb2vB1yDfowGNwwHNiHKsWEIIjVGI8r9XPjdx70au4Be7B9lbss/I9K+AlgleYSHad4u3HgNlAApt1qh/pTtHNmZVoPUvq9ISxaU5SxlFLFhhNanfJ482UIaYGyM/clGBnhp1seZIiGk3ctlB0XHcMDO55NK6/peoXMyUPzuRwgiwpXYNyw1daeVd4HdH6aulZKr8fgN2bbp+A== 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=fCEGGXwlIQHmiilvUneTH/8MMuIQUtrcL/2BVsc5n8k=; b=WHGkYciJWv2XL16hM9e8edfVRWA3990drrJr0hWdj0VF5iapO0iFZTNmHcTtIKglLUuVnEe5Brq+dl0HW/JHeqSin7vvM2ZdinJQBXRQVqvjQk6mSyewBCduWVrsqUT5+AOVFqvN6TgOWWOMgXJedJR98ZP9xb+M6O+QFTFCckgu24nEauSd2QsCSFLnueJ4tmdBWi1J2CqDroLiwu6+ctSV9twsptZJ/iNkT71UxwVbMN4y/Iy+YlQUfoib4rc8rIVZyY9YAj/nSi3yxu4qu8E3R+HisMrtbklADgAlLJdG0fcZ+S20YumPTdHfJeEFjYX6qyiTQPaTX7o97xRfog== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by BN0PR02MB8240.namprd02.prod.outlook.com (2603:10b6:408:157::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 10:28:01 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:00 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 1/6] migration: moved hmp_split_at_commma() helper func to qapi-util.c file Date: Thu, 9 Feb 2023 10:27:49 +0000 Message-Id: <20230209102754.81578-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|BN0PR02MB8240:EE_ X-MS-Office365-Filtering-Correlation-Id: 81b24e3e-6ab5-43d4-a2ef-08db0a8851b1 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: 9tGwaXdJcnmbMQy+yXSN+aO7tYYj08gaeAcoehAmBHyRIRTW9twPs0SW1JNo8PQsWRuPJWpMAWB1AWyq2O8U/oCpVYe2ysNsruKwuZGytp4mhsGHdW9FxNBpp3cm5R82xRO7iMWIYKthyLGxHw1oeb+gYtO+7sH/fvrggkOVlL6VCtiLV/NSv6qEhNJ1Q6xErL5e/LaG+l6aW6e8bv2Qj3thCnqpcc0zSdgtRA6k8jbtkki0IZm4a4PBV4sgI/EvCj6FQG4vetIIQ/TqiNFPAu4VsF9Lc/ph0tpvpjvid6Mku6uLstKp0FF5t4xLP0f9JcBczN7lGECxt29fo13wSVtCwS3RF6JtL8/OvsRi0UFYzG2d3FoLYX/rcXBcbuFjbaGy/P1ulfYU5gj21x+H4ZQ5VsMXZFfTUDyIbBRwsws/ql607wNwG60X3gM7C5gFyzQLPB4xGgMPzQU5+Gkfplx3ukQFpb9IDE8XCDAmv3xNcQRh+20DMWuLGnGF2s5z/qIK+qpqgbT9rmX/mFcAvi+RPvUbApgc9PWmjXgpr7hDP7/JLitD05ok5hCRj3/wpzn+y3FANTtihC6KolJcYoZPCztV3bRT1Sj4qGQ2F9bj0GrLJdRQlq36CXojiKRawEHMnecf/6MwqCx5wpEOCFndwCyUWTvDibCkASJNs3EpISI3tZ422M0NnaUUTALPSqr/gd6nsaaIh7sfWeAHww== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(39860400002)(376002)(366004)(136003)(346002)(451199018)(5660300002)(36756003)(2906002)(44832011)(83380400001)(66476007)(1076003)(38100700002)(38350700002)(2616005)(8676002)(4326008)(6916009)(66946007)(41300700001)(26005)(8936002)(6666004)(66556008)(107886003)(186003)(6512007)(6506007)(316002)(478600001)(86362001)(6486002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1cQ0unnmYTEV/K8EaCSe2Aay0XCO1H2EoAv3PcTMYCWQT9ytETMa2Amve7ol4rwtcxKAgvypQlxdd6+6FT34eni4WFKwwi5lijBkGXjcyyDrt1PSHbQdL54yMzJnlZeKz85/Yjl0lG7ZdCuajZdUcPfWttnj3R+X340wWXc+iAkBGnKdGWMJgoe7AjjmD1decF69WqA+mG4YVoI0clVTrBPje2UCo6sgxplo0EWDlr4fYFq8HigsbACRKvFrFwFdeDjbjlQ3MCZvARQ9J9gHkbwZhtt2J3Ay8EmwuwFheB1qTSqCV4lvaGAqzZO56uaw1pFHXqomh3ChURsyx7QBCjDoHtUfx4yZiO8wvrScojDrPgKGDEyVK8jYpdG+/iIbSUb2F2WURTiOLEeONfIUGFJONUlkM9QhMgx0U16nU5ovxfPZxBh7Brxp73ca32sqUIAJ8okYaLHppb0c9b/9CUqPNcW1PIAbaougKWRVO5sQLEYT9psZohS09lOSR/y9dL/w4DnjWhW/WaqiQEpEsQgHbMX3e1v3sPegLWlb8kQZVPZgusZ2dlnhb4ZAl49hX8xE3/vdTz6yZTLhnhuU5bTuMHNN1LZUH64Uv49n65ICGFzyBw7UlooVgwoLOJfmqYkl6MjVZnsVUgy0mvs5ZBDvTfoBvoLgI/wFZD1Oyinph/TbO7QVTWOZ4xraWUzKeufPplfmxatGtYPlF6gFk+bZHzy0gTrYVAJSmVhMVDSLED8UeEVp9XagCi+nCP1YP2lhcNUFdBara3DNStp2ZFq11XT6wLSn3R06h5mnpmLFVH3hU08bw9/j4jpb68l57qVeTGf6EkGEgUNrSjVrX1oJ9eNUDNL8CsdaGtQWh2qTwEd3LRq5dSr8YzdMq15td374e3nVQqa644rtjWsIMR8dg7NlScCDFm6Zf3JKSiEm9aDfW8UF1IMCFg77ZlHxWcN8nov8Eu1or577ZQ44JubO8zV+zdvAc2eU0/0Ii9MpHsCj5LNjBm/sOtA9vElGWRw1kqL6+5OzEH2BxYUaH10rNhHTploHe4R57P7sLoJsoRLILZNnJsnBfbKtWY1o4MkMiqq/bjaPGRLWcKNe9gtB18dHGzpl4RxeNU4+fuW+WiHyfvV1AO8ja89u+fybs7u+qWutW2a3tAADNYisFiug38QM6+Njmuq8Z6kqVta7k4TFSly3x4v+AYBdJrGuilSwcpb9JxtTwVrpxEP0VeXMGMe51G0NbOYgxHATgRNR6lBndiFTpIe1nxIUH9pQNW7ORs2YWTFiP19VBsdUVvCufh3oL12gFUx1eYjzlbc48u20x0C2OhTNQt8G/Ih4sWvfjjpjSeSoQxnGL3uVWJ2JPiOvWB6LlmzP/gxtF5T6YwKFIcvEeUw318Lg04N+ZsXjNyy9QdasZFGD0p+mR6ffGI3npqgZ64jkz1EPEqPQK0/U2jAVd8kA2gqQoSEQ94Q5n+TxDMqbuKzxPhd+dG0RodluiFQ9HRXHfpmahQb5fR2q82WG6XqLKmyp973PLi+R7QI1MxsqEIzuNZW52fF6lSj2ZxqfETUH6yfukxyeHxKGOrkT0bJSjdmlsMTfQRvfmZaqUadDVgQsu8yqJw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81b24e3e-6ab5-43d4-a2ef-08db0a8851b1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:00.7826 (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: K/Lqgy727DCdRpq7cR1vO6wNvC9nt2QmLhqDPrEiao2nvuEodeyx9mUy8NIQy8LGPghZd45e/qNS0/9gxgLt0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR02MB8240 X-Proofpoint-GUID: V0w3DxA8wSahoCHYDqg8bgmU7lwfIvkD X-Proofpoint-ORIG-GUID: V0w3DxA8wSahoCHYDqg8bgmU7lwfIvkD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_08,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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 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 renamed hmp_split_at_comma() --> str_split_at_comma() Shifted helper function to qapi-util.c file. Give external linkage, as this function will be handy in coming commit for migration. Minor correction: g_strsplit(str ?: "", ",", -1) --> g_strsplit(str ? str : "", ",", -1) Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Juan Quintela --- include/monitor/hmp.h | 1 - include/qapi/util.h | 1 + monitor/hmp-cmds.c | 19 ------------------- net/net-hmp-cmds.c | 2 +- qapi/qapi-util.c | 19 +++++++++++++++++++ stats/stats-hmp-cmds.c | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 2220f14fc9..e80848fbd0 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -19,7 +19,6 @@ bool hmp_handle_error(Monitor *mon, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); -strList *hmp_split_at_comma(const char *str); void hmp_info_name(Monitor *mon, const QDict *qdict); void hmp_info_version(Monitor *mon, const QDict *qdict); diff --git a/include/qapi/util.h b/include/qapi/util.h index 81a2b13a33..6c8d8575e3 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -29,6 +29,7 @@ bool qapi_bool_parse(const char *name, const char *value, bool *obj, Error **errp); int parse_qapi_name(const char *name, bool complete); +struct strList *str_split_at_comma(const char *str); /* * For any GenericList @list, insert @element at the front. diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 34bd8c67d7..9665e6e0a5 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -39,25 +39,6 @@ bool hmp_handle_error(Monitor *mon, Error *err) return false; } -/* - * Split @str at comma. - * A null @str defaults to "". - */ -strList *hmp_split_at_comma(const char *str) -{ - char **split = g_strsplit(str ?: "", ",", -1); - strList *res = NULL; - strList **tail = &res; - int i; - - for (i = 0; split[i]; i++) { - QAPI_LIST_APPEND(tail, split[i]); - } - - g_free(split); - return res; -} - void hmp_info_name(Monitor *mon, const QDict *qdict) { NameInfo *info; diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 41d326bf5f..a3c597a727 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -72,7 +72,7 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict) migrate_announce_params()); qapi_free_strList(params->interfaces); - params->interfaces = hmp_split_at_comma(interfaces_str); + params->interfaces = str_split_at_comma(interfaces_str); params->has_interfaces = params->interfaces != NULL; params->id = g_strdup(id); qmp_announce_self(params, NULL); diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c index 63596e11c5..e26b9d957b 100644 --- a/qapi/qapi-util.c +++ b/qapi/qapi-util.c @@ -152,3 +152,22 @@ int parse_qapi_name(const char *str, bool complete) } return p - str; } + +/* + * Split @str at comma. + * A null @str defaults to "". + */ +strList *str_split_at_comma(const char *str) +{ + char **split = g_strsplit(str ? str : "", ",", -1); + strList *res = NULL; + strList **tail = &res; + int i; + + for (i = 0; split[i]; i++) { + QAPI_LIST_APPEND(tail, split[i]); + } + + g_free(split); + return res; +} diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index 531e35d128..cfee05a076 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -174,7 +174,7 @@ static StatsFilter *stats_filter(StatsTarget target, const char *names, request->provider = provider_idx; if (names && !g_str_equal(names, "*")) { request->has_names = true; - request->names = hmp_split_at_comma(names); + request->names = str_split_at_comma(names); } QAPI_LIST_PREPEND(request_list, request); } From patchwork Thu Feb 9 10:27:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134321 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 68A93C61DA4 for ; Thu, 9 Feb 2023 10:29:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4A1-0001Ah-Ll; Thu, 09 Feb 2023 05:28:14 -0500 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 1pQ49y-00019t-ND for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:11 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQ49w-000801-6d for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:10 -0500 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3195Xvca025397; Thu, 9 Feb 2023 02:28:05 -0800 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=KnewdVkAe2dTBNQnUDWxGse0IHV/Bl/7tgUfC/8rNY4=; b=i3GkWzP2gRGE0TZfmD+0x2W0FU+IqIGjEQYei5gEOjiUtwdg661NSjchMq2QC0f2ecKc 3mwGrZu5RselWhkwdlpHWGQTFTDGNdsvuRvj9Hqc5h8Ttn/E+/xTRDr5vnO5RmR/wwn9 Zpx6KLlWOQ0k5fgFX/GFcv0H4nTPxdD+ubQ8ws9bhfoVFs7fZglId/OVfS114um4kDOh 0hghZIcY0snv4c6Fw8SjlWWBZItxPebmG3b+QJtcV0F9wKBJbD7ttiiIWdajs1SQspnh XAFvlkn7BoXcOsXQkjt7Oq7jccwE0pOUN9woFFLR4jGn11oFD/EWbnfvi0FZYb4MKhTz bQ== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqjp1byf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SmfT3G4TCRFOV5mVHjPiXw3a1qKIGtVCGpO3lCwd5IYuSnJnW5/G1UFwJ0G7zk0FtXNpwPwCe+4sUmTuUq+WxDkMIewTdBw3FJLr3CrvBAVJrNr3tnQrPzOsHMRa3zk9hUOBzemCA3kbN9IYK6Jwlz8ARlZkMLzpfNCHPly0A5mcVRWG2gYCz83iat88ItOTOld7K8W78ySvgUMzpjRic+iTIJva9vJDgFYlSpY/+tbzCgK4M6oTkboBjPV54cYU1znJumk3YdKOgUtKWbUuKckK/Nq6NzkMjgtDDwQDYdk3GudmWZIAelhTNpW6UsIc+brHdm8sNLjpJWNfwCIYRw== 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=KnewdVkAe2dTBNQnUDWxGse0IHV/Bl/7tgUfC/8rNY4=; b=Kiauvtm2sOjqhJ7YDqK2Pp3ux3avdCk82aSNB3cu4wvez/tepCOr9zwEbN52acJ6ssPVlQUJZOtRi5t+ssoayg4BoKhq3076ppmQ7L8FmbFK/9Tf0Ko1QVaS4bgigw6ewdfgqEXiv6bvfuAFT6e7PApsDvv7IYMfY8CFYPhhCiBcr2oMIPKzewjVG7zqld9V5opLcNLRr7VdpVJTXSxxgzqfUHYZtohl1WcR+aNSWbqB/4yW0hPSBHlNVxLUFyGpqeCFPjLRkR7RF1AZJEi1hyUJCR3fklcvAwMbn/AcaM62NO2ITrZ6BsQZRCVJbj5oT7rSOIo7xvrcDZaTj/dm5g== 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=KnewdVkAe2dTBNQnUDWxGse0IHV/Bl/7tgUfC/8rNY4=; b=NJ5j/2VWK5SM7FSFxaFWzjzm4lDp8YxLvZwY0ecItkIcfD+o38mtGpTAub7mgDYQdI59XP0FVMAiwZozs6joQbzZ9jNzHoPjx4TCf/8tjP8FnmTvYGFGnln0KCqgD+qV4igZ2lBWz21acnFfcD1SNsCC/bOejWluMrwKLR6ZbBB2R+yeZ/dh1fjwp5Y4m8wxVFEJT3mxiH9+cRPDOKOja339gv7hze2PwgjeiZHy/u0hSt6ABac0x0FNn7FJPdDvkmrj16wmj1dlhD9I667u5hh/GF2ndWlLVxUYlItchTYKtJ4rYmH42oj7dJ+tb/Pu+1dfpC/6dYHn4K7A6J2NEg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by BN0PR02MB8240.namprd02.prod.outlook.com (2603:10b6:408:157::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 10:28:02 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:02 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 2/6] migration: Updated QAPI format for 'migrate' qemu monitor command Date: Thu, 9 Feb 2023 10:27:50 +0000 Message-Id: <20230209102754.81578-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|BN0PR02MB8240:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ea72970-f03a-45b2-9283-08db0a8852a9 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: lqiNKcXZ1MBtK1JH+VfuoQU6HPe7vjrPSdV0Gpi35hXbmHNaYXslmOrnKu28CAunU/U8pzUg/L/o/qsk++TCGq5yQLXe42rW7T2lUJ1myRarRfi8iMxCASfkuVKmdSaWh2Mw/LBpZeFqFSPBqgHkZmfAGv1YmN2gh+xv8amcVqh8DYRoivFoT6DEtNv3JWEN42Shz8gs26cLUAGDRsGE6iLyjupE+SenLffcJEn4kWmGliH/vXg9tHpPkZsrtjjI98Nrsi/dEknHQcONPpS1wVL0MisHThjZXGVH8KiSQ3kbtkJPJj61XofAPuKipk1xHtc5GmbQf34RsLKxcj3mrRu0MpBmBcC8SrIpXy+FhRFbY9z85kSh8L8s/BrUDRWFQz0Dn1qRE15mlDwstRl+HMnQ7FMCAhuzgRqvVT2mbwVAbS1QEgFFZ4qIYbX8izett3DqcfxqRobAHTqdZLgHxkJs6+g1HMF+HldKJ+M1ZwwLAn6fweaBvOLt7xSqrnmBZbfsjBto8FyYrRBd0CF2SIic+8XiXMG4izWeiIUDCoGUIN8NAydlokXx+VHmJ2WCCl/WkjtlmzJ1qShIX8dGxzBZQ2iPwyp4LTwmzHvVM0HS+9uVU2pikqFyvBdIqokYTFjT+j3b9ginw1q9ouC4VAxVlVMd9N9i1pl1ZxnuR3GvlBDbUj6naoCwJBo1Tat6IniQOGyRLefkHrMhLqGCKA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(39860400002)(376002)(366004)(136003)(346002)(451199018)(5660300002)(36756003)(2906002)(44832011)(83380400001)(66476007)(1076003)(38100700002)(38350700002)(2616005)(8676002)(4326008)(6916009)(66946007)(41300700001)(26005)(8936002)(6666004)(66556008)(107886003)(186003)(6512007)(6506007)(316002)(478600001)(86362001)(6486002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4xAqbmUpy8Tg62t2ZzcKa5kmdBuAG97oX0D95hiiFW2XpyOq5OjLLv8UgVv9zA7GnM0v5qo+xxZxK9n81sD9jFi7OAfmq0ulxHjydAX2BUds8AUDQLoY18C8j3WcXDIRGULRJ3X5leO0vkTccIj35kgEt+WT5qk0xmDAictGczLaUe7YLlQ7+ZDHTF1IZ0FOKKhL6lo15Czd8bqChlhC43nTlo9WolYDKz2W6BMnka81m3TY4In9Cp1/ROT7OKfOts9xhEHk1B70N46cdnLOQWK+1r+cfKjQ9tyvEks8vgeahNW1y0IRgVaCXmTLdUqCuEUYijRhsQcxHHwefw44XrRdYNorUG/HS22GAnAoJqIzazwS50LGvY8N4KLUYf+Esey6TathDc+yFRJkyiZrcoQynkG44p1edS7ZnXogkb2WePMvFmQB1EsFoFBB420S6xExxHLUAR2k/XwufDe/VgweZOqtuENFt/NJjVrQeEJUs7TiB+kwKxKaNUx0iy0cVE2IKwpU0Mcf9GpBYnZ7GKhVJMJzHkjXixZhWcxNVSps13G77Vz/kKXKavsEXTgnY8j24xeeVef9jE4PKg0WBljpm/VMhRZSd+MYfFd2y6VH0Jf/zqzMB96cSJEWdwaJONfWP8AuQ+cSlQW9P7Cmer+AzUzvi3GQvqt4QEeDHxcRXO1cOiPVtAyRiqfRWSmwTzJWpisnEE2q5ZD91ust8AUqCibn0fVmj7hItnWq6QqMLfbya4Ufch9GX5ZXsHSR4DARhMuqJ5ZYaeSApamo6oZIVSTgQFBpAxVVSnT3UyuW1vaGLe/VX/DWLbrWITv7gc5bmgIP7LMz46sPi6+NOOIRc1mMYW8RH7qOf8jRiJl6HNPorSCyQJOhaUqsXQARr3Kzy/09K4uM5MeKgg02oMz3qB8Sm9RUyxw5otUtQstk7tj5csQpJm2sPwhrWoygG2upjWnaO62nrIv4RIiZ0bGthOrej16x+LA8WhBUx+Zrm9GXcRuzsYnIYwIfHEwVJ3nzyxj13FSCQgpAmsCM8sKCoMdAR30TK5dbKdOLhQICxEZbHXoUSbSxhsbWZub9XOkg/gbEke8UGLU+h8ofZFSwYPpj4ZmNdRI2vV/vvOJn8EXg9MnbKv0GAMb5mDmq3PacLAzHqHRlrCsnVYUwfpP0zXrTCCxkvoNhUMd9l1WSeUqeZOcmJUZMwF4LIYtLZUgQ+kiPaNrXIk6rlklXsA8eNmKLGStdJqil4GK5V/ncaOosqWUIBWjOTMtjPUTOqRzjhen5Vyd5NgVz+iIsuwwiOwOPDqKBmxoNWjL16gmzlrqb5Dp3ywpYrPpLji1LNsLurWZEjLc7retMmqY5kfEumBU75zVnSQf672CuK75Rt85RnyVdMZjyuWR75qZd9DC9OyIXWzGErRP5h2QCa8YK2lSSVk8iDEF+6cxqO2SkVXanjdp74bzEJlU44gPw4vMlyCCvtSrTlV+tQVxh/h4llvm0M2d5T7kh/9a5wgaDjlYRxJCCLpN4b5L1W7K79kYT9yg6/gqxhs67iz4bXULFBL72slndaKBmIMnHD6hKb+AvMND8u3KqSbzmdp+PHCZG5HnxpbSD6t6M6qeg8g== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ea72970-f03a-45b2-9283-08db0a8852a9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:02.3606 (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: YMKPLlgt+GkdARpnZGxdMN3jRwzRrm64vjo+XygbYAFnNUEQGrxHxr7ZLxOapLm6HK/GFD2jqxNNPucnz5JoWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR02MB8240 X-Proofpoint-GUID: YYx6DwZ-lxhMMYMN_i97sTRVnuA0bbuF X-Proofpoint-ORIG-GUID: YYx6DwZ-lxhMMYMN_i97sTRVnuA0bbuF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_08,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.155.12; envelope-from=het.gala@nutanix.com; helo=mx0b-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 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 Existing 'migrate' QAPI design enforces transport mechanism, ip address of destination interface and corresponding port number in the form of a unified string 'uri' parameter for initiating a migration stream. This scheme has a significant flaw in it - double encoding of existing URIs to extract migration info. The current patch maps QAPI uri design onto well defined MigrateChannel struct. This modified QAPI helps in preventing multi-level uri encodings ('uri' parameter is kept for backward compatibility). Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- qapi/migration.json | 129 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index c84fa10e86..261a6770e7 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1449,12 +1449,106 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } +## +# @MigrateTransport: +# +# The supported communication transport mechanisms for migration +# +# @socket: Supported communication type between two devices for migration. +# Socket is able to cover all of 'tcp', 'unix', 'vsock' and +# 'fd' already +# +# @exec: Supported communication type to redirect migration stream into file. +# +# @rdma: Supported communication type to redirect rdma type migration stream. +# +# Since 8.0 +## +{ 'enum': 'MigrateTransport', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrateSocketAddr: +# +# To support different type of socket. +# +# Since 8.0 +## +{ 'struct': 'MigrateSocketAddr', + 'data': {'data': 'SocketAddress' } } + +## +# @MigrateExecAddr: + # + # Since 8.0 + ## +{ 'struct': 'MigrateExecAddr', + 'data': {'data': [ 'str' ] } } + +## +# @MigrateRdmaAddr: +# +# Since 8.0 +## +{ 'struct': 'MigrateRdmaAddr', + 'data': {'data': 'InetSocketAddress' } } + +## +# @MigrateAddress: +# +# The options available for communication transport mechanisms for migration +# +# Since 8.0 +## +{ 'union': 'MigrateAddress', + 'base': { 'transport' : 'MigrateTransport'}, + 'discriminator': 'transport', + 'data': { + 'socket': 'MigrateSocketAddr', + 'exec': 'MigrateExecAddr', + 'rdma': 'MigrateRdmaAddr' } } + +## +# @MigrateChannelType: +# +# The supported options for migration channel type requests +# +# @main: Support request for main outbound migration control channel +# +# Since 8.0 +## +{ 'enum': 'MigrateChannelType', + 'data': [ 'main' ] } + +## +# @MigrateChannel: +# +# Information regarding migration Channel-type for transferring packets, +# source and corresponding destination interface for socket connection +# and number of multifd channels over the interface. +# +# @channeltype: Name of Channel type for transfering packet information +# +# @addr: Information regarding migration parameters of destination interface +# +# Since 8.0 +## +{ 'struct': 'MigrateChannel', + 'data': { + 'channeltype': 'MigrateChannelType', + 'addr': 'MigrateAddress' } } + ## # @migrate: # # Migrates the current running guest to another Virtual Machine. # # @uri: the Uniform Resource Identifier of the destination VM +# for migration thread +# +# @channel: Struct containing migration channel type, along with all +# the details of destination interface required for initiating +# a migration stream. # # @blk: do block migration (full disk copy) # @@ -1479,15 +1573,46 @@ # 3. The user Monitor's "detach" argument is invalid in QMP and should not # be used # +# 4. The uri argument should have the Uniform Resource Identifier of default +# destination VM. This connection will be bound to default network +# +# 5. The 'uri' and 'channel' arguments are mutually exclusive; exactly one +# of the two should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } # +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "socket", +# "data": { "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } } } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "exec", +# "data": [ "/bin/nc", "-U", +# "/some/sock" ] } } } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "rdma", +# "data": { "host": "10.12.34.9", +# "port": "1050" } } } } } +# <- { "return": {} } +# ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', - '*detach': 'bool', '*resume': 'bool' } } + 'data': {'*uri': 'str', '*channel': 'MigrateChannel', '*blk': 'bool', + '*inc': 'bool', '*detach': 'bool', '*resume': 'bool' } } ## # @migrate-incoming: From patchwork Thu Feb 9 10:27:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134300 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 646FAC61DA4 for ; Thu, 9 Feb 2023 10:28:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4A3-0001BL-5f; Thu, 09 Feb 2023 05:28:15 -0500 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 1pQ4A0-0001AB-2Y for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:12 -0500 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 1pQ49w-00080J-OK for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:11 -0500 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3197YQMt009789; Thu, 9 Feb 2023 02:28:06 -0800 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=IOcm8bZn9nmTTkCRFrQzOXEMXfUQP3pnqlVfj/kFeT8=; b=axx+36isBxWbt2WujjdMyxMJ+fr/mqYhxwM6xSqQJ0M7svIsYivMnTvgacCWMNXijpvz OrPu6ettrPOweFh2dzgZDmPW7Jf8EfbTVwfKXz5ZdFBgRfk1oVObC/6TY6dxtb2DUntK QYadxR3z351qZUZFiRcsQyAZukHgNc91oH5mit7YqvlWrpDbJltJ3b0T5UkmBH2Cr7qp IdF8UcdF5s8qLgmgQ4ErKE3khVOwWQJJG8mItEO44CU/RQjdmojWDwRxZBqa/AfDEE5r mZERk4bLnSJxFLxi1y/tM5wyRMqE1dBncNOXQQdUR3VrPfBzOoXWt1xSoGiwgERBwvEb 0Q== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2046.outbound.protection.outlook.com [104.47.57.46]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqanq58u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLXzbLvWFJaQEphqa9s++lqyQ/d1bu1BZGOmkriMiUrsZrL/ev/2/+ZebylZdTnfd3sZHIrVGkV1CTtaDmsRzvDfJOg+Lt3UWS+1hb6QZwE6xdocN51TgZGmywcBXY4xBKNYABQDSxUmykvxHu5GRqD0nrdCg+jyoEdTUJ6zsYX/Ab7t5KzrXLmbxpEUXuvMm0yIk9CAPDEaUKcHgvRKaaTSJygLFwqYwj65nTrr4ebueKr5FUZT+rhGW95bohyeFYumdpvONnNXL/B4yz10FaeSmreKBSv+HbZpiZuiCqt1sNctanNSPbwhkDDgjTmds4ufUnJ0nS7zbmNPjCSdbA== 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=IOcm8bZn9nmTTkCRFrQzOXEMXfUQP3pnqlVfj/kFeT8=; b=N03y3h6faATz4bKd4rtoXMzVx92nTB+mvHVXXEy42ZKTuNd+ZQWa2zsgQEwlsLS/9eR7zy2psVq20mW/JCJZmgrYoHQRtylhrqWXlmys75aKF2/93mcc7I3zHsMFb8aYDXmd+YGiDu+L+ZuAsrvv3VJmVBpIhreSBc0wtLA8x6EIu+8lEWgfgc/9VscC2+1L73AyKYFEb1d7B4ODhlTxus26O6OvbqQJDDoj4wptl8XasduT7nTCepNCV0/keHt6PP7IvWN9uW2kRIBx6BhHN8e0aJjehjizL5pzDKl79DkZRIHKc44rSa+m8RPPPyXvVqdZEMa+GUigOWrFi7YrRA== 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=IOcm8bZn9nmTTkCRFrQzOXEMXfUQP3pnqlVfj/kFeT8=; b=xY3u6GjNHUYcpgcqfdUuVUuqTTnskd4kRDZQ7Ryh+k9EcrUCCkH3av4fB1nW49N8J1E8ChAHSZEX/b7Q4i6TC5mPKeHfrFHvWUccZvTfki8gOX1u1MhZVLVAlcsLWs5VRcEQrxvpw9HFG77BJMp+y/+1MWV2lAP9M/xOoT9YX+95gkTQbWri9RlwH14s1A1xXGWO/ybS7E5PQLqHzpzsvht+amX5wMUuF0VrO+bH5SzllXwb5hnQTNgq3i9RngQ2mW7HYECNfm0d3ySYFYGyC4MFMokfC1FD9L+++G5Iev482BtoYVRdIzpKK4MSQxJxbpDVi7s68hGJ9AQWaw6XTg== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DS0PR02MB8928.namprd02.prod.outlook.com (2603:10b6:8:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Thu, 9 Feb 2023 10:28:04 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:04 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 3/6] migration: HMP side changes for modified 'migrate' QAPI design Date: Thu, 9 Feb 2023 10:27:51 +0000 Message-Id: <20230209102754.81578-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DS0PR02MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: 240f11ad-63b5-4124-5927-08db0a8853b9 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: qj8s7RfvukHrwaweaFRyqBigaVGezYWeQu3OnhASJSIXXmO11uUCReuuNak1thnv5q/hxwITnWzm8hDOXxWixxj/loApquJNtEoaK9Gs/bVkUIfqnfAVc/a7lJe4QZW9JmU0bxH925aueSIcr5af668/2uYmXq/eSXMNTnk2Dq1e7YRzEgXDoQ/AyLuKlWknlDSrwD3m6omLNEYk3Xz4c1mz7bJxLWU1rWIT/9HE9e/sN9JoZXWNIZVtFzYionDIMbouqC3CHfnL/P+1URY2tbFSRKQnX6F7iMQFs3FcpoAznl41aNIq5jnkcR1FKhxo+8ggesGu/UgfxWgfFHgU72P9W6JEbNuxP0aqPHy4Z42ZL40RYlcnujJQMw3+sCdzKCr29LVMUxBGmYClULUesBsuU73wHROi8MkurHqraGE45lChJMhcf0luGHQ5LEoyG2ukdvJIzWNl9gg8h8dNLyCuf3LpftHI7d+0oIbKBnhifrMf1hSWKBDRjkRWN3bhSq59j3QwIVErCvGqXFJPh7l61I+T4+i2X8O0Aar8zfGMY0IRdhFfgRzUCezFtytl4q6DJADLBWc5ndIp1rJUc9QLJ8gDsIqWuScjyhLApb8WaPNn5LsMA/U7dFqno3gDIUiNWH2YoAUKXiISao+jtqncXE3KiBbM+a78ev6U3nHf1uLDyK7XXTSRGkr8qgtV+Kk2qxBbeTjR2VLa8utBqcLFYfOqu47xBnoA7JCFVE4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(136003)(376002)(346002)(39860400002)(366004)(451199018)(36756003)(66476007)(38350700002)(83380400001)(38100700002)(8676002)(4326008)(66556008)(66946007)(26005)(6512007)(316002)(6486002)(6666004)(107886003)(1076003)(6506007)(5660300002)(186003)(44832011)(86362001)(478600001)(41300700001)(52116002)(8936002)(6916009)(2616005)(2906002)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fmKo19KUL2iWa6ZOTOSqMs/pe1J7eDDfoka7jEooa+OjW3yGbaI6KJiZ/hn366VZdCWwPImG4bXE+JumdrOdvrGAZxy7mpCKW1KYHZ0mC/11wtrlQQmzUkbWzAKqrnyFf4Jl51TmJJLFzYSy85t8ka0yjAjACEJi6CYWPvcpLnF7bI14kTYTLI+sB9zyrMy/AVsMvOriHbZ4PydURCD3felk/UzbaY6QNj7A7PEapUQoPHrk0jhkwXE+GmYBC2XiPZ2OTS2aTJzlaAUX9OfAUsWZp/02FcnEpdOSwcSkD662FvvBxLl4YLqAyMAfGURk5WY+sAgpKUUw9c7j75toavPzGFwenOjYbH/93x8LlZZDnZ7f6JC7cFJeKLsSl+Y//tQi948qBQ/pDfMKapeQn3J6zejl8wkshzB4WNHJ3LP228eaaMoKX1CIc3M/gHkV1GvizldiUxn+oXZITtzM2UG3xnEjrsVrd8rsjx0f4RO2xNdWpTQOlVyWjvwEleNM8Zt7ILFT+mT0cFtOLHriHT5uDHBkooMYQ8y69s66iw/hB0tbCrhcWQofcDyHAmN5/O3wUevEJ6vwFg4AHNUoD+B0NFhf1dgYatewFjrbA5kur5162NyKsnZ0T9d2Zg+eXkuLbts+5sXHz4G0yzMq+Q02yWBE2IKhVvBlDhYzaLKoIF7cPnLvaT9gYOozIUE/SzKPo3yW1/Zdfs+Bp6MjuR43bb23G/HLe0bdh4nYmffmFHXLi9XoKoXGmUlxpWDEDC8nIji7iBe8Xb9mOROVuNil+oGwaZ/41AMtcZWnSIF2ooCZQBnsS9V9fdPVVj6gYdS8naDMoSGma+vG3E1TmkGh7RIuFJNc90N0o2fDFHe2Ed9y3GNmiwOzocloYXjjbxCLvlwzWNNMxILmoOL7hQrJ+4ZoVPLKwD3ZskE5qyqQgG9rApB2F/ETSuftl4gf9sTvPZFqfZJKFeh/aMO31KLYFlQhx+B5m6QSTFp2/2AgU7zThNjzD4HHHV36feo/jOtZgAtReWNbq6/g7JBKwJ2b/Dw81SViab+aOgag9XYwglp0Y19h291PMGpi4mnVZmP0QmFsTzOsMaGcRf4qp8LwZN70Q5R1KxoC0eKyASslo7ThUUj8mVso303AJXOst2QmWl9sYaDbLeq/XjoGjIbXIwnhdWF9UdRd3J1vbOmVQLblrsOMWpdGqerMzgxhbkC2mQ5a5v716Cxgjzse13chV+feczwoUTBepw//Di/133eiMl+rUv+NOxiNYKbQ6zIX0yxElQ4dl5XwgfC7Cmmfsv7o8coQ2UxGjNqoOJtx8dYFDlRVRmRQ0My8SIGrfuP3E2j3rNfdg/RTfDvdTy8not5yf3ngEno6VPaZncZ4lb83VsUGkdeCBfqbJfC2o2640y714QCvBsOLyAqm1v769q6UMzJM6WOUvRuQT6zFeWVQ0AyQG7svRxaRqMMFDYebV9k/XdnN7Z3JcYqySsdjlUOTSu3lmxJJthuoztZp50itK1WaLm9FpzQWZb+le1oK8nbVX2p4FXeG323o6OUQL6bBW7wwcpqxdwtTecHOH0qPE/1W1jud7LiOrLLQl3dOdMfcDAeyWkfg1i1tmQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 240f11ad-63b5-4124-5927-08db0a8853b9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:04.1730 (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: hZUs/0+oWss3Y3PGl1wAJyVy/D1nzDOgUEjw/gxRufffDJpUBxeN3pzaFw72xUHKd6z21iQQevLazpnuQxGdEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB8928 X-Proofpoint-GUID: 6P-2W9BMO5i7kRAHIqNQavYAD8hcFOwv X-Proofpoint-ORIG-GUID: 6P-2W9BMO5i7kRAHIqNQavYAD8hcFOwv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_07,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@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 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 hmp_migrate() stores modified QAPI 'migrate' arguments from qdict into well defined MigrateChannel struct with help of migrate_channel_from_qdict(). hmp_migrate() also accepts uri string as modified QAPI a 'migrate' argument (for backward compatibility). Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration-hmp-cmds.c | 105 ++++++++++++++++++++++++++++++++- migration/migration.c | 15 ++++- 2 files changed, 116 insertions(+), 4 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index ef25bc8929..1005a9e1ca 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -32,6 +32,101 @@ #include "sysemu/runstate.h" #include "ui/qemu-spice.h" +static bool +migrate_channel_from_qdict(MigrateChannel **channel, + const QDict *qdict, Error **errp) +{ + Error *err = NULL; + const char *channeltype = qdict_get_try_str(qdict, "channeltype"); + const char *transport_str = qdict_get_try_str(qdict, "transport"); + const char *socketaddr_type = qdict_get_try_str(qdict, "type"); + const char *inet_host = qdict_get_try_str(qdict, "host"); + const char *inet_port = qdict_get_try_str(qdict, "port"); + const char *unix_path = qdict_get_try_str(qdict, "path"); + const char *vsock_cid = qdict_get_try_str(qdict, "cid"); + const char *vsock_port = qdict_get_try_str(qdict, "port"); + const char *fd = qdict_get_try_str(qdict, "str"); + QList *exec = qdict_get_qlist(qdict, "exec"); + MigrateChannel *val = g_new0(MigrateChannel, 1); + MigrateChannelType channel_type; + MigrateTransport transport; + MigrateAddress *addr = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new(SocketAddress, 1); + SocketAddressType type; + InetSocketAddress *isock = g_new0(InetSocketAddress, 1); + + channel_type = qapi_enum_parse(&MigrateChannelType_lookup, + channeltype, -1, &err); + if (channel_type < 0) { + goto end; + } + + transport = qapi_enum_parse(&MigrateTransport_lookup, + transport_str, -1, &err); + if (transport < 0) { + goto end; + } + + type = qapi_enum_parse(&SocketAddressType_lookup, + socketaddr_type, -1, &err); + if (type < 0) { + goto end; + } + + addr->transport = transport; + + switch (transport) { + case MIGRATE_TRANSPORT_SOCKET: + saddr->type = type; + + switch (type) { + case SOCKET_ADDRESS_TYPE_INET: + saddr->u.inet.host = (char *)inet_host; + saddr->u.inet.port = (char *)inet_port; + break; + case SOCKET_ADDRESS_TYPE_UNIX: + saddr->u.q_unix.path = (char *)unix_path; + break; + case SOCKET_ADDRESS_TYPE_VSOCK: + saddr->u.vsock.cid = (char *)vsock_cid; + saddr->u.vsock.port = (char *)vsock_port; + break; + case SOCKET_ADDRESS_TYPE_FD: + saddr->u.fd.str = (char *)fd; + break; + default: + error_setg(errp, "%s: Unknown socket type %d", + __func__, saddr->type); + break; + } + + addr->u.socket.data = saddr; + break; + case MIGRATE_TRANSPORT_EXEC: + addr->u.exec.data = (strList *)exec; + break; + case MIGRATE_TRANSPORT_RDMA: + isock->host = (char *)inet_host; + isock->port = (char *)inet_port; + addr->u.rdma.data = isock; + break; + default: + error_setg(errp, "%s: Unknown migrate transport type %d", + __func__, addr->transport); + break; + } + + val->channeltype = channel_type; + val->addr = addr; + *channel = val; + return true; + +end: + error_propagate(errp, err); + return false; +} + + void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; @@ -701,8 +796,16 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; - qmp_migrate(uri, !!blk, blk, !!inc, inc, + MigrateChannel *channel = g_new0(MigrateChannel, 1); + + if (!migrate_channel_from_qdict(&channel, qdict, &err)) { + error_setg(&err, "error in retrieving channel from qdict"); + return; + } + + qmp_migrate(uri, channel, !!blk, blk, !!inc, inc, false, false, true, resume, &err); + qapi_free_MigrateChannel(channel); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index 7a14aa98d8..f6dd8dbb03 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2463,9 +2463,9 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, return true; } -void qmp_migrate(const char *uri, bool has_blk, bool blk, - bool has_inc, bool inc, bool has_detach, bool detach, - bool has_resume, bool resume, Error **errp) +void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, + bool blk, bool has_inc, bool inc, bool has_detach, + bool detach, bool has_resume, bool resume, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); @@ -2483,6 +2483,15 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } } + /* + * Having preliminary checks for uri and channel + */ + if (uri && channel) { + error_setg(errp, "uri and channels options should be" + "mutually exclusive"); + return; + } + migrate_protocol_allow_multi_channels(false); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || From patchwork Thu Feb 9 10:27:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134320 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 BD8B8C61DA4 for ; Thu, 9 Feb 2023 10:29:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4AM-0001IG-93; Thu, 09 Feb 2023 05:28:34 -0500 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 1pQ4AK-0001HF-O8 for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:32 -0500 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 1pQ4AI-000821-97 for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:32 -0500 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3199XZqU011953; Thu, 9 Feb 2023 02:28:27 -0800 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=GBSO7QCtnFFj06LHVXpnPu60KGbCpxRzvp7/6VXbgtI=; b=16i182RFdQen7HyF1IxMSMpwx/DhCBzngI3qh1sngAxaVsZLCP5qxeBuEx44TVkxdSpY U2sDVLOr54/0u5QvkioYFvu7ml80XQ/Jlr4KbGKNTpYruQ32dtQKw9bV6M04bv18oPlE 5yUNDHuByJkgDPVP/I1zFQj+TiCuMq4CbwYLmzl2FI0xgOH+ewVcAYF+ooMjj/Tp4jIH wiZvWKnvJaAZpnkeKTIwTPQt79OOvBgW/1CibCURUtvmQr3PAE3KgkR9gFFYQfEE8Fea PyqHAJaJG3T89Yxw9nCTq3nG3wOEb11cayLul1XZeMmchzmcOZzWRZsYBmJ4FvAmXYDU 3w== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqt4q2ua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dnIOtmmfQGi75UJuarEciK34FBIx0A1V7rz39lbVeN5uZe3BkZ/5Eq05yVQg/V7yAHRGLhBFuHJr98ds4lC8OF/lYqE9sczP4nHAkN2FKoA3TptYDOPPRAnWErPFE/Gc2VY83ileWcq9yiRtX7+uh+E9N4YogQIrYBE6Ki8CZ4vLL1EoAlfnc09a5qABAwF/XpMwE8xcjtjvICS0yeEdZXTiC9Ppl2d3V+6YTIcHvUt9ctpkDYFrzyqvuMw3uU9z1X182u3yLDxjRZ8pCkdRFjC3gdPsZu7F5abiceh8GR18t4cocKyOQ4hdSIRCVQ0pqvvxnPF3ZVsMQUuy3lIQug== 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=GBSO7QCtnFFj06LHVXpnPu60KGbCpxRzvp7/6VXbgtI=; b=BPye2OimQL73iHcZc+fW9FsFDZmPiq7GPcTEkPyWER7qa4bU2U4Fs5AiQKufScBNOVFd92vLjLJq2Wx7FuCytPsJbLUyL0ofhvmpsh/iYnvfCA3gHFdd0XtgPk0Zz23iDUFoJJjeCcXFZPZrxeEH5Ok39HyWiZpwTnvBQnVGWOdGvwH9LZDdkcUYwtEuN39Ljn/9Q6MrMdtryZbKZK6YfsEexbvOmj7O4hN77suZc8M8ybIJpX7Gyj4aKfkcCnCaZmLbAkSwEKC1jU4Wn0X0IciMgPCZ6SIgHrdMJCrDvw+EWLdYG9/v8tDmkiSutY2ksuTTwdQK9YyE8Dxw+HcHPA== 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=GBSO7QCtnFFj06LHVXpnPu60KGbCpxRzvp7/6VXbgtI=; b=zBoVyUlz3bpSEh3nQXWhnqcQVpNXjQVyVfCnoBpQofGnMo6YLyz4u9vchCyJ2bEBc8VrmfQQSC4/RmagU3kSwwXDcgUBYEtk8Y8F84zLePEP/02iHqSGvlZkAPwHqXUCQ8KjvLqbH3lbZ31GNG+y8HD4qMcmDVXB/vqO/jHYVGcJM9Q5Lt77+FW9Kw/3i9HcQa+JOvbZQqZWC3ihrEe6JRRXEUBj7IzkiikfmqLirM0ttwiTWRsqnr2K/EsyMFNEFKB1kIMgl0NbYf8fno5msLICUVChfiPYG1tW/IHtIzhMer1kCZXLu6ssljGVsfRkxMNfIqDqDUL28MiVAzF/sw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DS0PR02MB8928.namprd02.prod.outlook.com (2603:10b6:8:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Thu, 9 Feb 2023 10:28:06 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:06 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 4/6] migration: Avoid multiple parsing of uri in migration code flow Date: Thu, 9 Feb 2023 10:27:52 +0000 Message-Id: <20230209102754.81578-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DS0PR02MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: fa02a491-44aa-4079-9483-08db0a8854de 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: XSv1ZmUbAr42Myas15oMdF3NgI5o/pjTd6+9wqVuOnRzFx5SUGLdblBT89S3U8A3ht9F96ba1dCi7VYROPC2NqaeSQANkGVcAFg54hEzJlkiIE/pAiI6tcG/+g4f5U77nGnf3wLTYC8KvfKPGbAMYZb+K7ZXfwI6Zck/lPfXcr3bkNkMw0eaDyBC0VlKuJnqVvUa7qgXcbJu7WZGVrcrTPKBvYG2rxSQJ8ujdnbaI/Em9UySGCQbweaHFIBnhYrtAMwpi5v7sCVjd6Ux5zfrUc3QwB42FFiiRxmuaWBLvZ8rNuXYzgVtuYfZ4u1BKEk1FqCkLkSgd3hNSclrwz33s1oBkRtFSzoq77ckMTs2ro178gxJOcncbeJsrlBBf2txbI/+LCl9WS+bVDW2ffYZUktUdsHuKvNKw3yNmWc44rHGlfgrqSbRPDblONqmVGLgkHjpvsnaNKDjQ8hM/D+UcWeFwFNfvD2JPrX1swNM+DUTCjxkf44RVRiVPNtlG+ZvpvsXDwff1ZMDGOQYzowK5iaagYYdwVR22WDhspg/eZFHwjg5IwXe1esiOAUgyKgtHctIOl4d6W38+v6VE8JeMTl+7n32QQld0RGcSc7xfN9cpgHWtc1uEdWzU2sHkBeaAIT9JV00fpYQsdUUGMri1CrKykqpIRPKczVRfZvgvyX+eVwDiAexCPyk9WsRpHEK1Qlr2CCIcvlVwB6PV9g6bQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(136003)(376002)(346002)(39860400002)(366004)(451199018)(36756003)(66476007)(38350700002)(83380400001)(38100700002)(8676002)(4326008)(66556008)(66946007)(26005)(6512007)(316002)(6486002)(6666004)(107886003)(1076003)(6506007)(30864003)(5660300002)(186003)(44832011)(86362001)(478600001)(41300700001)(52116002)(8936002)(6916009)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cxfjneqj7D3wp1Gjw8PGfB8P80OFpVhlI1v6Jj+B5Rx2++ymvOIkzKYniX4RlpqtFQ24lu4RpawLm07+CmzLtHpkHoGkSnVkTkAdQHatACyOAGxPRfClYKSqBwjXu4Oa/IwrbLm/NG8qq3eNPD5T8eAynzWpROCiWNB7h/GjPFmtqe7LqwnfPNUtUmn9Gr5a0V+MJ4IcjvgRIPoT0SjhGSUxV8jI84skaeAK3KlzKvSMbAn6mRx90T6m2Ot9SYuYqDZzgRgm4A6dd32MDOaLFClP7YfbBobrXsp6ps+PTXgDcf0KTw7Tl+Ww33Ha5GQYSAw7VgLwgmycSFkhpuKeARmT/tyCl2thyEREb/svuVZMAB7MdWzqlwLZ99gvPm3rmNKnwEZl3H0HRD2OQZZ3ohcDmHeSK07UK/K27rDWvH3ILdhS03Phgjadp/LDPuViqsp8OqesR2fUo9yz7QJric1fYo6GZN4JY/v8hx1orGspF0EF5OGp/TSh2JZQiKI7pvsgeLlMKQAODFtPB1hAcPAz200Nri2+jeKHCUPc1CXCIVCMoW1+uHFAHVeT5YuEBTzIoWARkdZlQ/9JAJwXNRmRqufHo2fCUrt2TCnCdrOCn0vgOkcQDllHxyauJ6SGUjThNFmZGD3dKLuuKttPO1cVd7w2kUYjFIWZGFvdEN4qJkQCjLGcYgnfpVoU7NDbgWOfMtPuSRGFAiZ3EC6V5u+SaScAcFy97RMQ/6Ow5YbYFLnBGikMiQftsEmzMpj1tSME0uM8bOjG4zu0i5/+HjuYZH9IF1pr/4vUhw1VL/0TS9Hyp4kHmdryzQ2Vcep94SSIdiLRvPnuJZ8uX4/vNCv94Lk6nI0JD/XZANwFjc2I9RnE6uDKNZlI3g4FRtCz0JHGKOKrvbKa/aZ074aU7TVBkwFP/U/eqciLtFmaSk5+/oKXBg/M4JsbWFhVMvJCWY1YlEzQs3AVRSbCmdcg3gIQwDfhMXM1lNSjaXP1+2pC8Fbkq5zIsvvliVPlrBuJDVyxf/9bB1M0/x2OVSKGEryhgMYzG7JLtCY2sw1PTgz+MnPrPtgrJrRpL2hqu3dkD4IaOOQTGtCb4IpRK71Kzi7aWYvR8ZC9XgEUwO8ZE+CicqMx8Op+54T7ySs9K5H22DPwX95R2Oo8m7gSi+iMd2o77A7giU1xVrddUxb5Jp5HHXq7rdLAxKMLG1QTOwig9APeNcN036BizSUefwp79i971uCVE5AwZcU8pT7ONLWsWOBLN7v2UMwCfBRhiYTnV52KG9bU+hsRNqyxZ2e1BwVGCDR5Se6XiGCVISePVO3lI95ss+ceNUJ+9RxxR+nzpio+G0Xu5XUkmEMlc9MW68o2Z64eC3057H3JmW6Wt4shvjRPW7mutoVRPbEHOiY7Lm3uPYrsS5ex9vl25uVhNjrlqcJBMkQFFuP3zcTfJBGz06+MXgYhjgCWH7pug91Bb+x3Wlo5kQ2c/+LEyHlRyapc72n/DjUu1EsVlnBoj5uflUn2qqE0Sjmo8k5b/0/g2ie9hpW3aiQxj3D0apb16EFtyJ7FA213a34giitUqbnLnYJ8LYhC0OOe2eBBMdUAUrzxtG012Ume6F5zsO9cuA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa02a491-44aa-4079-9483-08db0a8854de X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:06.0947 (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: +6KBeFcq3ngz4XBt7GfrivxRJL++hmeqh0GxQP9DKWvD4OMR1kA4IbnABUpg9qF7zdKk0Y61GxIVU9xpQynftg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB8928 X-Proofpoint-ORIG-GUID: aS6UQOEz9AdcGCNcOiNWFI0pIe-AqZYA X-Proofpoint-GUID: aS6UQOEz9AdcGCNcOiNWFI0pIe-AqZYA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_07,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@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 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 In existing senario, 'migrate' QAPI argument - string uri, is encoded twice to extract migration parameters for stream connection. This is not a good representation of migration wire protocol as it is a data encoding scheme within a data encoding scheme. Qemu should be able to directly work with results from QAPI without having to do a second level parsing. Modified 'migrate' QAPI design supports well defined MigrateChannel struct which plays important role in avoiding double encoding of uri strings. qemu_uri_parsing() parses uri string (kept for backward compatibility) and populate the MigrateChannel struct parameters. Migration code flow for all required migration transport types - socket, exec and rdma is modified. Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 31 ++++++++++++++++-- migration/exec.h | 4 ++- migration/migration.c | 75 +++++++++++++++++++++++++++++++++++-------- migration/rdma.c | 30 +++++------------ migration/rdma.h | 3 +- migration/socket.c | 21 ++++-------- migration/socket.h | 3 +- 7 files changed, 110 insertions(+), 57 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 375d2e1b54..4fa9819792 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -23,14 +23,39 @@ #include "migration.h" #include "io/channel-command.h" #include "trace.h" +#include "qapi/error.h" -void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp) +void init_exec_array(strList *command, const char *argv[], Error **errp) +{ + int i = 0; + strList *lst; + + for (lst = command; lst ; lst = lst->next) { + argv[i++] = lst->value; + } + + /* + * Considering exec command always has 3 arguments to execute + * a command directly from the bash itself. + */ + if (i > 3) { + error_setg(errp, "exec accepts maximum of 3 arguments in the list"); + return; + } + + argv[i] = NULL; + return; +} + +void exec_start_outgoing_migration(MigrationState *s, strList *command, + Error **errp) { QIOChannel *ioc; - const char *argv[] = { "/bin/sh", "-c", command, NULL }; + const char *argv[4]; + init_exec_array(command, argv, errp); - trace_migration_exec_outgoing(command); + trace_migration_exec_outgoing(argv[2]); ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, O_RDWR, errp)); diff --git a/migration/exec.h b/migration/exec.h index b210ffde7a..5b39ba6cbb 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -19,8 +19,10 @@ #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H +void init_exec_array(strList *command, const char *argv[], Error **errp); + void exec_start_incoming_migration(const char *host_port, Error **errp); -void exec_start_outgoing_migration(MigrationState *s, const char *host_port, +void exec_start_outgoing_migration(MigrationState *s, strList *host_port, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index f6dd8dbb03..91f00795d4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -63,6 +63,7 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "qemu/sockets.h" #include "ui/qemu-spice.h" #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttling */ @@ -489,6 +490,44 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } +static bool migrate_uri_parse(const char *uri, + MigrateChannel **channel, + Error **errp) +{ + Error *local_err = NULL; + MigrateChannel *val = g_new0(MigrateChannel, 1); + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); + InetSocketAddress *isock = g_new0(InetSocketAddress, 1); + + if (strstart(uri, "exec:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_EXEC; + addrs->u.exec.data = str_split_at_comma(uri + strlen("exec:")); + } else if (strstart(uri, "rdma:", NULL) && + !inet_parse(isock, uri + strlen("rdma:"), errp)) { + addrs->transport = MIGRATE_TRANSPORT_RDMA; + addrs->u.rdma.data = isock; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addrs->transport = MIGRATE_TRANSPORT_SOCKET; + saddr = socket_parse(uri, &local_err); + addrs->u.socket.data = saddr; + } + + val->channeltype = MIGRATE_CHANNEL_TYPE_MAIN; + val->addr = addrs; + *channel = val; + + if (local_err) { + error_propagate(errp, local_err); + return false; + } + + return true; +} + static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p = NULL; @@ -2469,7 +2508,8 @@ void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, { Error *local_err = NULL; MigrationState *s = migrate_get_current(); - const char *p = NULL; + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); if (!migrate_prepare(s, has_blk && blk, has_inc && inc, has_resume && resume, errp)) { @@ -2490,22 +2530,29 @@ void qmp_migrate(const char *uri, MigrateChannel *channel, bool has_blk, error_setg(errp, "uri and channels options should be" "mutually exclusive"); return; + } else if (uri && !migrate_uri_parse(uri, &channel, &local_err)) { + error_setg(errp, "Error parsing uri"); + return; } migrate_protocol_allow_multi_channels(false); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multi_channels(true); - socket_start_outgoing_migration(s, p ? p : uri, &local_err); -#ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_outgoing_migration(s, p, &local_err); -#endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_outgoing_migration(s, p, &local_err); - } else if (strstart(uri, "fd:", &p)) { - fd_start_outgoing_migration(s, p, &local_err); + addrs = channel->addr; + saddr = channel->addr->u.socket.data; + if (addrs->transport == MIGRATE_TRANSPORT_SOCKET) { + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + migrate_protocol_allow_multi_channels(true); + socket_start_outgoing_migration(s, saddr, &local_err); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); + } + #ifdef CONFIG_RDMA + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_outgoing_migration(s, addrs->u.rdma.data, &local_err); + #endif + } else if (addrs->transport == MIGRATE_TRANSPORT_EXEC) { + exec_start_outgoing_migration(s, addrs->u.exec.data, &local_err); } else { if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); diff --git a/migration/rdma.c b/migration/rdma.c index 288eadc2d2..48f49add6f 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -316,7 +316,6 @@ typedef struct RDMALocalBlocks { typedef struct RDMAContext { char *host; int port; - char *host_port; RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; @@ -2449,9 +2448,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->channel = NULL; } g_free(rdma->host); - g_free(rdma->host_port); rdma->host = NULL; - rdma->host_port = NULL; } @@ -2733,28 +2730,17 @@ static void qemu_rdma_return_path_dest_init(RDMAContext *rdma_return_path, rdma_return_path->is_return_path = true; } -static void *qemu_rdma_data_init(const char *host_port, Error **errp) +static void *qemu_rdma_data_init(InetSocketAddress *saddr, Error **errp) { RDMAContext *rdma = NULL; - InetSocketAddress *addr; - if (host_port) { + if (saddr) { rdma = g_new0(RDMAContext, 1); rdma->current_index = -1; rdma->current_chunk = -1; - addr = g_new(InetSocketAddress, 1); - if (!inet_parse(addr, host_port, NULL)) { - rdma->port = atoi(addr->port); - rdma->host = g_strdup(addr->host); - rdma->host_port = g_strdup(host_port); - } else { - ERROR(errp, "bad RDMA migration address '%s'", host_port); - g_free(rdma); - rdma = NULL; - } - - qapi_free_InetSocketAddress(addr); + rdma->host = g_strdup(saddr->host); + rdma->port = atoi(saddr->port); } return rdma; @@ -3354,6 +3340,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) .private_data_len = sizeof(cap), }; RDMAContext *rdma_return_path = NULL; + InetSocketAddress *isock = g_new0(InetSocketAddress, 1); struct rdma_cm_event *cm_event; struct ibv_context *verbs; int ret = -EINVAL; @@ -4152,14 +4139,13 @@ err: error_propagate(errp, local_err); if (rdma) { g_free(rdma->host); - g_free(rdma->host_port); } g_free(rdma); g_free(rdma_return_path); } void rdma_start_outgoing_migration(void *opaque, - const char *host_port, Error **errp) + InetSocketAddress *addr, Error **errp) { MigrationState *s = opaque; RDMAContext *rdma_return_path = NULL; @@ -4172,7 +4158,7 @@ void rdma_start_outgoing_migration(void *opaque, return; } - rdma = qemu_rdma_data_init(host_port, errp); + rdma = qemu_rdma_data_init(addr, errp); if (rdma == NULL) { goto err; } @@ -4193,7 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque, /* RDMA postcopy need a separate queue pair for return path */ if (migrate_postcopy()) { - rdma_return_path = qemu_rdma_data_init(host_port, errp); + rdma_return_path = qemu_rdma_data_init(addr, errp); if (rdma_return_path == NULL) { goto return_path_err; diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..8d9978e1a9 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -13,11 +13,12 @@ * later. See the COPYING file in the top-level directory. * */ +#include "io/channel-socket.h" #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H -void rdma_start_outgoing_migration(void *opaque, const char *host_port, +void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *addr, Error **errp); void rdma_start_incoming_migration(const char *host_port, Error **errp); diff --git a/migration/socket.c b/migration/socket.c index e6fdf3c5e1..c751e0bfc1 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -27,6 +27,8 @@ #include "io/net-listener.h" #include "trace.h" #include "postcopy-ram.h" +#include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" struct SocketOutgoingArgs { SocketAddress *saddr; @@ -107,19 +109,20 @@ out: object_unref(OBJECT(sioc)); } -static void -socket_start_outgoing_migration_internal(MigrationState *s, +void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); + SocketAddress *addr = g_new0(SocketAddress, 1); + addr = QAPI_CLONE(SocketAddress, saddr); data->s = s; /* in case previous migration leaked it */ qapi_free_SocketAddress(outgoing_args.saddr); - outgoing_args.saddr = saddr; + outgoing_args.saddr = addr; if (saddr->type == SOCKET_ADDRESS_TYPE_INET) { data->hostname = g_strdup(saddr->u.inet.host); @@ -134,18 +137,6 @@ socket_start_outgoing_migration_internal(MigrationState *s, NULL); } -void socket_start_outgoing_migration(MigrationState *s, - const char *str, - Error **errp) -{ - Error *err = NULL; - SocketAddress *saddr = socket_parse(str, &err); - if (!err) { - socket_start_outgoing_migration_internal(s, saddr, &err); - } - error_propagate(errp, err); -} - static void socket_accept_incoming_migration(QIONetListener *listener, QIOChannelSocket *cioc, gpointer opaque) diff --git a/migration/socket.h b/migration/socket.h index dc54df4e6c..95c9c166ec 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -19,6 +19,7 @@ #include "io/channel.h" #include "io/task.h" +#include "io/channel-socket.h" void socket_send_channel_create(QIOTaskFunc f, void *data); QIOChannel *socket_send_channel_create_sync(Error **errp); @@ -26,6 +27,6 @@ int socket_send_channel_destroy(QIOChannel *send); void socket_start_incoming_migration(const char *str, Error **errp); -void socket_start_outgoing_migration(MigrationState *s, const char *str, +void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp); #endif From patchwork Thu Feb 9 10:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134322 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 DBAB5C636D4 for ; Thu, 9 Feb 2023 10:29:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4AL-0001Ho-MK; Thu, 09 Feb 2023 05:28:33 -0500 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 1pQ4AK-0001H3-0v for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:32 -0500 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 1pQ4AI-000826-2T for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:31 -0500 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3199XZqY011953; Thu, 9 Feb 2023 02:28:28 -0800 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=XYuRnqNsWaFupJOKLVWGRv1hBizyGcRWUh0aINerM1g=; b=nvOK2gTOEcKj+X2BsqdU83O3fQiKOQM6KoribadMfxhWSiLWTzrDvBYLfLF5n9snjDl5 mXvc5xvEgQap1s/dEsboXy0xBT6iUxAkQsmXizPqfckO5Sh3olvxz4NbB5H5geOKrqDh aHa13X9Nszb+C/+4kMVCwTLYgX1QQ9rkVlEf0p4TIeS/hXp88J/uWrima1bj6aiIlSxP v2hPUrY89VEQabPYl3fDVGlpWqKIZjPL0SRZSGq9/tA1tUgx6uJ99PlCRh3hV7Ab+OZI 6loOLBFwLdqwJYcT9jjxwA808k2Q6Irl8CzBCyUmgwaBaJwcftMrDcBZO8XqqG342syc tw== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqt4q2ua-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=odSmWCyzGAcaLv8SjZQfKafzobgGbwkfqrmN6JAPeYbVbTVR1XHpWdW1nkJKvF+jJCCEe52rJbX1StI4m7sS8sUa2UXMJ1t205sEUfopB8wNY72lk9FXHYT4xEsnbyA8D/3GUd8HpMLJSidawtvW+RtpDct3k0Wr1npzw9nY2+0COk5IXCBmYlfp5lZ3BlibRx1HOVnKZI8YGlmTkIAmwL/vozJtc0qldKruoESo6o4repqq2yQBMMJoEnA4Mn4U1TcxX6UXcwgsr22AY3gzTFiQ4TSQDA5dnLR3QchBalwsDX/8YjaBkk+WkR4ZSnJ8s8q6fVqcWdTnnXvIFPtREg== 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=XYuRnqNsWaFupJOKLVWGRv1hBizyGcRWUh0aINerM1g=; b=gM5TAZpuMBuJaF8p2PcDMjuWZZh9AeQ1MzJLopFpNsXYfp/J9geGYvqNIWdq6dxFSbLM94/J9udSkj/IeK0uKvtONjMwdQWltGcCccBeAydCxJMze8bBQcDX28R/lmIs2KrKIDrOFql4+wUe+x2daD7BdYt38T/DN6VbSao62FC/UWa8hrmyt169JKGtwOr/o6nvj2wg1pYcR01dpg8li2/t1ZHj4NV5CVhDyBU3Cn/IaSwdWMZ6FMfgVw2VlTo7amaZn/vzOVHHdRqg/Z6VDzVszC4Dwb2DYySk7QeKZTcASEVjIUKITVkndKpSMHYl4qeCAKeKL6dUUytBlb/Aqw== 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=XYuRnqNsWaFupJOKLVWGRv1hBizyGcRWUh0aINerM1g=; b=VFezrBMSasMOyIaE92drmiNaydn0hcQWtaldaoawLWhnB91RTganPMD4kqinjImZTo482BXF21/GsaAsBVTo2xs1eXH99KtzbdUGFL6j2RE2zHge+oPL0juW3J6BladZzJkK4ag68jVj4e0Vqlh+YYWCqmqbHmy3Uv+A8FSL1kMXdW8ynkmStwOAbhSffqu0fcjoC2V3UWZZUeHSd5Qz/7HcYMTmBlxiWYt6RnsKDcumbzDfUtERB9f5ZrYr80CJvC/zk/IyHXLdD0XXwwntQ46DDEXIkYhDlc6+6UCVpIDldBsjrSoR+Aw5PrqcVd7Sj9pmARZechkFjsUrQYj40w== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DS0PR02MB8928.namprd02.prod.outlook.com (2603:10b6:8:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Thu, 9 Feb 2023 10:28:09 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:08 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 5/6] migration: Modified 'migrate-incoming' QAPI and HMP side changes on the destination interface. Date: Thu, 9 Feb 2023 10:27:53 +0000 Message-Id: <20230209102754.81578-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DS0PR02MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: daad27ad-463e-442e-0322-08db0a88567b 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: vLycKp1X/+ii+3GljleTrgdYpYC+MrJCUXsNnT4r/lRtS01VELrDjSzHT4gOPtI1mOYTW0jzZ1+XRA9RTkZiO3mblfFUC5fUKkGiGZDIpRq4MxC+wmzMa73uwfqQ+HMK9BOBY0wxYlpSnbomrcYAkRKe2kHR2r816EiL+udhbgT5UAvimCIlBz0KaiDVqaO3znMYCFHXxglBpfMj+JF29W3xZurTGri6N58qhwdhsvlhpThk64x3g9PJvoaR4ezNbsjuCy3JwfBz119YjPnHksh5qEiF+Cl8gYb01Th/KI/SbDrVBirblFRigpeYToOCb5yZTUwbQJ3m6CEk+/RDADQci+uzP+9QVLjfAPcpKer061W+GktazrzoEIWBfd8smbCOVvkqrJ0nXpv6yDKfIhapCdf9s6RevzN9WXsz2U2sBqVitxbD90natbJ8FB8iP8l/1NMmnafxZ3nYOF+CYEf8EwigpwTYLQHN6ky0paqCmNSLShpk8fNslXFybJMcSYl9ixVBWn9Izd82ev6TnOnqhUuaF8WmHaH9Cn7u8FCdYVPTvskrJI8rpEthL3z+oENlLzVR6cJJl/h5xXQ5LKa2ZMt2PffQxsRw/bl5AhnMB5VnhzAFpLshLZD+9EGLHi6cJo3xGTh9rm9CdjO/0pzXKS8Gpgbl0rcpU1v5GcwFqBwX0JBT48axKzGCn8rLKcxq99txHM4CwwJtKDYZgw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(136003)(376002)(346002)(39860400002)(366004)(451199018)(36756003)(66476007)(38350700002)(83380400001)(38100700002)(8676002)(4326008)(66556008)(66946007)(26005)(6512007)(316002)(6486002)(6666004)(107886003)(1076003)(6506007)(5660300002)(186003)(44832011)(86362001)(478600001)(41300700001)(52116002)(8936002)(6916009)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9jY7U1hDMuJxNuA8DQDcHPqV8AoPsOMd5hKWGaOch86Exsz3V2kmDAYTgyonkeYMRMpe/z6Tg2LHsPazLOjsPlKgF7DLKQ8ftSLL/BiZloLxR9Dmsj0ggU7/BLwf6fD6kHwT8Q5MNs9V/zIj1a6qrJlZAtYgcfqKVb4f0Ipwr+xAKFeGrSI2vo0nO3h4O8w0X44b9XRkSWQzGpfsuOsNpB3IJ7qc6sHBp2BzJYpYhjU3Hxn3m2vWDxLpkADqz9IcnLzKXP2ABdjPbyMCC5Unsz7R8YL8pJXTOUjNBzqPwhyBgqT/vGORciyfoND9c/X+gf07znYJQhVBaTY5C7atXvHn7nn30J/g9BEae8Cu3Fo7ezx+HeCH73cljRsNbGiNfm+Rsh/N2BrvtHexzs3k5hvJxU9IAZ6TPSGqmMlv3q+H4i+jKluguHpCW7SIHkaYnA4Xgn19WYiGQZgfoQcyYPbw6VrhiQB/4pMznQQe/zP4fzs4xuuHB/ZWKqgEJK1rXhEH0i55q2B5OsXg1PYXb33gNlNQ4qNfYdwTFu5Qwdla6AFICy1VO+52rCR2p4Yz7ySLNNVblWP3+9PzOp7N3WxkZ196BbE16quVkXAQOx9kUE6h+vlnExh6dBKN3NbVCO918LRAGqm45TNWoy1ARGPjI34eFKHCds5cepT0dfqI4BbFHhb6D9HGm0jEXMQo1+1vENsJ2G4l8/+e4fy140QUui0X33DdIj+xRp1YYI//9ZucBCJuFIsw+y+2NSkQDgVXY4cJDkn9FIFy6baTbGc3ljxZr3SIyIFA7yKajkqfLPKjnDGGfstlYXRx5u+CS4sxov4Jge+JvPZMae2KWa+8ZZZ1wq7J8wbzF6lvFoOqv3OKskIGRHc+4fbjVkdcuvye1/8fdCPXcABLEJUpnHvCYe2BdT3pARk06zYBYuvh5JzAqnyTRN45JdHmHnGvwILDMWNNBkpFAkVi5n9Zpk/wQFFikUC+nPuBJkbYw/b82r3fi3qma9xvlVBJYFGYxAuJZIECkxkeGEatxMF5P0uLLdNs96s4OUtiV4LA6i+wx2BWJLqtWi9TGz7jQlKtU97KkZxHbJ53uQQ1Zdu8RQfqSdnwUuPyv3LC15F5aWjXnsHBubKKjZxCh4Pr1qiu1JYKoMAJ54crg2tbxngzvdxWV0mR46EFD5zuOYVFVWV5jmoDXxfa8ewVg7gZLSdylrgbNSrX4dHRWEn3Yx/i9eceUWw+TnTen4LXhCFMIZG3cjutLpeDZxaOUx4PCo0CmJcwwfjD8biGPjs5q6y5OJY80R2QACoKbwh0oujdcNjx92hsHCQu9iqG/d89kif2xeNGAk94SLqmrBQ4kMCTGrktAuK9GCXY1jkLlYbXJ3vI0B16W6phP+H7+kHoH+DgI5ZKXBg5L3kEVBpsTZ8I9XZtZuetUln1c/hFzXPTARoTbKud1T+QZF02GF4Q9kmctc5Fe+K17Elw+I8kPSveEo1sxT9YTadvU69ElTneFRo+Nk7NL4nli1gYseWyJaE5v0X5DHV+yO3ylUrwbrdqKNfTuNsXoZUC7KIHwaAuTyaIZjq442RjSI+hMHil8x4CVoVqoawCRAuCBNBfCii8yQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: daad27ad-463e-442e-0322-08db0a88567b X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:08.7820 (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: Dfyg9W17a8hoMwyM0L2AbC039daBRDgjbBBfilRAXuMK/15Lruce5ZVvMkwAi1wNq2mrsYjaRxweVXWvVF4Wuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB8928 X-Proofpoint-ORIG-GUID: 5cZf0B0ViffwVe_JsdDHAbEMh7ma0oHm X-Proofpoint-GUID: 5cZf0B0ViffwVe_JsdDHAbEMh7ma0oHm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_08,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@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 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 'migrate-incoming' QAPI design have been modified into well-defined MigrateChannel struct to prevent multiple encoding of uri strings on the destination side.'uri' parameter is kept for backward compatibility. Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/migration-hmp-cmds.c | 8 +++++++- migration/migration.c | 3 ++- qapi/migration.json | 24 +++++++++++++++++++++--- softmmu/vl.c | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 1005a9e1ca..1ab3375e9e 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -500,8 +500,14 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) Error *err = NULL; const char *uri = qdict_get_str(qdict, "uri"); - qmp_migrate_incoming(uri, &err); + MigrateChannel *channel = g_new0(MigrateChannel, 1); + if (!migrate_channel_from_qdict(&channel, qdict, &err)) { + error_setg(&err, "error in retrieving channel from qdict"); + return; + } + qmp_migrate_incoming(uri, channel, &err); + qapi_free_MigrateChannel(channel); hmp_handle_error(mon, err); } diff --git a/migration/migration.c b/migration/migration.c index 91f00795d4..5fbf252243 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2314,7 +2314,8 @@ void migrate_del_blocker(Error *reason) migration_blockers = g_slist_remove(migration_blockers, reason); } -void qmp_migrate_incoming(const char *uri, Error **errp) +void qmp_migrate_incoming(const char *uri, MigrateChannel *channel, + Error **errp) { Error *local_err = NULL; static bool once = true; diff --git a/qapi/migration.json b/qapi/migration.json index 261a6770e7..d43265965c 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1621,11 +1621,15 @@ # with -incoming defer # # @uri: The Uniform Resource Identifier identifying the source or -# address to listen on +# the address to listen on +# +# @channel: Struct containing migration channel type, along with +# all the details of the destination interface required +# for the address to listen on for migration stream. # # Returns: nothing on success # -# Since: 2.3 +# Since: 8.0 # # Notes: # @@ -1638,14 +1642,28 @@ # # 3. The uri format is the same as for -incoming # +# 4. The 'uri' and 'channel' arguments are mutually exclusive; exactly one +# of the two should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } # +# -> { "execute": "migrate-incoming", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "socket", +# "data": { "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } } } } +# <- { "return": {} } +# ## -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } } +{ 'command': 'migrate-incoming', + 'data': {'*uri': 'str', + '*channel': 'MigrateChannel'} } ## # @xen-save-devices-state: diff --git a/softmmu/vl.c b/softmmu/vl.c index b2ee3fee3f..579ed59023 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2614,7 +2614,7 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err = NULL; if (strcmp(incoming, "defer") != 0) { - qmp_migrate_incoming(incoming, &local_err); + qmp_migrate_incoming(incoming, NULL, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); From patchwork Thu Feb 9 10:27:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13134324 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 1CA5BC05027 for ; Thu, 9 Feb 2023 10:29:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ4AN-0001IZ-9o; Thu, 09 Feb 2023 05:28:35 -0500 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 1pQ4AL-0001I0-Qm for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:33 -0500 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 1pQ4AI-000829-ID for qemu-devel@nongnu.org; Thu, 09 Feb 2023 05:28:33 -0500 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3199XZqZ011953; Thu, 9 Feb 2023 02:28:29 -0800 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=wLPpiTFcgN4z3g3sBmnlbvJ95oOaTzb4FGwEmE/cT5I=; b=uwgsq9w5E5rmnV8DXbI6gPlqGGfqYZcIIBI/cyo9qWjqP/cT95t+fxYRHVhf1myECpOn H/1rKqPhc0SgFmy4pnmYI/h9NbKXV7JXJTAyqQNWa98kmZp+q9iMYYMKRJqoSkm08yHK EHdZ4tLmCyjEQHr9c+LbGG8MkXvXHjPYgadLxnXBtb6FNs4iY7nlb4K0Q4RrfxJ77IzW QACgO5WAv1+H3mAlQZTs8t4DpG8eK54O2b3EiW/+yL40xwm9je/cNoAXE0LBOUFnh3T+ nNPi9i6h8Zur0u9MfftpRiEy1at3qDN0T6YEhpWE8CIv2w5Krc20yA4NTp7Hy94AsgyU Pw== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhqt4q2ua-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Feb 2023 02:28:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PfY0ViZVC2yILxfD/dB0/W1zsPzAyPuAdcJv/4Q+LA3sa2dXYVjyQpsL6pxPaO18NEbdmNtg3I/5doYF6LzG04ItxzjkPY7jx16zN6Ve+4O3Fnpk/+rjCgpRdm+mqjT7qOBZO1oG0WVVq7LRFx2YMKcQH/3PZ/Ii2a8uvagGtFgzwdqiTXz3WCRWCCs2YJnw4fBY5fGLd1814K4CfeQli538fFeQkFyq65B5pmSnauzmQrc15N/5L4MdeKLfqkrl+1LbaWwbJOeAHtEQ3OCrVIZm3ScyykLi26eZlyjkkEy2XsF9PNeY+sq46gGXyHk6DQ94cEYCQZFp+r9pRTfbFQ== 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=wLPpiTFcgN4z3g3sBmnlbvJ95oOaTzb4FGwEmE/cT5I=; b=L30eUaFeqpGdDu/gU3ba9zYlLfKgxDNIZNdoB2sXeaPQN2/afwXgWsnlPKPO5xAkTSSMxBTyYc9UDNyEDd5W8I0z2e1ihGif4HZQGca4SO7/nouzJ2YlxVS/qBN5RmFI90CxtSllqpiYh0fAdaGco11p5AyeEZHjkfh5kpP86QuuY4Kp2io+3+xfS2Y35dHywF5zGDLXipBEJsIouplaVaZprpL7fpsGQU+mWNWwDa3wJcKyiA3YZ/nwp7R7LDK0YpW8eqf89wFnHS4p+ZXo5G+XLqhk4IPrqH/qkfNMg82SUC0c0m/+PbifsnOkZvg73C944M5lZgwdoQQsHbKviQ== 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=wLPpiTFcgN4z3g3sBmnlbvJ95oOaTzb4FGwEmE/cT5I=; b=G5zyNBz6T319z/wVtxjgQQxXJ5yXO+IrkjE03Ylud5rZq4bRpQqQW6QfqhDiNAqTRRLNdh/JTA89Ln8gs8YZQIpH39R0tLhofnSd79+7tzD/SyHCCpDPi9L4WcGObG+ReynoUzsVJKk8QsoDOtgES7xLchDrU2HAhkllC9EL/PSzoQ+FKiYv/0aGmQ8IclyWHoKd+OzqclnYyzPvDX34Tb4X4LJdq+4mw+fLuKpJuwabUvrcYwKm78vCO5ABP6X4m4AeIIo8nFSW7Yo07p+g1akHVHgN3r6/q7fJDfkLtx+fmZ9A4ybzNNMUPTyIxpTE3pUmJde517gMrfmU/bjXrw== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by DS0PR02MB8928.namprd02.prod.outlook.com (2603:10b6:8:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Thu, 9 Feb 2023 10:28:10 +0000 Received: from BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac]) by BYAPR02MB4343.namprd02.prod.outlook.com ([fe80::707d:b1c1:e895:94ac%3]) with mapi id 15.20.6064.036; Thu, 9 Feb 2023 10:28:10 +0000 From: Het Gala To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com, armbru@redhat.com, eblake@redhat.com, manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com, Het Gala Subject: [PATCH v3 6/6] migration: Established connection for listener sockets on the dest interface Date: Thu, 9 Feb 2023 10:27:54 +0000 Message-Id: <20230209102754.81578-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230209102754.81578-1-het.gala@nutanix.com> References: <20230209102754.81578-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0123.namprd05.prod.outlook.com (2603:10b6:a03:33d::8) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|DS0PR02MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: a1c7f365-c9fd-4389-906c-08db0a885770 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: wXMcA3wkN/viodUL8cIVfo8vF32tR936NiKqG3QD4SCZ1aM/Ed8lt8M/c4VO+2r8RGYi5GcbE5YCRIxHz4WnB4gjfLTr3PkieUpzBP7InDFTiHtjK7po6EOn0IAba9L64u+5gPneQjkoG/OUd53AnJ6esI73pBZdEquGJWsjlV+ox9ETNRYNQfH8BdvnSu5ubagT+sFjGpVcteN6RI2cxYfbCOeR4+crvl7XQA0Kp1csXSCN4Xm+PhHRYOtqVCTI/uvrxHxWsLICMRaK1MGpCF8TUaTnV/eVyuheSX1/zJysT+nZI9wmi32P7l5E9peKYojftZ5DA5DhXbXatKDWKYxyRyhliqPjBN3bOV6a0MWJCD10GB6gmmpGuzepnUAI9aYKRFBQQuJOjsvlBCtNaS3+mEdiprs744ze1AKMhJ9hG2bAvgFt7VRrvrVBMPd8g0N0ON4NDTRix4lB8yaaaxCC/6LAhJ29cytf6PIJmnSMO58Yd0jMJ9tL2AKiHUBfJEGUfOri57NsCtitsH0EeiPQeAxtnsRIPpzmRMhIimSOcl2/9gmHTDmRoq29URgqJX+ZZBul65iXyvlwiW2Zjt4IyAvw5evNKQvtN8bm/vwo0dVqPqf5lBkdU42YbNLu22nQVEW5qCwv3aXe3S4QaQdCPZCQXw0hy1nb0fb3u37s5a0cKSbA71HL/Oqla+bgU853PSMU1V1CBpJx0RPIeg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR02MB4343.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(136003)(376002)(346002)(39860400002)(366004)(451199018)(36756003)(66476007)(38350700002)(83380400001)(38100700002)(8676002)(4326008)(66556008)(66946007)(26005)(6512007)(316002)(6486002)(6666004)(107886003)(1076003)(6506007)(5660300002)(186003)(44832011)(86362001)(478600001)(41300700001)(52116002)(8936002)(6916009)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eDWxJhyMWE7evRcEYvTfrUqPJ+84rBBqcqj2/4zmRGH/SK9foQ17ilTUjTMG3IwzMmLbNe320+LUTAa8mw9ut7DGvd7pEqQd/w19YtJEi54sPIe8FwC4EWlFV4R5qdU8C7rnyKvA4nKmGYE5OdOPurqET9+J7PTXHU1haH/ZOC1knsRNm4PB4gke/LbVpdOIqtC4LJiI7ooedagiYIsi5HjfhN7fO+pGaKpUMb69mL1dJWl7LSAo8XPO7dXYXdkCmJqhbZhsCQlgEBPjAunI4H9yjh7GyyRa8qYxT8/zP7YFWBsSz7C4wqQFVqqXSDJHdF/RlyiL1zNKPSSPOU5fT6P//w0N/35HTq0EHWyffj+G6cWzbgIQVxpHAgAVFTzf/LDwxgKYuOZ6KR66icYC23YVsmQG/wHsJJyal2rEQ2kRAvu3f6g77P0Utm/0wWR8zuiAbY+tCXsZVK4hbZRPdJkwQaM785+NcezKp/HdMtXqthtpylhyQz0xwSUzBpRateLsKtnpYuScvjYRhxQ90/eS9HGyu1m2cTf+2pmPSIlc3KDNSd8ZmaqWfHfftqeUKdkPpT0JGUxyEem6XdGx92PeCJuVm/I9DvfQwHz6rIezU7BNhBG6qog4rblUa+qwKWZp2SJHIKxaf7de8i5XRNrkb9b2uf6kJyF0dHL+mctyobr2m5d9S1wuyXqlkW0vbOwdQJCWU61fkLHhJ693Ff7DpkmI4LaPYLAQ+WEULD9yktvKdAIeS8uCrRa9KG5VNIIvxbbpXqzOQvo5jBkfMJVcwP4fzGg24vTHhtvFXV9GNkXKxp5Xg5b3HVlWh5TsgPVTdOtrma56pa2CaWG5FHgv1NsP7veIBOG8ztl6NvOFXb715FDcy0c05O5kmXMSB9tuY6wYvL+gtpTmkiCQwgN1areYZIQostEPN8+00+H6W8QnSOp+soCiWmoaFGgadW1spCaIRrcechMcbZ3/HlDt0e1/1dss1p5qtqafheCkx4DDefzH5KE8jzlbhIl5sdPBYDzrDk9R0kfh9/PNiXN5z46DmbbG6IeRpTlerHeraAlktOCB5PAyzc+w3ljzWSk355+59tPeTyB9c17kt81ZuC2MbfU4P/9bxtoT+76lSkZ6USVebHZj1pKPqf5X3IxrODVC3Tzg62FwJcK/Qzokgg7R/bkZisCgf0nDI8IcjYNTnsb1B0Z4As/2ROVSE78Dp8XrAKaNjsiwqvI0KJDPEwUlCurRdrRZTotP72Xn9/KE4z2mk49fkTHJCUPcZAZJwTnkYhXs4gSXrNfHOoLj1n3TlRAg5hcihyM5gSrRxt3R+voJvPqijuQ0+QAWebYWFFQgX5wkcOjTd+QvKiOiMgnDpM5Wt1MmxSeVOn85jTpoCuWQUiF+alSgk61ld+FoA5PBMHj9b4H3/oBc/stiy+qXOOVxqmilp1Kk9NQiU3BLtQlgMS1/x1RF7Lp11iOnt6diQW0z18kKo2iKwRGM/At5sFMqlBGOwLqyoMcHPf+RLDmEJaVpCMnAr4WzLJib4t3JDJhSn75RkawcDfbPoZpgD5mEIyaiOm8Vp+uWCLpshFh0zFjqxPn06nI2IHNC2DDrCTHB61LItZY/lA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1c7f365-c9fd-4389-906c-08db0a885770 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 10:28:10.3913 (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: GSN++Oo3aFgcNgn+WoigOl8W8z1ifT7a2gctczCCFCuC7Uj38pHxlRYL4Ggt692LspmCRnp10KU8qZfTPKDfXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB8928 X-Proofpoint-ORIG-GUID: t_x6l7zaYQ5yogqwt67rUYQTlox6gD7f X-Proofpoint-GUID: t_x6l7zaYQ5yogqwt67rUYQTlox6gD7f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-09_08,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=het.gala@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 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 Modified 'migrate-incoming' QAPI design supports MigrateChannel parameters. This well-defined struct replaces uri string to prevent multiple encodings. (uri paramter is kept for backward compatibility). socket_start_incoming_migration() has been deprecated and socket_start_incoming_migration_internal() name has been replaced with socket_outgoing_migration(). qemu_uri_parsing() has been used to populate the migration parameters in MigrateChannel struct. Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- migration/exec.c | 7 +++--- migration/exec.h | 2 +- migration/migration.c | 51 +++++++++++++++++++++++++++++-------------- migration/rdma.c | 9 +++++--- migration/rdma.h | 2 +- migration/socket.c | 16 ++------------ migration/socket.h | 2 +- 7 files changed, 50 insertions(+), 39 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 4fa9819792..8506ad7f18 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -77,12 +77,13 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc, return G_SOURCE_REMOVE; } -void exec_start_incoming_migration(const char *command, Error **errp) +void exec_start_incoming_migration(strList *command, Error **errp) { QIOChannel *ioc; - const char *argv[] = { "/bin/sh", "-c", command, NULL }; + const char *argv[4]; + init_exec_array(command, argv, errp); - trace_migration_exec_incoming(command); + trace_migration_exec_incoming(argv[2]); ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, O_RDWR, errp)); diff --git a/migration/exec.h b/migration/exec.h index 5b39ba6cbb..5335f7c24a 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -21,7 +21,7 @@ #define QEMU_MIGRATION_EXEC_H void init_exec_array(strList *command, const char *argv[], Error **errp); -void exec_start_incoming_migration(const char *host_port, Error **errp); +void exec_start_incoming_migration(strList *host_port, Error **errp); void exec_start_outgoing_migration(MigrationState *s, strList *host_port, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index 5fbf252243..35d5e1e72d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -528,27 +528,46 @@ static bool migrate_uri_parse(const char *uri, return true; } -static void qemu_start_incoming_migration(const char *uri, Error **errp) +static void qemu_start_incoming_migration(const char *uri, + MigrateChannel *channel, + Error **errp) { - const char *p = NULL; + MigrateAddress *addrs = g_new0(MigrateAddress, 1); + SocketAddress *saddr = g_new0(SocketAddress, 1); + + /* + * Having preliminary checks for uri and channel + */ + if (uri && channel) { + error_setg(errp, "uri and channels options should be used " + "mutually exclusive"); + return; + } else if (uri && !migrate_uri_parse(uri, &channel, errp)) { + error_setg(errp, "Error parsing uri"); + return; + } migrate_protocol_allow_multi_channels(false); /* reset it anyway */ + addrs = channel->addr; + saddr = channel->addr->u.socket.data; qapi_event_send_migration(MIGRATION_STATUS_SETUP); - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - migrate_protocol_allow_multi_channels(true); - socket_start_incoming_migration(p ? p : uri, errp); + if (addrs->transport == MIGRATE_TRANSPORT_SOCKET) { + if (saddr->type == SOCKET_ADDRESS_TYPE_INET || + saddr->type == SOCKET_ADDRESS_TYPE_UNIX || + saddr->type == SOCKET_ADDRESS_TYPE_VSOCK) { + migrate_protocol_allow_multi_channels(true); + socket_start_incoming_migration(saddr, errp); + } else if (saddr->type == SOCKET_ADDRESS_TYPE_FD) { + fd_start_incoming_migration(saddr->u.fd.str, errp); + } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_incoming_migration(p, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_RDMA) { + rdma_start_incoming_migration(addrs->u.rdma.data, errp); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); - } else if (strstart(uri, "fd:", &p)) { - fd_start_incoming_migration(p, errp); + } else if (addrs->transport == MIGRATE_TRANSPORT_EXEC) { + exec_start_incoming_migration(addrs->u.exec.data, errp); } else { - error_setg(errp, "unknown migration protocol: %s", uri); + error_setg(errp, "unknown migration protocol: %i", addrs->transport); } } @@ -2333,7 +2352,7 @@ void qmp_migrate_incoming(const char *uri, MigrateChannel *channel, return; } - qemu_start_incoming_migration(uri, &local_err); + qemu_start_incoming_migration(uri, channel, &local_err); if (local_err) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); @@ -2369,7 +2388,7 @@ void qmp_migrate_recover(const char *uri, Error **errp) * only re-setup the migration stream and poke existing migration * to continue using that newly established channel. */ - qemu_start_incoming_migration(uri, errp); + qemu_start_incoming_migration(uri, NULL, errp); } void qmp_migrate_pause(Error **errp) diff --git a/migration/rdma.c b/migration/rdma.c index 48f49add6f..0225bbaf3c 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3356,12 +3356,15 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } + isock->host = rdma->host; + isock->port = (char *)(intptr_t)rdma->port; + /* * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ if (migrate_postcopy() && !rdma->is_return_path) { - rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL); + rdma_return_path = qemu_rdma_data_init(isock, NULL); if (rdma_return_path == NULL) { rdma_ack_cm_event(cm_event); goto err_rdma_dest_wait; @@ -4093,7 +4096,7 @@ static void rdma_accept_incoming_migration(void *opaque) } } -void rdma_start_incoming_migration(const char *host_port, Error **errp) +void rdma_start_incoming_migration(InetSocketAddress *addr, Error **errp) { int ret; RDMAContext *rdma, *rdma_return_path = NULL; @@ -4107,7 +4110,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp) return; } - rdma = qemu_rdma_data_init(host_port, &local_err); + rdma = qemu_rdma_data_init(addr, &local_err); if (rdma == NULL) { goto err; } diff --git a/migration/rdma.h b/migration/rdma.h index 8d9978e1a9..40673287a7 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -21,6 +21,6 @@ void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *addr, Error **errp); -void rdma_start_incoming_migration(const char *host_port, Error **errp); +void rdma_start_incoming_migration(InetSocketAddress *addr, Error **errp); #endif diff --git a/migration/socket.c b/migration/socket.c index c751e0bfc1..6469d615d6 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -162,9 +162,8 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } -static void -socket_start_incoming_migration_internal(SocketAddress *saddr, - Error **errp) +void socket_start_incoming_migration(SocketAddress *saddr, + Error **errp) { QIONetListener *listener = qio_net_listener_new(); MigrationIncomingState *mis = migration_incoming_get_current(); @@ -202,14 +201,3 @@ socket_start_incoming_migration_internal(SocketAddress *saddr, qapi_free_SocketAddress(address); } } - -void socket_start_incoming_migration(const char *str, Error **errp) -{ - Error *err = NULL; - SocketAddress *saddr = socket_parse(str, &err); - if (!err) { - socket_start_incoming_migration_internal(saddr, &err); - } - qapi_free_SocketAddress(saddr); - error_propagate(errp, err); -} diff --git a/migration/socket.h b/migration/socket.h index 95c9c166ec..4769a2bdf9 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -25,7 +25,7 @@ void socket_send_channel_create(QIOTaskFunc f, void *data); QIOChannel *socket_send_channel_create_sync(Error **errp); int socket_send_channel_destroy(QIOChannel *send); -void socket_start_incoming_migration(const char *str, Error **errp); +void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp);