From patchwork Wed Feb 8 09:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132724 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 1B4C7C05027 for ; Wed, 8 Feb 2023 09:36:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsG-00071o-RY; Wed, 08 Feb 2023 04:36:20 -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 1pPgsE-000717-7i for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:18 -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 1pPgsC-0005Hm-4W for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:17 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3185T1sX025574; Wed, 8 Feb 2023 01:36:14 -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=kEhVrWVNt9KY6tJ8n0QFQXWYy1yZ9d2S10NdvpApDlQ=; b=hD0PdiuzFpoalTY2K7EfFqRosTyNDPVCRS01v87fgX01arGffMiSfrYQAB1My2JAMLBw SJCNduUr7rdF5IrJ9SarFHrRgBStUo/vCk/tPJnWgOU6v4bZcj67tIQChjPkAbqmGxrF cfTbLJfvzCAMRs+sJCUDhYXF/dA1yhiJVOLDz0j7NXGe7rYLcn9bX7NtEv9t4Z9/zySp hrS1XeDx+eOBS4pfSrMIhsjarn8z6vKAuPpE2PeRZ/y23xFjXxBhFezwrY9UK3DrcK5b r4RFGAD3nll3oU7ud3uqH0U6IPfN4uL7sB3Rs3d7jTD8d824/f6cWW90KQI6WY90mnhb 9A== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhmk1bt2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:14 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ExMMsttDrpEdRexpxsIXyCGEUF7/am6pFmXDFcW0ru7ZwqGyPRgetZdKLIRfmlxRWqRyatXoqKB8/Z2DywUf8fGvWm3iZHx4Ibgy/rtPBhrdtReId+Oa2U1KL1lHlIdcVdfH924x6suSmPQHdtaR0ITqpzJWMAPwJFIcxL8OhXuMNuDKufo43Wio5BtdnAqX9qmdzGXUWYUj4Tm2nL22eTqjKID/5rAj3FnruC/d0lVpSp+Os4TyMrPjWTBXcmayz/2Q5lE5pbLpL2qp4m47KQNPRjha0HJ/6Gs5Rh7IwF6UzXx7IqRSxY15i16JH5yz00JTTD3HscVyc0PbUngl9g== 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=kEhVrWVNt9KY6tJ8n0QFQXWYy1yZ9d2S10NdvpApDlQ=; b=VSmb/j/qctfOXBDJKTApQZ+c+3uE6A6y9QNNWg8jsBGKnhz6NhSOukESa+k4Dm7Etykb8/vvzSzeyIbOgGfYJyqaCsJuB0KB32zGZDq5Vdq6geCPUJ1llAeo+DaZvV1CnB+39XYZdovQblaWFcXt96uBmEWl/FoDqlMNJgpkaNjYrplay8B756dhjzczDpwx13ETaVp30fKgXU7cbU9GP204N/r1kkrJqGneAzxr7DbdPgiJgacYhCyQsyPCwE4o2jBIFOKTToNrq8J//UZa3gvrER/NcNghLCqo+A4Y8/fvvD2XNNo1K87VmL9bHKVhdfRYK5y2bKcLy1Fsp7g3lA== 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=kEhVrWVNt9KY6tJ8n0QFQXWYy1yZ9d2S10NdvpApDlQ=; b=sKQMSsFl3uFEWAlTmpFCIla2lswgqLx7gyEnPc/hz/v67XKlbXnHn4g0MvT4hUESfjEi5p6gZi72gWjAz/LYLVSOR2rkLLZhgaPm0lLyvmFyprfgt1cjnMquTqjtVSpyVNyaswNDyfkuMfYXkaOqtGd2Zz2Rp2bllhkNGoZOG/MXNistnB6nKk9Bd1/nm9tYeTIE4QSwzj/8hYadZCRNxpiY1+dJ+34+B8+CTGQRluCIUJzisQ3EONXpcbRBUHeJF5qq3LNaXUlJxMFi1eQA5E8muhdDnaaHCmRaR7mS0GMXf+qs5WvZEULIxU9fzMAzeU223LnOA+M0RaAuxTEIUA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA1PR02MB8494.namprd02.prod.outlook.com (2603:10b6:806:1f9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 09:36:07 +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; Wed, 8 Feb 2023 09:36:07 +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 v2 1/6] migration: moved hmp_split_at_commma() helper func to qapi-util.c file Date: Wed, 8 Feb 2023 09:35:55 +0000 Message-Id: <20230208093600.242665-2-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA1PR02MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: 5471f5f3-ccbe-4544-7adf-08db09b7e769 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: x2zuVI93VAWqlVMi4cTLWcok2Z3Etm5B1B4e/cGqYVV6vOuLqU+y9lB/jUSuXzKtrH3XMwXRTlffb1HSPIxj5xmUcHuguGGR0gaacNh682WMuutO1uFoKMXyu5c/KeE6lyzmio9tguM/W8uBu9/x9mi1PFRzk7STDCciJxpFsyUglwm7AArQVWNDnVxaVJ7Wp356At1fGZVK6+SvPgFKrw7wzI4FIDxznhZrf/hI9ti5X6PExcsGg3Nzz81zQax4nv4pRUJpWilStPOM0rUzAt9Qk0vTbEHyHNY4ZJSU/5hHrB2tLVODcE3iDkBAFATOv2TCBrYqxhjgCPAY+/RY1nK7KAqsJTYWY6b8gpDAAhA4SWsQUHNYpbRU8CL2OLJ6vro9rO5PkkzXH3aCdqnQHjZhZN2EqD3Hi7z2XWJ9yFJy7fzW6HRwsWq8putQSZQRLVfrcofJt6HaqamP164Hlw52cI4wa3BDqi9BAE8gO5MlyUUWU8F1KrmKuvpESRz561aO3g+ecJdBwcFUhwdz4ypp21+iTiO9QT8aeZCj4gHrVvSHv46KobLrV6MSPFtGf3pOnkKD0f0cWOaT5eBvDrTdL8l1AUYMo5SOaeMlwNQfJqCQ6/inpzmME0Rjv+7REsOX1BjGf3EGHBUe/ndot1b2b0F5ZvtJM0jfGFdXC2IHnvxpY6x0/54f+X3/xKtVyeRR3VitefAvITXLs5VOOQ== 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)(346002)(396003)(136003)(366004)(39860400002)(376002)(451199018)(6506007)(1076003)(6512007)(36756003)(26005)(186003)(52116002)(6486002)(478600001)(6666004)(107886003)(8936002)(5660300002)(4326008)(6916009)(66556008)(66476007)(8676002)(66946007)(38350700002)(41300700001)(38100700002)(2616005)(2906002)(86362001)(316002)(44832011)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sMEHgAtz/a+vRqkUhLW6KrxHWmkOR0AfWk4SbCe78NDUwb7irTzJbVB+ER1HLKHq/lH2lo+KDaTGOA1i+RNgKnSf04Y3GTjwZCsdh1sP8AzXYy2jtrCw9UkZ+BPkMQ5MFt5HG2vpFQYSHR3xhVCN429W4qn6jBjx0Chd5fLKmrd05w3TjB2l5L2fKtUpyX0iXKyyuybHJdho3hQOXLiE2/qFt8sSeeznH5WISMCN++/+hqjf2CrFE2GKBtr4ISOLhB6HVl7hkovexxyWHB1yQRuS6EXxOsWmQdZCVjMrhVMwmvdamRAGMzmQgqEd+FCOXmn+tYBtLQK24w79OT4ac7eHouQidyZu5nnJB4OsHrOrGmv5KDsrl+tmhhMCd64ySKzwIh6Ul//USCIGgnUMZ/RwqOSd1A+pzqh9yZt9vLLdCz9gojqJGN3QrRfZHY5bBamaKgblCvJhvkxegL1nzIc1fE06ku7lEoEOHs6NbmbK6nBy3eYGb8O+1cQUxDjUsbWrV48t57cxnID7ZBoGshtIltEf4Q22BOKNP6GXm7q3kqtlQbM87FUP7eEzKTRHICOzQ3CiOK3BIFG8CsKErUjySzEfW7fSgxU3g9cchaus+W6sLNtHB65dBeEoJcIa7Ri7XxiRAfxBKmoki8/88mlDnB2WExaIQL48QmR5iHHVV+/hQ+jHaH9tVDRLWQmDhoEv/4EnM4QL2JOB84VECmiJRhv1HdTxKWsA/G6QYkFRUPOZubkggdITDQPPvrogmVDPX0Nfi8AEuUFS8RSscagaDu71PsN7hrftdPuUgCwD726TIuTbf21DBlJEEQXm3+QaaOexZbir8b4nwBwhdIBpGPjOzGDY+MjxNafwWQfH2qXZpgzy05TnSKw1ljV3OJ9YEo6v15QrpOXh65/oObpFvkMnikDyMd9zSuJR6BRZKtgCGv/NVyVXvCtsNPvxmf/RDSETsWqRjOZP897x6VHe/uTfW3mHLtD/25JYDu84vM6RiQkqvcYVvdl4e/SCbL7qlKj78mJgL2LNY2efsdmfHMZ3wuB/qaz431BggEdRMKn6XbhQk3F6j06qNfl9auNejCJJfVFJP7zF7VVwkigNeGh4G7l3YvqTMZh961hAyv9Bzs8dVvoGOlEfhgyfbXPu0GkC1k3P7NLBnKPKyY+P4E+jy4SmN3VVgeHi6HUsObMMIlnrSBb1DCu92osqriItXwaJuuojjkUFMxBklyNMkZ/HRWFfz3SADi1dtKerpQrYMEyhkytXDw2ITjAoEr2lHEpByuSd1avL5RuY4yxyhGFrNPMRVJBJ8mLOQim8KKQ9vp/0ZJPFdqb39tEZPZpgNMXSb2DzgT8bbG1qxwzGtCkGvwnEciCNrNQun4SY/yF0Mx++HmD+kikzKiTz8NgVUXRTohjWLGYnVllFXfLPLKFjX68r/tQjuVH3VCpb39l1Qb5talWj0mW4zWGJQiqasTUvoUuguo8JEj2FSmur6TPnXM9n/ls4h0D18L8XIZJTqcE3g3ixMWxVDvIctitPykLv54Yg13bZPa8x28MYBQI8gTSrtxaz/ooBfvWTsk3FWKoVeLnjnxbGY3UDYZJt/qITwnsbhVGoRhS5mA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5471f5f3-ccbe-4544-7adf-08db09b7e769 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:07.3390 (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: UNtIZueb5AsI9uaB5MGUEzTW0dQwpJIB0IaHo5+SU+j4nq4tfvI7IDivtoUfZWPf/MYwO3iUovzvn2UEfB2yqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8494 X-Proofpoint-GUID: CRnOK8yqqxjXvUWX9ewa-w0gQQ8RTq_P X-Proofpoint-ORIG-GUID: CRnOK8yqqxjXvUWX9ewa-w0gQQ8RTq_P 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-08_03,2023-02-08_01,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 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) Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- 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 Wed Feb 8 09:35:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132725 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 B8D52C636CC for ; Wed, 8 Feb 2023 09:36:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsH-00072F-I3; Wed, 08 Feb 2023 04:36:21 -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 1pPgsE-00071O-Tz for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:18 -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 1pPgsC-0005IL-QC for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:18 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3185T1sY025574; Wed, 8 Feb 2023 01:36:15 -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=41xoZWDfK+i6XbFnsAkK+J3GXv98Y4Pu6X5J0rDyozA=; b=lfmhP5zSC+YDIEcRRl9LW/P1xUiputNh27ktKFjJR2EPh0rwPsyvaioGiaLxj0SkLYMg XBdIOZKtz90pbIg83eCs9qorYz98uutty2F4YfWljLHJAFBom02bJ5SzRyv8Dxru54Sw CIVjmLx0Gw/pf8x7GdSwFE0AhgltONTjQ+FjMfrojTlTUqKO6mtVrwzSyBRQ1B/EteHG 5WK+xxtCsrSMFujLk0O0iEQsD+TO4qHPt/lYjUrr3HYId6MlZDRo9Rkc7FGGacamqLkD tH5RpW/1MEHh+Kp5i7V+37WwJhFA7p1OAuusKk7RweePXnXcul+FVAykRRarPQT6AXnY KQ== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhmk1bt2k-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSePREBnsxWP+k47DhvBQaFX2mIllImZIdDAyDuCDZIQf32RS1KCAhMO5MTB9kKG/SJZmg9GTD/U2czvmo0YXIQKvKb5qtQYCMyrP0QV+m2Rf54kR6w2J49r5U/RLopGb81W5umd+A4TdaXQzwWRhVElznjTFOTC8IlWg4UGshC1Rle9O3/MBS7ssSJ9l9OrAHHGSo3h6jw9xL38nM7b2LQLlZ9YNmBaspmIgMdywdhQgge4GYDMPh6/Ux5+afxiC5CY9dDJ7wFrSunXapvfp1M8lhFcG0mIg3Fnax/IHLstYhLhGK7eiCBJ0I+ZCXW8swCAWjwAWfSoF8jForYeYQ== 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=41xoZWDfK+i6XbFnsAkK+J3GXv98Y4Pu6X5J0rDyozA=; b=KytCHXeR7F3qZYzPIr1nm5ZRTa4J4xxhTph2wdzHnrehfp6OoQSg2QUSzoIUkv3njSj2vfZ32GrfQQ6geY6KZB0OI+SX31d7TPVchFXaFwQNj8Z3IxbRlbkHRC7/ftcNc8UUc/cbpwbN9K4viqKqFtRKAeZIvneda5cUVr15wKKV5aJj0cBTiQ+sk7K0uFsKKWzTvlBBWeha/E6rAU0cQRnk/LiIaqhfebbUAvZD56ZKD/G6ZvjAn17afqQ5BER2+XDZ3VAZDe6dh9Jwqsrl0Ou8rahaewIS57ouofuEjnCz/Tbrq7TF8c6pJz71AMYW1gyaBCtXmBD0cmv3evDBIw== 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=41xoZWDfK+i6XbFnsAkK+J3GXv98Y4Pu6X5J0rDyozA=; b=cNHeIULAJmW6/5JrPDUtPZ6AvYSf2Fjs5SHBELWq8rLCZHG2uMhfokhyE0U64NCfZBdkHpS4yxGBt6iKS+Lxe/sX6r5793AAL16D9ELZ9LLDNheNyLnmD94u2YIG+abX5BYE1M3TYJiciakCwlwDSpUcaJ6MsGHcbwaxFraAmmrI7xGT92noVG9dHfXCuWwRjhOQCeB2M3rbPRzk/A4nQMJnnrCtz+acRpnWIgnTot2HUbY1LlT0X9WuKzB+jTB5f2zdShXQf1NYVpo5NJGp7Mjaxjsj9mNkU5Qry/FRIj+dOwzAmJjK08BjDXrrqM8gL4Gg8+pjRAlQIXjg84XD0g== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA1PR02MB8494.namprd02.prod.outlook.com (2603:10b6:806:1f9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 09:36: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; Wed, 8 Feb 2023 09:36:09 +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 v2 2/6] migration: Updated QAPI format for 'migrate' qemu monitor command Date: Wed, 8 Feb 2023 09:35:56 +0000 Message-Id: <20230208093600.242665-3-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA1PR02MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: f5b37cf4-a6e1-4b65-cb17-08db09b7e882 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: J+hH+wQCkh9eN1Mj9FylXvdpw0JKIYq1BOiRhcCGi2xnG/zPjHhhLmqcAVBbZfEtuH7/Uk/o3iwRUVqhtEMSDJg3Pk4Z6cl7y81Oz+9L+S5hv/DGjY6lLcjH/OPPm1T9Cgc5TvOo4UekYzPXNtiUfK1eBmQWpnuRsb4CF74bTM4o7O29YiLDhriulmubxl7lvhB/IpcOdqt3sUKOfmQsms6bvVUyiK6mFQszA5cRRT/UkYQPVcI6GQE4zkseCMSQkgMalLfCT550T09SihXRcJfvgQRf4+bIczhvNHgx8xV2swH9dmogpy7bfjHi7naS9uF50XEmCzqtIXigUNZvcXL5k1x1nzc58KqIOyxxKMGiRI9WVMzkJKOR7LLYXn0bINxU3i0fM4tr0wob4rF7VuVQcwCpWuKjilzIYHHEDeZrKTzO6yvvxJy0+pnO6qh9svrU81rY3hma5J0lNxcTVlZHMmwCqXvKHM59dTS6TfY/3Q0ltg3AeMqPTlUeM6Qyh41VuiTsq6vSzga30Pw4Gk8E9KpYwADfhIO9FN52z/GVn2oq/7jH35Bx+RAuY3HclcFCGU8tIL34JP+7OPUs1vdpswu2fRgbR1WrdPsX5EwE6WeRrWkuybiNCIjDlZMGmU0oVEcCP1fk3Nc03eEeNFMjEN7ICi0wNaAjX9M4RzjL3lWGVf1ydOC2HoaIqu60pGoOUF6ubPTzrOiNXIgLnw== 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)(346002)(396003)(136003)(366004)(39860400002)(376002)(451199018)(6506007)(1076003)(6512007)(36756003)(26005)(186003)(52116002)(6486002)(478600001)(6666004)(107886003)(8936002)(5660300002)(4326008)(6916009)(66556008)(66476007)(8676002)(66946007)(38350700002)(41300700001)(38100700002)(2616005)(2906002)(86362001)(316002)(44832011)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lf8q3nkK6UvKAVBPmSdj8MtvN+1YJ+nuGJn0sNM2UYmDSQAMig2pQdNZkBA4y4cFHLd+cc3MNQ5kI6r8ETr/A6yGE2plUUcTQgCBwZ6qRqq2Zpv28kl8jWD3Bah5eSx7ShvB7lzLOfZmzMp5piQ4k8wiXeqH4sVAYUz6vYP2LiTOf4ubSktYymvfW/LDJVwbbml1ALJKxFZh8x2PDuCGgbR42FCRvhyOn1SsguUSuGFOWKL7+OKaVXrJeBpfXjFgA+FeeaLvfxN+GHJJWp8A/fQcAWjz8nYTEJMwJiQCzBYGwuq2H1Mt46W4AkZcW9vDmh5dRFB5IFCX2FK4yz2ieRH/ty8yJ8gRqDhScsVrS5Ms/ahgX7MAXgWD7qeZkIqVKFYjziRwnQ/He4q+VfBzwaK6eiJ+V5d0op100g10e70aX4BnwD7eDPd/xRBTN3TOO9IJKEnmlY2YLhHPY6cDaCryLqswI5oTN/OFyuxVpFfRrMHf8ScdncfuNpR5otodSsUXkQG6S22Fsv642Ia3OzGBX0mtkV4PjxbUEzXbOUGKUDP9OlEDl+HAxD9Fkb3q2oz9ZxkeTS7WTnSa/R+H2DdhFtx6mDlLknXqWZgW8f06yjcdJqP7v09ZWP2qOKITJYeVcx566DTCMoedqZfZZsJky3aMGkjvd1DUuLzvhSoEUWCKTYWSgxfS5xAtHsJjnWTOSFLBuLugs//pTDm0hjFO02ad4dIXxNSs+DVt/lFIqRaQhRCRB1yDTzsxToC9IwWyXF6jssWLTWlWZVobHjY6VvDzTfWCj6kIP6oPZM1fDeoFmW0NFsnE0yX7bohqldNApWQbaZuakJWsBHh0H+3ARnS/WdrPyign+069pCi8oZoeZgdEGAx8KT6JzD5TqzPJHyr7zzuKhu5ZSsa7DbCd6zUpKEW56462/1r91TGxYXaTCQa8nup36541I6vfSioZkU6WfKzb3olEI5gbs2pLda0BzGwVgzqlu1/fgo7oIDwQcg1H8khvAO5pWnZRBpxuX5tjcMDyOv3ywh+s2hQsCmN0veNegu04DR11l+9Ea6uFKKcRXtpxsMMn84P98VHnpft10UPxFZkd7mciJokDNmz/G8n9u2KhvXJZW2YfzGuhU6gjeGMgVaw1k+7B/XvJIYtzg8aue8v4pVU+w07LrLAAXv2MaOw2VTZDoOfHfLnxFoSfi8aFjxhl87O3h6if30g5Zj307Fv7R7ZLlwxvMoFs9LGQph0GtWVhV581jLqRTqgCilsI4Z+I1cwPn+YtSi9ufb+hlNGuiejvXmpZ4Y2DIj0lFFa+48rG6yucpst39jnwS+HeaKRPPNUsBH1cQGRiIGVWXDjC48T3V6j+rPXznfvEwQi1BPZUhXPxaJ1hNbLDvrDOvnah0meZc5X9j4b1S9GA1Rk0JHSs7PmKpsM4BlZ2vNyctuoiBOhMjbidGlpsOrTuBgycJ5EtdPb9IUJHe76P0s6E6n/jHLOb6pP4Deqs3Sr553MCxusqQbx8/n1z2E4G+PdKlW3ssqih3nh2u2Xj+5jmoGOV3O3H90j5v0J5vrB7PoQo+SJ/yQCoBX0zirdTLSG60KOqKDuvrK4cNqw5jJ6gGlbGIA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5b37cf4-a6e1-4b65-cb17-08db09b7e882 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:08.9326 (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: WIA3SCjoX2vdEuNoLmTJU2YIR5b327YwtJslEHbL7FWQYnZSikjc2pBUJcxUpKywFhK8PvEzarFRNN6PdRcJuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8494 X-Proofpoint-GUID: ivom8_Rae0JM9T409gOVYFNner4WR3sk X-Proofpoint-ORIG-GUID: ivom8_Rae0JM9T409gOVYFNner4WR3sk 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-08_03,2023-02-08_01,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 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). Suggested-by: Daniel P. Berrange Suggested-by: Manish Mishra Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala --- qapi/migration.json | 131 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 2 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index c84fa10e86..79acfcfe4e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1449,12 +1449,108 @@ ## { '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. +# +# @socket-type: Different type of socket connections. +# +# Since 8.0 +## +{ 'struct': 'MigrateSocketAddr', + 'data': {'socket-type': '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: SocketAddress 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 +1575,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. Both 'uri' and 'channel' arguments, are mutually exclusive but, at least +# one of the two arguments should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } # +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "socket", +# "socket-type": { "type': "inet', +# "host": "10.12.34.9", +# "port": "1050" } } } } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "exec", +# "exec": ["/bin/nc", "-U", +# "/some/sock" ] } } } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "rdma", +# "rdma": { "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 Wed Feb 8 09:35:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132728 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 DD4E1C636CC for ; Wed, 8 Feb 2023 09:37:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsI-00072k-6o; Wed, 08 Feb 2023 04:36:22 -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 1pPgsF-00071a-SV for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:19 -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 1pPgsD-0005Iz-PS for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:19 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3185T1sZ025574; Wed, 8 Feb 2023 01:36:16 -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=h9+eSdSGtTjWLU1eqxxOpysUo2RycZlMq9Gih/PXf7E=; b=pCTRMxLOm8VJoWuUpBVd2pin0LsDm3Mu3s3v4TjzJ2UAXK8uz8dRx1P8tGTpo694oSML BDrd5Ywv6UvLWzsbGxqDZkbxvq1PYs0ZRSvP/yav/QVaAxSihxkHZU6vtPEg5Hgr2j7+ iReXw7Dr+T1vVzULIPnDFT9Y9M2aEsbvtsZ8woy+aMKKsrb9DOj/IHBI2GJ1zMH16xND dC2u1oW9rvTQ6TRi3O1m/B0r3knrev/u8k0vSp9GtREkAp9R7L6QGNVSaL+bABlyJDgL blxBQJxxXoADmLDRYQsaB1zB9j38ZOvGh7qsKxUVbrOz14GC1yhLV42rPKRQnphe8tAU aA== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhmk1bt2k-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S82Tg5E9Uslx5ybzKRRtj6u3t5dxgyInLVFq6dJ8GRZBcm4IckZ61QCx6nAA0yN/dAByFKHjiYSf2x3D4PU7O3HEnCRhce8MrelRR9TIlK5xC6U2dZTksu4awZbjN+JNd4FvXTnMVJcEtNW7B7waY30/gvWVOgSp52UQ6qKcQn3mqvyqOfUWisqCV58lTKaBxCyU8hzrrhCEkMAAbGUsLsEJ5/W+VJlcLlgMbAclFRameAS/9FPc0o4HmAq0XX8h0Ofwc52kzZ/dznIu64llHjFwHmto7xDTOhjZ3TPh7x3gP8yi5M1z3xPNPLR8FNj0TTXnXJ1dXXq0K25rmYfWpA== 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=h9+eSdSGtTjWLU1eqxxOpysUo2RycZlMq9Gih/PXf7E=; b=CO8dDFWy1e5tdX8yrq54OS0wyG8ZJHrPjE4gtJtRSjquvgr9gPAAD2RoVBT8lSxkfe69AKXLlBmWb8XS3rkTOwzjCIATqsXWtNHpUkqmiW5QhfpYzJl05KyS23yxYl22LLBSmvzgKgxdrWqHq9HKHfgWjxNoqnGBc62f1TsBs/DuVSjGQIAAVX9wIkhOWngGPSVmiNxVFsRceHcXXsUeEHt+f5Cpy4faRmD3E3BDJIIvNhFcfNym3JM0cd5GUQo6rIt06rDwEcZRTg/C/kT4q21fhda9DFD4Ha47ICgl7/mdZUYag7ELwkkT4JbE5bc5bc+NxmXJkTYakX598UOKpg== 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=h9+eSdSGtTjWLU1eqxxOpysUo2RycZlMq9Gih/PXf7E=; b=bot8TYsZ00vuRR4jZ2qgaT2sh6dwz+Kvbl6TzUYHOi2Cztc2V4OcPInVput7dCEr4gqeXtoVU2gIjOBYOFqS1nD4nEaEZX0CRkv8UT0c8NfA4dgO6JQQnw3NhPCL7ZYsBHMFK+SZs0x9sI/qxLOYpwJrbpD9syIdb5xOVOh6QnNlCn3zZ3UQLcRBjx35bDLkyQhqDhdQK3RuohIEjRrnoGBEuarneStipGjH/CX6KH7TLpw3JNx+ghcue1HQcR7FQlY9JfZFcpXMQmbsPw+qElV96eFwDVhEObP7tOUqnHwynOHdBYzyWFLBmO6Aqjap7WW1p1NPB6yHWxDdMJMb1A== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA1PR02MB8494.namprd02.prod.outlook.com (2603:10b6:806:1f9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 09:36: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; Wed, 8 Feb 2023 09:36: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 v2 3/6] migration: HMP side changes for modified 'migrate' QAPI design Date: Wed, 8 Feb 2023 09:35:57 +0000 Message-Id: <20230208093600.242665-4-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA1PR02MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: b3bf5ece-91b2-4e74-e3f9-08db09b7e962 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: ZvM5kMrlrF3q/QAMTHLF4qqv4R8Wuwrl1lzCMxVi3OTNBPQqMmMz3lLTD7KUQPeRwRcL5xN/MG7E3Epkr+DVDKtXXlLgnyOw5y8/UJHDffko9swYbR6kSy+wQon91FtE1P7U2dxgQ1crWhJQP4KTVZJf3+/MbjM3qMyxS5mJKr3DP6dH9t8Dj1lxdiBJPOF+QzoyATgIGKCoWB9EdUX1xucGy8E7Af2JDRZJ2rqfkVvv9kVmSuEmagCWlCeTrIlmxJRDhdOt5d+UjbhqNF8tt/rXpbjcRglE5J6+WqU3+39kH9/24fHas5AC6w9m+OEFPcItYWIbyzxCb8Wt64T+QTIQTel7Ph5fU6m5rrVnLaaOjmMp4iCtaMO33QDMgDCVVYkc249wS1cuFzjG37ggKYOJKeDR8fa2flATzDKCB16PDzmjvUh0/mQzAAwhK+13l+BtVxRzlqKrK0DQI2k6trZszbwsUJT8f724DXvYW3B5X7smM9FRX27wQ6/FacI691D0RxSLs7n9sDzNm55NVd5/qfvHLaacBg/Ivucd/+BZPCbQc/gEhSIlME/eQwdktuz7Vu4lm+AtWv3dpnYaHqkGK50829sWR/n6b1Z+sHmy5PCAHLZOPFoNzSqq6eaffYjnVeFYKPy7rYmWt8eX5QxelD/ZoUL1LvU26xZ0Uv1p4oc8InUpxF7zT+45pFyLl975e6+TDh35L8Zz9Haq232XFV/EqmUFZAM4GZpwky8= 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)(346002)(396003)(136003)(366004)(39860400002)(376002)(451199018)(6506007)(1076003)(6512007)(36756003)(26005)(186003)(52116002)(6486002)(478600001)(6666004)(107886003)(8936002)(5660300002)(4326008)(6916009)(66556008)(66476007)(8676002)(66946007)(38350700002)(41300700001)(38100700002)(2616005)(2906002)(86362001)(316002)(44832011)(83380400001)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dKtOPmkDBhV0RO5ImGUIpp0w2YlRwyUg3w3psK0Bqd8uawUg3llAAGxzDLZp8NT1Dr0de6HjYFzxJmoAqxzYKaw5bpuImUSRcWlBVoVjLfMrInmvdlRyEBwLEWvixfeIDexMgbZtRHiaHoU8y0c0Mr8u1bVKYrP6pmGiKpPp+Ao5hZEPLcoEtHOUAI7jLbtixQtBtgpujpZ9AO48SwxBeD/QjE57lKl6FYTJBiCkgQfZL3woVkwpXvGiC/XDmDmVy+dBi5lrrF2Xche6VX4/pPdpdqoWrLQRkOE0kFZvbcd6Pq0uvkfkEK6GWkK1ry8Ttn7jMWpLYAdVlD+KebMSP9ZhK83CwVVcAECTFM0PqU06XSi1GNBNL4cRDAPRMPFrz6KSNWT2SDGyFPKCpRdS7wBpw1ResNrYnQt3xnx4Y4IKndUAR87IBHODdqR9hq6BE7mQWbQTG4XTvFwX2yQcE0jxxThwnEfBSdNpjhgwY3Xf5sQ7ukipffFfFk2K11IfrCgrdgR1umAOMYTL+pKkqArlW/309SGDyB5S6oTiDfSoScCeKcTv9XxTOgjODvGky5u2aEoA71HqQVQ4sSgJmAugWTjOjeENRxYhxYNUui/PP+fR6DYUelxgz3hFCUHGEuMGTTNET3OIaDeJW+/EGLD1ZjsCfKpBNEX/qlF6JS93h1+Od6y6oyEmevvNCY9vV01igCwItCt6ws0/ZKH9otYo1KDJpx50MkemnVnGtFEmH6N5aQPJP3n+D4IWCRK4a+mSz9meIRbRO/SauCePyZFNwbdskjmqG+d2/lRX/fmhc8PuauvCl1s2N2RqBoKR+vKs2h9pE2r666zTqon0s2CSeL7lIkCedB1ZN+ZznpnzJ1um74+J8pBI/7knEisNH7IdW04IF0EM6rQ91+fKqZSBxMS8yQOyIjS+zTOtQ7UD+0WzJdngXvQ6O/TORqjMmcWObf4n0Zm3Qdzqmx8ujA0xUgY6/zLrgeed78VyuethwCgkGTfmtl4x/B+IulgkFsyJiAqML+r/8EngZHo2FfnfiU3a82UmpqeiG2GUru29Kvjsfv3PSgeSUzMaQHRGyEN7s7EU9FJLQ0bqDho68oOUkf5qdepo+p/NB3dnmiR5pj+Ju5CI++jgWCq5LPGjTr0jlUBy26TM0sUFKj8hileabOwWnxl/4IM7zaItJkOt8i3K6zkumGXSqBvgPxTv5Xy8noNOThiF0agZ33PSMDK53fgonX8f1rBGU5kvb9iRZkdPzXS5g1TlTFcc77EQA2k7BKwSiDxYU6BJs6gg2lA5sIzv4oX3D2gszuVkQr4+ZeMY5i6reYHgC+L7cF4i2vGeBNB6sfzFfE81BHKQ4SCGdGM7hfxm4aih52CygNy3rlZkTxSKtrNE0FRHItjBX8FN44DH4aaB5vuR8eXvLxAFdxGc6oEkafXubHc3o4x57eVi629mZG/0qW0/07qEXI66M6NnryJldYBbmrDWqihJGL8aUOHZ+uK+iihJd/JUYo3zkbYcPmfitOa4FkAy0acx4WNpf9ZtUDmCKsoC3knkcepfP4Hew/qFstMNBvRNy/3J/Z2JFroZy4zBmBytVK8k6xNXgSI9zw6pFG6OPg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3bf5ece-91b2-4e74-e3f9-08db09b7e962 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:10.4325 (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: rXrN81ytZ92OatZK/5JeZqdQs5JhQFWGpf8euPJMtCXJRlw0loR5bqKOQ8bHuTSTx8nSTQ7UQzgszD1kSRJXEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8494 X-Proofpoint-GUID: Wrd6JJF1HKeqCPqElMYaVja1F5XG5Li7 X-Proofpoint-ORIG-GUID: Wrd6JJF1HKeqCPqElMYaVja1F5XG5Li7 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-08_03,2023-02-08_01,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). 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..a9f65ded7a 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.socket_type = 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 Wed Feb 8 09:35:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132723 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 07BF6C05027 for ; Wed, 8 Feb 2023 09:36:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsJ-00073Q-D8; Wed, 08 Feb 2023 04:36:23 -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 1pPgsG-00071u-V6 for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -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 1pPgsD-0005JZ-Sg for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3185T1sa025574; Wed, 8 Feb 2023 01:36:16 -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=lf9JnwibmmulCmRMdKCBd4ccNAfHi24t7tZq/7JXxIw=; b=hTfjgZxLC4+ez2qJG5jPt4BKU5+yNvybLRI9XyR2Nqnza8+/bT7uHIBkU+Vtlk1ts1+3 FTQsCAb8qfmlrKmYsRBWKro/qaqhZl39mPRjaVWEp7woxP0qw+/w9UnjRWh8HQ30Ci5W TeVRYnt8iJYc7p31oZO5tXUamLLzyHSmCP7HIgI3HLsc4Y74cQmQtXx1CY4JMQ3aYFkw N05TV1GJH5Myt+xAdsjIHEwcuYAMXsIqEnzYUR/PMfPSmD2twb8Qo75fzB+oNn4yY4a8 0/8mUxykaT62+FeRJzsvy6Nz5T7sEmJ19CQlu+fx2v7sDmoDStmaJ2SG0HS+Q2HazIpf cg== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhmk1bt2k-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KMO5SXfwTkE3UpTy5urZDbofIBiWa6IPHBiS4OU23aPaVPOLfA6LD+E9oCxglbwFxmZcmJQKwKKaUx/rIAd30fknL3KbYlEjye12IQPRGIBNJwysrglYh2Zu+XBHdAm+P0F4gh0Jm/w7pA53bep3EsjUTOEwtyRBAg+TbEJ+ZT/KUQ+t9Siz+rJJTPgMxIVoUlAOlcmwsK66Ldfcheo36TKbnolU8xZOFR/sWI9yuOtKaNJ4f3tcgKZ2JPdsYCQMcQp0IWUUF1ajYmncFqxEwE7HnwfLfvorlIzNl4G3vPb99fwwLJjns9KTluj/syqIeHMUGKnm3EN7z9Vatlwskw== 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=lf9JnwibmmulCmRMdKCBd4ccNAfHi24t7tZq/7JXxIw=; b=WpBJEdNcG+RbmmT3X71RigzwZ6SI2TLt1175OjpRjT8PpKFPgQ9IRBJmZyURSEjVj4eMhmGRS2BP3Qx1UlaVQjxV43i4mLEt6GY+MoIjSgOCCiZYI1xGtG+PyiCl5BhR9/KfJO6x9U+GYgztZ31uYH6Nj42t43BYYvKPSJ7j0FNgKqzr/U8WORJNDpmtX0Wo2dSjd11OxeGTZdN0PGeYcqNxN9MX8by7P7+JyaMeB4yZBVXNJ4Sl/wdQeyPDglO7w/a1rWG/dCkJ1k92GbMl23j1fuG5O/Q1/Q6904fg1tqvnI9EdfGSmvEfijjDldpY2u1QAXUroCuPjBWdIIG1tw== 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=lf9JnwibmmulCmRMdKCBd4ccNAfHi24t7tZq/7JXxIw=; b=um4VgJlFtcf1FcxoDN6PhLRRyv+au4mzTcsP9XURfOGx9I5Xqa0l8pqDJKW84O3DQsMZfn01H4aVev1WMgJCDvekulxYRf5Cw8u1ZADFEyJTgfLqEY3L24k6utRiaLSMA883UAu6db08pz0tlTcD9gNp81WmSq2S0dmhx2RBUiZaekz73yMt95e+BXzDTD2bkYTcsYc152HSeAP0P/86ABCvyC0bCMOixAs3ZCT4paGe2MJ7aOieCyEHNausFgavPOohSC/t0e96kdLY6B3md2ttoLM/ht8SpSGjQp1/Kmu6e2cAP96OtJqr+x1BJj6z1Pkzo0p9Ylcyk7dj+m9hRA== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by SA1PR02MB8494.namprd02.prod.outlook.com (2603:10b6:806:1f9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 09:36:12 +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; Wed, 8 Feb 2023 09:36:12 +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 v2 4/6] migration: Avoid multiple parsing of uri in migration code flow Date: Wed, 8 Feb 2023 09:35:58 +0000 Message-Id: <20230208093600.242665-5-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|SA1PR02MB8494:EE_ X-MS-Office365-Filtering-Correlation-Id: a6053269-4f35-4495-c16f-08db09b7ea47 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: Ud1wV2wcJw5JWICbu2Z1l4aDYSFEJ7cyiNZ4/XCjpJVHe2Bx2G8VNYb0XGc2IZdmorhH0K2JDlKhyvyeo2IBRTlnxCTDuB1z7zWsSh5JKYVElYmhA+JKo3gBgTobU+cgbwoq48Es3b55ua+YE1S69nX+BsJnGIEB1dgJ93JxQHYhbvMhO16xpg6GMWKHDsw5KM0qhssixPOw+/1vT4MBlvK3Ut+PBckNyFSQIVjxXxd8qu0M3BdIzQr0By46HBWySJM4xFWozO6YeX8YQ8TOceP5+RjAFjLi8r1/cKTzHWoy5oUIfe5J1lHylOMurfNN0carcrV21kBgslOL/KbsnxwYmatuRmBsAtjmWPvYRdS5v3kqHsXO90khYRCIDXwMd/KjACZm3zYdrQtZIg+h26m+3Yru3icaqpafFB3kvtiEtwKJAIVdQ4jMaX/fFtj/mHI0SWPJS3sidDLOOGVYz4TdV3Bk0mURBAqaGN1cDopyeV+PFinD5pSEBlO70AcU4CMB996q2vlfoF2jhxTyoLfayaemmlJlGEkDOcDqplq/hMYtbNhDoKZXM5dgZ51ysRAAfjvwpxPD+9UPYAIujMsyf/dlJgprZemqE9yakiWNmVVpqCUBOfNJF/aL054qDJs2grVSJjz0Twfg53AZhVgyKvWE1dRR7Oiw6aGgrrjfbzl46cSh1p7+k3olDk4wWIT4dNw5ZrQILRFABdDDHw== 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)(346002)(396003)(136003)(366004)(39860400002)(376002)(451199018)(6506007)(1076003)(6512007)(36756003)(26005)(186003)(52116002)(6486002)(478600001)(6666004)(107886003)(8936002)(30864003)(5660300002)(4326008)(6916009)(66556008)(66476007)(8676002)(66946007)(38350700002)(41300700001)(38100700002)(2616005)(2906002)(86362001)(316002)(44832011)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6GIeHQeuz33HSrSbjLI+aBpw8IxSdvleCHj57g+bvjcoZs7SAGLNah52qk1Ekgq9glLUZWngheskj6z/m/xC15my2trZS6+2J31LS8l1Jg5gZ2q+o0X+MikKBhDrGPCUpeXWLuLAW1p4U19+58EUdT3Xtb4LdelDx7MW5sh5uQwt3kZej2sp/rmZjutmMRnZ96A5l5W15htLvR4381mZ5u5SemceTsyEgp8Ucu7Qpqz1Box77LyHEdHd/Oza3rtDXv0YI5lJJtZWW3R4/8ZUJRxzSnKNhnAADROwTdpR3WjYAqloiTQVg99Xn9QPS0VT+DPOhF0cR9l2/o0iNmZohMEmGWFwgxHsPKJTBPYZUsSVyogxuW24cp0MmVQhEeuR9jiWsymHtjuoLno5X/nkz/9yqumUkELn6w3nuork22U5k+CnA/3r3BO2mv8vqth4qOguPTIz/2uPPSh8Q2y67220OSbXPTZyiHmMTU+4pvLCE5sqi4Ojfp69vCvM8eAX27QM3oc2V8tqGkrM55/jbS6TXynZEHpKco2BZGOQ1r4gtb48gwXNej3OcoWdCXPlgcJUuik3/qeOL/hl2EB++OlZlDZqoqbZR+xMLaCa9OOtV8p7reES+OEbNdnH7donRS3uPjPpima43S1Pua2mytPEgpL+i/awvIiYC8vLlXl7XdvbkvRDlOjQUu8a/Upa73NJWeG9fBBJZAEeGHwKR3hOMsAMQTEw3mCQoWCcl+SIkUfLxpyyXPdpu6Fo8fZLXVXt22Zuv1rlbS0bcmrNdYX/MVcuTINhvUBRURE01NSlcGyWMQ39f1btpbgPjDw20GcCpKSjRByeuwBQ5ezsgub8kxQjH7D6sPQTuJznxksNwpQaSqVB7L4ZGqUmLvw62mYJn6AHGGN57GoSvtxLb5hnSaH4F50ihp7h0zIqdkH8fdWtuLhUF/ZNtJZhp1++Ln1aAGt0U2tmsKutuJHNRR0p9LjMsUKOKiC76WkxNh5nfTW0Yy3cu0vdpgEJ0u9qfCQ/Buio3EVFGbmZ3sezFcO/PAo6cLcPrhYUUb627sOokTUYOVzYDDPPKl2GjVscltmZtnht6MObzkGK25E+Pqn7dCgKAFbf5plqyEGrOb2EKSRhMNkCyHXHUi594xpMh4wASdQ+3T2sjyPypjSLLX+teQ4z5u8knUcfOi+I0JYYgyaXIzPSOEo1VA0q2KOqTuiyLowf3Zma4QcnPVR/w3N/RSpgppu5R4/dFhrRCXjWrkhPX90Gg1sKMombbh3GKkLTxBPnchRZXMBkbom0JszxioNxaw2ZKONpYSiUBmmqOwH9IbHRE+REc4MDtBTcmkPNz4lX4fuji3y4IITJ6G5ZGAQ6DbMO/nNTlKLmK1ot35+5rbRqnLGWHh4o5/uuOPVGgDDZAaYc34xUv45YLvNH04d3/s2j+F4vlWBZYXSJpxVVRV72LWQp1HKuzF5kkmCcQz3h8xsNiNx3cgIYC5pC8pMBCBlfsBFZKD51r1ahgRxPOigibuYQ2D86MuZfg3vDKFdtuNt3zXUwSs6XnuWhnD2yguIdzrGJz8rGpw8hX0Sf3D90CEJTG0N7IYYwUoW4G0PSHRU0vfVV8/E6+A== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6053269-4f35-4495-c16f-08db09b7ea47 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:11.9324 (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: KAuNzeTlbR/YtOAroE3mO7I0cm/qIpQooTMdJpNbqGjN6+TS7NxRmR6HAYHkutnAI9ejhi5xY8Yi+/6/89GlaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8494 X-Proofpoint-GUID: iTQ0gaJE6TybCJNsj1XsEYsWpMBEqFec X-Proofpoint-ORIG-GUID: iTQ0gaJE6TybCJNsj1XsEYsWpMBEqFec 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-08_03,2023-02-08_01,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. 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..accbf72a18 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.socket_type = 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.socket_type; + 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 Wed Feb 8 09:35:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132729 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 4B3FEC636D3 for ; Wed, 8 Feb 2023 09:38:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsI-00072z-VA; Wed, 08 Feb 2023 04:36:22 -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 1pPgsG-00071k-KG for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -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 1pPgsD-0005J3-U1 for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -0500 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3189MokQ029603; Wed, 8 Feb 2023 01:36:16 -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=ugYj40PXuifck19qf1/cXvilD+vGeNuZ4M/Q+r/EAvs=; b=jv0Ho0BYqcP0EdNci4pOYeiJZFDnXM2VQ3daIYhL/nfJTqvhtaT/8QVlecvpr2/xis6M +JnmaBuhfEpP9h/yQW3w04yZUPxaehxju6H2Tl1dv/Bg6W6euCVD/o/UsJ4DUD1oWFdU n84NhIcABQj53ab7hhRi1OzzSANDYVxDBUy9mS98sXfmFejRsXEVqsKDyylGxN6lgads 1dqlx8X+HH1Br0biwqEHtb/OGIvSSyVPW9MyuPUjjyXcFoeOUYJGjiNmSClAX7vA9Bg+ IpKDc+/hJc1rOI3SU+g3opwVZQyKpG2dr6esQwvtUOi8FENfeZ85D7o9lcnqmZUziuol +Q== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2049.outbound.protection.outlook.com [104.47.57.49]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhm5husuf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6i52/YtwE2ybYWxee7p9oZy8Fs0zrjSG1Wq9ujlagBZeBnqQ92TzZOLFgBcDxmo2+HeijcwbpD++lAAe8/PatG3Rb/iRqKs9I+3VHCStXnb3buSaihtO1V3jV7NC39aUdMgsaboqeWJ+uX/3+kcbUBlulx/sarwjCGR9o7eHeKUITux77uWwybPuqBA7Fwp5bDz3fCSIU05cl6pHE9zAu4bJfiZrX8raIDMQt9eLBbuUTSsXD9EywUCibDmo+Yf7tRSRIcQGXTm8fHj0LcszbB9iq4s7266sTeJ62ACU2NQQyiD/uEC9Qb7zsTZegvNnUERrDCrd7d4Am4TwfwMKg== 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=ugYj40PXuifck19qf1/cXvilD+vGeNuZ4M/Q+r/EAvs=; b=laQmkv6sH0GVY/7026Pe9DYgsJ4y9qqWRwy29OMykuO3OXyjXfnV7iX/0/5VP0asX/w7l/aw4yQ76HYDwcO9K1N7HzqqMvCHvI58JkkM5xvnm962ZPxlhZ2FDJXJHQN/xXqVPqtJmFgj/cdXMVt0vW/WD1KSRY/6qmweJH3CXBGEecAUWXAxyALx+/u9C2CEILrGDTiBD8KIb3rNnEbYJX5MxcpWH+721O6tHTu3UCx/9YSqmIfp2sfZab3ix5zpFWh0ide6WFLvqU4BJ0FsbhYqjBeqV7ZXa0ttA8VKqGPq7/kJqZihK8IOQr9C1nzzSKgL3Lxjhb9WLMHeABzcbA== 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=ugYj40PXuifck19qf1/cXvilD+vGeNuZ4M/Q+r/EAvs=; b=J0tfULdRmYN9LyP+VQlg+6ELVSyMbF8SPHlYygzhbGNwz1Yaz5jttLTFh0sW49giP3U1hlBoT1swnQhusMeHOD6IUmJlrPTgEbMXwC7PLXQh4B4BVVotZKVtKW4tvY2WAQ0fw7RYXThXMbzNicFvDHtcaMKFlIylyB1X1eDoWGgKqfGsh/Fp+BN9E7kSsOXQfz19LwckihYgUI5xBaE4YRsb/wqjHN8Mc5E4JFy/ZdVWAOQQ8qkcbG6DYw030iMd6n97yN7WDfQmP4xo4XfRscYvKWuy5ZSAIjdXT1gdbahzA+Moupf9EzGENlu+bsLV/DGVIYvREDkNP0LVsOR+Ug== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB8180.namprd02.prod.outlook.com (2603:10b6:610:f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 09:36:13 +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; Wed, 8 Feb 2023 09:36:13 +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 v2 5/6] migration: Modified 'migrate-incoming' QAPI and HMP side changes on the destination interface. Date: Wed, 8 Feb 2023 09:35:59 +0000 Message-Id: <20230208093600.242665-6-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB8180:EE_ X-MS-Office365-Filtering-Correlation-Id: 28381948-581a-4938-b355-08db09b7eb20 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: w0g4JSpazaVsqg0NNa/DlorOLw4hnAK1QHqthD/XbttBnuokFVYP1tuxxCJtuX7mTqdCOMZLdHuO4OHyIBNzDkcRtOmGZ9idTMxTE+FaJdSaan5KVmM1+YkWroGud0gjyfTFTlMK82evw80sHo9mTlGfXp7wLADgNhoV7hievllAeAdiNatnCXUxl3bCzVknNqegDjxFzEMW+regLSPDzQexcL3dnqihsktsgDykxxth2YNASPk1aS+/Ac674A8UsFT2X188P9sAoZ96kQ20eL+dHL2RfxM2rylfQEwN4UiP1MdmkwY5/q4dN3GBy/9+svybLe9BXLWIksmQjft2W3cUSm7hYaJAfEhgVZbOq/7cLxw8/BZ/JQrpFHFjMWVF0LanH39DBof5yhbTTQcsVsD8LZYvcuPr9H44vsykVklzWSCZj+fQHIc+pkRBPPMXzVcIbtrwKmjHgW3iTwKm4a6ZbTj3wk/NgjH2lUicP2U6tySWEFD+ela6H+y4QZH+SdAwOrVhsP7dEtj2YA7YgQTKPSfQQo84O8EGIG13yiKZnxjhd3iA5YagwK3wj5gHLck1B2siiL6sUfVFe3HX7RQSijSMt3bykrs+f+VMkN303ACFWjBPSkmpwURFfPWAM1/GQla/9gpYsusPIN6nuqiLCfr2IO4uJsPJ6QMeV7EdPbZ3/MqncJUxkYfUmDfXJnln50XY9Jw7jLFYIWikDg== 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)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(36756003)(86362001)(2906002)(41300700001)(5660300002)(8936002)(44832011)(38100700002)(83380400001)(38350700002)(6486002)(52116002)(478600001)(6512007)(186003)(26005)(316002)(66556008)(8676002)(6916009)(107886003)(6666004)(66476007)(66946007)(1076003)(6506007)(4326008)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dGWYW2TL2nBsW9J15r5LxucAW2fbAGMzlYJ4R3li+roV5zdQAEuuub2+8pujVtOpergIa6cVmLT5xqeSk2jiQ5lFEPbyGyxKyunU7wIUFeWr5EahFW2MkoXTxI7RVuwY16d8yWkqPEc4FzwP+MpPpLDN/wkm7j8SBvTldKvjBvaSQCmgZk1xooOQI0jQtfkhTzWxYqmNK4b5KV4tOEXnPyWgWQ84UKlf1ywiJQWa0btgL48Zgr9a00wbS/tM3Ygsdct9azn2lhzBqADOlmX0TxGkJU/gRCVO8ik9zEbgGUG2TS1F+J9kiTOIozOe7pey5QYZpVgmts8I5bV861aybySCFv23mf46SaZW+ddonKrXUnOKGIUG2jLsKMOiA+i1/DkuPjBt1/XNyNbizMh4wn4zzCDfyGMhWshCxIWMcfC/aBDlB1ttXAe+d1bGpPpVQJatGFNk4K+ErhrPfyVTYPNBtrd9pQhWhbUYjU5SCiNF/+7MnAdfnIztGm81yWhvZZxX3+w8D7CTHQxVMNkGucyR4FoMc0QOxIHrNwc62hnlgoCvj/JfTT70Hx40QQnJzu181UHsI9Nc+y6G5RYr5Fo6TvwXHz9kugBICR0ILd/VXePDjvUSkdH3tPmrv9zwzL1PLug7S13P5lYJRpn1FDYgzo1Rn3YXnSPYlLSrHztMeL3NQ49EzKDVdLypiOrSk8s+/2fREGU3PKeYeqlOA7SJ0TJ+uSThxhJuHN6zmPqwNB64FZ8PRg6kGUPFUG85Opyi9BUI1qHr+Qbf+WPMJOl8aoJrqdvfJgwGsF/OZX/3EuRV1xYbNAEv94mhGeDksO3dpNSPrasxntvFH0/ZXqgalTvjJ2WwbBuzss5V4aD6jma8YZkILYs+Q00rhvEA95Bhk9qv0mfvWW+ZGJT18httWVA9kUU1Ypotc8GXZWd5BMA4MDZd9xuTZwkFZkbAO1NcGdm9R3jJVjB16/MtjxHaQs3Q6OTi8+5eERV0DfcoudKhuhjG8rraIWiH9bhcc2l5RrCr1Jmqk6IpMkfx7DYTGwWdeZTyIqLHjuFKVy+Nc/E5pyY794LrbbTE9FaY0nHE3gwDwjd8VJ6q5XgmamGfOoskgoEwUaCdg/U2JhVzPnPZvXQoZbQFn1xqlwwUf3ND6AtvdSWwWFh6b7cHeygRwyHachm25ziF2WQq4iZft5d8UC2QkIFyK91IPIxDgDT3AvjfjBqwerGVwDqSRJUACfSpScoLDrPdmiKCBMlaLu3Ojba6Uv9XADs6+BJ1DsHufpBk1TycXGAeKvroeTWfin8lln4R2PHvZi1hC0YQdH87r5qP8L1RekS3grPx1nmOYURhtvRAAMqD4TCNXVkxfV+tf/zueuVAbz4UA8FlS0Nn9wo4Z6TbtHhnAFmaxo9ObwTeUYBnIRQPYxGoe0xSRbQK/fXGDJu6d7dmzep66xFpOHYrmO0/5Ymiv2UL/ctDsv/kiVTgDh8jjYs3MhYtQKuC/uzMAeCKJ1/mZB7lBiRoWEO9HCiJXqLq3ErglWmGb+T3p++n7ieSkvBbN5c7smsgetKeTYvyMKvz4pq0xhg0RHa9Yas/ngETBx0JbTdFqrJtnLAQIL0LkwtBsw== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28381948-581a-4938-b355-08db09b7eb20 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:13.3229 (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: HkoB/o7YC3m8DGwhVwkZPE0p6rfwNoD7I7Wsi7l9/ZW4stonqhsurVRfBSgdqQ7GawlxB2t0nxsVrUOvYYqcxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB8180 X-Proofpoint-GUID: ogyQZNc9i71FzGGvI3bBMEDRra9yn02C X-Proofpoint-ORIG-GUID: ogyQZNc9i71FzGGvI3bBMEDRra9yn02C 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-08_03,2023-02-08_01,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. 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 | 22 ++++++++++++++++++++-- softmmu/vl.c | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a9f65ded7a..ae3c5ea5b2 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 accbf72a18..e22ce2dd15 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 79acfcfe4e..3a88912f4d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1623,7 +1623,11 @@ # 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 # @@ -1640,14 +1644,28 @@ # # 3. The uri format is the same as for -incoming # +# 4. The 'uri' and 'channel' arguments are mutually exclusive but, atleast +# one of the two arguments should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } # +# -> { "execute": "migrate-incoming", +# "arguments": { +# "channel": { "channeltype": "main", +# "addr": { "transport": "socket", +# "socket-type": { "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 9177d95d4e..16b8bdcf9b 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2617,7 +2617,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 Wed Feb 8 09:36:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Het Gala X-Patchwork-Id: 13132727 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 A33E4C636D3 for ; Wed, 8 Feb 2023 09:37:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPgsI-00072r-MA; Wed, 08 Feb 2023 04:36:22 -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 1pPgsG-00071p-QJ for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -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 1pPgsE-0005Jh-24 for qemu-devel@nongnu.org; Wed, 08 Feb 2023 04:36:20 -0500 Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3189MokR029603; Wed, 8 Feb 2023 01:36:16 -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=sLUuOHma4/ZROnAv3Dval8LKsi5Df+gvEXQLryvDd1k=; b=Cnqstbs7ojOogdB28Xs2CaS+ZG5TY4+tGWIYmd2652lzfqW+Zi7ysGFujSlqm2yaBUT5 y2wEds3obiwayO46z7QrGcFoBwYQ7lvOrgNywoxi/UA/HAQ/ZEl4FQAi/MaBxZvSeres l5dr4RMAYNpl2le9UE7V0wE1SU1EcdsCkHomR7Kf4H5zukuwuThBQYCtKtBuVLuiFAbv Ay8jV7Lnp3YMzKb7JZqErnCOcoR/yMxe5pnY/VH/4+WQqfXvUSgV1033Uz5NcdeH7KuA eQ4kX7Rc8GxssPOz5JJuL6n3aXE5mEXNt5lnnIzCwfFT4gK+wQt6BO1nfIgwyX+jti88 zw== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2049.outbound.protection.outlook.com [104.47.57.49]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3nhm5husuf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 01:36:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c15CSgELvrFVKj7x7vj2o8ash/lGGiRax/1Ixvevn2ckyhXPe3gwcNb9kmtsmlbxprXdf5138p6kIkBNoCggqOIa2BLu37S9iGn91fZVqu5l5d22bHJVoQQYuQOLB/rMydEEca+pnU1zSF7ny6HCLKlHF9enLXrEguX0LLM5TZLMvM/gkAPTVngZVSfD6UX6omDgkDhedMcU1MeD8p9/Qp81IjSFeZ8BoZqgHLxehmAOMiixFuGHHCZPowZSjAEff92RVD0sBKAMi1ALPSk/DETaBCfm70a7Fwzs7U1ZaAGashWeLGh7y6MdMyaZs/8UA22hMR1Xqvgb2ghsvvVohA== 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=sLUuOHma4/ZROnAv3Dval8LKsi5Df+gvEXQLryvDd1k=; b=b/tpdDQZTwUfVX9/YhROWS2/kpe1AxVBlcx11Z/plKG9SW7URu3tdrswz2bMKTy7E7arQvWG6ksQGSkA12AI5KgxtAr8AOjxPAWGUkoxoxbdkAFDo8WweR49asysK8JfBnEjE54fl2H9FHBE2iicuujeOmuSdF0VmChxvPoq7EhP2VYH5bY+JwFUi1NK8lxf9nYOm7dPCPXkIbhq3hFxFFeQNhpDuUEyBSyNnN50nB0IR0yvI6O/l9tAQwfHUDVy/pLtH48HB7CjJj5yjKLR6EIeVP0AAYnzR/i3sF/8wzCXyuYM69RWRRQcs3FoEDYTijn+IQ0wQR7MLFoYdOO6Dg== 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=sLUuOHma4/ZROnAv3Dval8LKsi5Df+gvEXQLryvDd1k=; b=qaXOWpV3g3qXBEywKfhVNAxKZJKL68ne0Tm5F1qd6Mj+8L9kUTSprRcSJpwsjVz9I8JRLZ2gNZzNTmtF6tL2NV3zimAtCt2+OhE4hSimLZFq2bHH6cInSQ/CO2KMXAnblqPyQYLXrgpI0PYb0Av3VnP7cuNFRUSyUZuSEmzZwymut8WETAf5LL4hH6cL+IOzG54FngvVGh1DTgJURM9y1PvraAWb/GMW4wwMZ1fUa2gZDxyEzcuAsar1tTblIexmG0bjBnt/j9J51upiGB88z3XOanOvFFDagJvVHuvmMYNmGPiWUFEflxrZEaE/sMttyOkWvKXqWGct4vV1QZ2sbQ== Received: from BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) by CH0PR02MB8180.namprd02.prod.outlook.com (2603:10b6:610:f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 09:36:15 +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; Wed, 8 Feb 2023 09:36:15 +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 v2 6/6] migration: Established connection for listener sockets on the dest interface Date: Wed, 8 Feb 2023 09:36:00 +0000 Message-Id: <20230208093600.242665-7-het.gala@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20230208093600.242665-1-het.gala@nutanix.com> References: <20230208093600.242665-1-het.gala@nutanix.com> X-ClientProxiedBy: SJ0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:33b::19) To BYAPR02MB4343.namprd02.prod.outlook.com (2603:10b6:a03:57::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR02MB4343:EE_|CH0PR02MB8180:EE_ X-MS-Office365-Filtering-Correlation-Id: 19e90214-2f2c-4c64-f330-08db09b7ec07 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: GLxngGr157XHKwVl4EmI5eIfar6e0H62s0qq5hWy2o+0HiFvb7nTsUc0vSBjZbb3m9hocQ4p2ppmuJ+5cOn9l+unUgOe2o8TJmLhUh8iHw3K72MuQmU34xfpD+ZLlOTyZwpoRDnsWMx/b8iEyyBsqZLrPt4TK8BXU4zplWOxhFSe5tMDcpJJpHgQyDDBJGVPhfFEpvoVltE0UeHTNukgoD+GWsKOpXJ8tDjolOJ1DMdBG9BVuzM3TfCOpcQGCGGurnhaEOlDRdzZ7z5LLxz9AYUi5jsCJHem/eP5MZ2eq+CgVRnfmjEj4D7ENee0hIv6dvFP7nrRHsx609JZ/5ho4NdzppEGlorlfwMBsMO2MlB4l2qdKt+TxqkQqk7YTUyAN5g9sebMWOzXLmnzts2rojN+uRYCtu0yEam48hayxazKDIABN45GPUnXdlVu1p8scoAGI0qTWx0qYg0Wau0toORZBSBUmkMITwdThW3CTM7eGi85XT6xU1/YCMR3Fy81Mn8p1hlMgq3eg9OWAVnd0+BkIqtJColhQpI7nmGYSy0XwIZa8XD3Wqewhl/U529rtcYFXf0hzr5n3N2vLqv0iau+6o9X4NtmJSn5YagOmrJqeA80W0fmgaXxEyI+jaRDla8YZuLsnfSrgLyU6u/4XQR4exglkRkI9qL9WtBc+c/RvSoXOS/eof7HEUE8Da4PJiT99p32dac5L3e+42G+OQ== 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)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(36756003)(86362001)(2906002)(41300700001)(5660300002)(8936002)(44832011)(38100700002)(83380400001)(38350700002)(6486002)(52116002)(478600001)(6512007)(186003)(26005)(316002)(66556008)(8676002)(6916009)(107886003)(6666004)(66476007)(66946007)(1076003)(6506007)(4326008)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4EDRtX3mpmn0sYVTQD8tUDbu+KL3PhwoRDyClFFcvx1mZJq7idJbO/r9ODFYdkViUI+T95VaS7Drs/tD3P0/t11w2IDjXP0nORGQXBV18bhXsu5z6wsbrxy74GedkcR8YuAzbhmKRKVZM09gRvdXgjtYWmDT/QpvIwKoIYdY6aaizOXkSYK4ZQhOHZ4frZ3R2tz08G6UEUt4I5IZFoCLO9KzCmBPlvIydfzwrdEiaCAYCyqo1ZFYb9TxFFXaz2X1iIZU+yM30XP7uHByZj9z+wqK7pAoCL/+Z9N0io5w3SEw5ItPkNG+u25ploVCoERvSCvuDBYs5zeYVIOKMwYWu0giRnQZg+gw2cUMs0ZLGpl0dR/MzHZNbOy0r2Ncs5Zdqj9KPcfOwz1WLeQeqguRyJdzkpRkEaFKjEqXAkY42MPn9Aq8S0WDOX0Ib0iV95s5OAkqlUPEEph1bZE4BzUIz3sDmJgcBrM2+BFEtqSdjQlr9P3UBCExSF2ruaYMRNkxKcNLZhvZeqkgEkzePyMXsqOhSl6lJorAKpYDW+5E7Cmgtr/CnQzgsjilVniREcd7pkBWotKbOMhv6180s7WC2W4pa2lxoLU1rzciaAA7Ss1WiUxCqFV9mp5XywC6UtUMQWIdCBzfmsN9ljJ7KCx8uEzFQbi4jxbC9cgS9QVqvXjpHNM+9bQyFMthDSww7iQ7GiBL4rQCPl4bjyEYeQcWGUzHFoORSefVW2uR9wIUbuIa2mKPbAflnihnh1M+/3vybNeTS57DkDBjGi32KQ7FCR1erO5LxEv+SowHYbI7l8Ff6IgAvFhJT435KFQ4e6WNuDFV4cnf3TCYQOsk2TvawtvKDmbuJ7fLXoH9YcxD4OxzZDbKxyaiKBMsrrwbXf+ktkCKyP/n0UgDMQUtpt9+v5tBqWef2mPzglKSJefKAzzpiQ/bpBY1kK9uVZEXMtNjKoYvN8UGdxpoU/r0Pz+yWw8YzHqv39P/RtTijG8zEiY02uGreV51QDrX8nQgrFh/F/fhQeNMbSyw4FiCdqVc2ZfhAkF0D9q3YbLQMip0ZEmB6SENZ7eG8Ndzzv+wsC44BObHs9dzomoW3ZhnT6sK7VVmrfy+5LrGCXxYmEvta7aV49rXTGzJr/RqNB4WHYoEjludSCWir5pUKzswhE2cTNcufv4US9airMVRO1MlwHXiqbJGRsQQ3UiWOUgRMalWns//lBKr4KWtrLSn0lfAuBZcMsBdYnvTAg4eNu/BFP+H8j8zH63ara9UP4kLD1NKlb6powG7fnUZCpin+YpqXgJWkla50iEvkT5rp5iA2/DOkay/M0lPOBm4SR/KR4OcHqJTkej3ynfoGxz3ZvmHQpRvAlF4P32qUfjDKW8m426tUaYPD7Nq5DBxwdg2QBL41UEmBt+dqxh9KK2matRs2UBrJqj+27mXQVBNmPoR3YxvtxTHPB/9qE7WCkxckXE8njwho/DfvORNEV0nKfglyjaa80qiD/BLtromXVvXtNkuQztBEA0MyzpcRqZY3HeYxMjkUHBO2s9rmOL9enNPUzU5W99WVrrqykCZJ/Nz7i7SsZvyV0CK9XjkQeqEugpjI/vHksBY+AgNTfu1XRl4Rg== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19e90214-2f2c-4c64-f330-08db09b7ec07 X-MS-Exchange-CrossTenant-AuthSource: BYAPR02MB4343.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 09:36:14.8697 (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: pIfZc0t0Ft0xmSns0t+kUhwCFNJdi9LOPzawnXLX2vGQKCqYXtT2jKhp3wu676xfvkweCFBtk2OkLBW5/zjoFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB8180 X-Proofpoint-GUID: jTbuH-tuEb6l5pZkkhPy1Kud-9YUNjMx X-Proofpoint-ORIG-GUID: jTbuH-tuEb6l5pZkkhPy1Kud-9YUNjMx 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-08_03,2023-02-08_01,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. 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 e22ce2dd15..639d727393 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 = QAPI_CLONE(SocketAddress, channel->addr->u.socket.socket_type); 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);