From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085332; cv=none; d=zohomail.com; s=zohoarc; b=L4KQbaCmVWRxQfNTKVQnjTFmCPZbl7N/rd558bIkbS2v7zKNFVwqFrvjE5hgeinrYY5M1J68JFSzWCos3IieY21pu1JQE4IlJlw3Zp1dKN9Lc55pnDA2IdOzAxjUhcoOIb3XH2LYyWnJZArM397WBmcTFx7yOof9qDhlOLzw1XI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085332; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AWg1Jhd+A5ApoooDn6635fYMYZlwnfnLNm6k6rQi7PI=; b=Z6oeoooDXrt45vREXwZ93wXErHp/2gOsfYEaTxi7FyWefIRZh9V5SVe4UmnEIGjBvYQywlcBfeYi5iZMcKK+QqjGrBTqO9Jppb9StT5jjhoZ5K5ykEPqYJI09tEplDHQ/ur716j9oHz9NXVdCHgH69EndRXP6wVH1WoZcy+v9D0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169808533272313.744891965235183; Mon, 23 Oct 2023 11:22:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzY4-0003uR-Og; Mon, 23 Oct 2023 14:21:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzY2-0003sI-LG for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:07 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzY0-0001A6-VQ for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:06 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 429521FE2D; Mon, 23 Oct 2023 18:21:03 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A928F132FD; Mon, 23 Oct 2023 18:20:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4PSuHIu5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:20:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AWg1Jhd+A5ApoooDn6635fYMYZlwnfnLNm6k6rQi7PI=; b=OrdOZZUJgqUaMX+Yl1VgqQa6YA527M/mZpG1AvhOPihZaKe/MnRAewEVXZ4429GcUryxtr 7fcgOK5rGbBxWIWh4n+TrW2gsJYX3Bxy/iQ5E6rIGobw1BqSbORHxourTN3+DhUcX3dSj8 EBhFp4L8/HDCNQx0fWdiCT90UilHjZ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AWg1Jhd+A5ApoooDn6635fYMYZlwnfnLNm6k6rQi7PI=; b=pXnIg9aiMWoKdbo+J/bEDKD8+5IvsfWkZs8gv5vgu0dk+Y2SP9HhAaEHZwJZIwiVEetC63 Iwo7wnvRvivNClDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 01/14] migration: New QAPI type 'MigrateAddress' Date: Mon, 23 Oct 2023 15:20:40 -0300 Message-Id: <20231023182053.8711-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -6.10 X-Spamd-Result: default: False [-6.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[99.98%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085334476100001 From: Het Gala This patch introduces well defined MigrateAddress struct and its related child objects. The existing argument of 'migrate' and 'migrate-incoming' QAPI - 'uri' is of type string. The current implementation follows double encoding scheme for fetching migration parameters like 'uri' and this is not an ideal design. Motive for intoducing struct level design is to prevent double encoding of QAPI arguments, as Qemu should be able to directly use the QAPI arguments without any level of encoding. Note: this commit only adds the type, and actual uses comes in later commits. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Markus Armbruster Signed-off-by: Fabiano Rosas --- qapi/migration.json | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index db3df12d6c..c352c7ac52 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1508,6 +1508,47 @@ ## { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } =20 +## +# @MigrationAddressType: +# +# The migration stream transport mechanisms. +# +# @socket: Migrate via socket. +# +# @exec: Direct the migration stream to another process. +# +# @rdma: Migrate via RDMA. +# +# Since 8.2 +## +{ 'enum': 'MigrationAddressType', + 'data': ['socket', 'exec', 'rdma'] } + +## +# @MigrationExecCommand: +# +# @args: command (list head) and arguments to execute. +# +# Since 8.2 +## +{ 'struct': 'MigrationExecCommand', + 'data': {'args': [ 'str' ] } } + +## +# @MigrationAddress: +# +# Migration endpoint configuration. +# +# Since 8.2 +## +{ 'union': 'MigrationAddress', + 'base': { 'transport' : 'MigrationAddressType'}, + 'discriminator': 'transport', + 'data': { + 'socket': 'SocketAddress', + 'exec': 'MigrationExecCommand', + 'rdma': 'InetSocketAddress' } } + ## # @migrate: # --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085300; cv=none; d=zohomail.com; s=zohoarc; b=d3rajZjFRjkWa2z1K0al4UULBoWYUEA2r6ROxi7vynmoyfHDKuen8NwYUJ0oGp7P5Ot2I6TMgXz6gZE7E/gOhVPATQBn42Bpnvx9vPwmtnbPnWpbCma3+MZwxFKbUG7kVPZ0+DilI/O99o+TQ4TwwWa5x3yBmB66Il3Qnoi0WHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085300; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=23iPj8nNuWKjOVYn1sUU5aR/NnYoVOIiNA6rrCc6fjY=; b=TV0JZjoljvxTPB39b3hBPaspGPbLBx0XG/iR8X3K5ndZ/5gBEUoFTU9327vggLC9A3cNeCaUqDVHeWKaxWTDDVfds6FeHbOqPgjsI2mMaZggCC67+tLZG5m9Gz1JTmyN2VEfGDKoBEMeU2ZZA4CJDJB9qyVliTEftfIez6T2xw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16980853004506.793551104827316; Mon, 23 Oct 2023 11:21:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzY7-0003w5-DS; Mon, 23 Oct 2023 14:21:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzY6-0003v9-51 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:10 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzY4-0001Au-Dg for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:09 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D4FF721B0B; Mon, 23 Oct 2023 18:21:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AAE9A132FD; Mon, 23 Oct 2023 18:21:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CO1HHY+5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085266; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23iPj8nNuWKjOVYn1sUU5aR/NnYoVOIiNA6rrCc6fjY=; b=Jk9gPO46c0/esbtCPQCM/MvlFXz1hE9CHmzna4BIC5BAa+993qNpMAM3F+ZoEqOkY4rbYX iWeY/ceC86fodLp54EmL2bopxL0fdfvUPUNvB54ZGv5eaYkcZthGQHCVcijn2AY4qSb3YO eMvHJu6Yp7P/j+ZKHt62UCB4tGrU6nY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085266; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23iPj8nNuWKjOVYn1sUU5aR/NnYoVOIiNA6rrCc6fjY=; b=g0ryWgx3FykWCMWQ72B0oRwrEn74CWs4gofnAXGQDEW832sHEMXJlH1k4Ss7usqMlPTqzP WkArDOuTjwMph5Aw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 02/14] fixup! migration: New QAPI type 'MigrateAddress' Date: Mon, 23 Oct 2023 15:20:41 -0300 Message-Id: <20231023182053.8711-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -5.73 X-Spamd-Result: default: False [-5.73 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SUBJECT_HAS_EXCLAIM(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.63)[98.35%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085302792100002 Signed-off-by: Fabiano Rosas Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Markus Armbruster Reviewed-by: Juan Quintela --- qapi/migration.json | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index c352c7ac52..abebe23523 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1519,10 +1519,25 @@ # # @rdma: Migrate via RDMA. # +# @file: Direct the migration stream to a file. +# # Since 8.2 ## { 'enum': 'MigrationAddressType', - 'data': ['socket', 'exec', 'rdma'] } + 'data': [ 'socket', 'exec', 'rdma', 'file' ] } + +## +# @FileMigrationArgs: +# +# @filename: The file to receive the migration stream +# +# @offset: The file offset where the migration stream will start +# +# Since 8.2 +## +{ 'struct': 'FileMigrationArgs', + 'data': { 'filename': 'str', + 'offset': 'uint64' } } =20 ## # @MigrationExecCommand: @@ -1547,7 +1562,8 @@ 'data': { 'socket': 'SocketAddress', 'exec': 'MigrationExecCommand', - 'rdma': 'InetSocketAddress' } } + 'rdma': 'InetSocketAddress', + 'file': 'FileMigrationArgs' } } =20 ## # @migrate: --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085300; cv=none; d=zohomail.com; s=zohoarc; b=HSYzIN8h2KRi+U88O93kU5sVwNcvgQu29G5z6wXQB+sEMkbwhtJ4lMRp0HILNafKMzz0Uf6M3qZN6od7r1egsblYzT84VSWxkBZR8ixFPWQ7CBW1pwVv8E9Q6g2RgKwGv/jl7OHjJgz8kEwN8uSpocmOUSDHG2enxfjW5BtaSgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085300; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=45IkUCEZOaedFhIkPFn0PmHvjDJhvMRAYt/iPQx4f+U=; b=c/fbVgHu2Ie5cw1WjHUgLGvmnEnToquuTwc0ULYt1jp7/xg9aP4DFh2K5UXrdSQuePP5+nMQOwK9VXw7RhP4i5gTSSE0RK91qTtKjRn+KL/SMAeMMTMfjFHx1LUgHCqCpygbmF3e2Hn+UNUHInivv+HzYpxZmNCQp0QGlJfgWos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085300740387.0861363018929; Mon, 23 Oct 2023 11:21:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYC-0003xZ-9P; Mon, 23 Oct 2023 14:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYA-0003ws-Jh for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:14 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzY8-0001Bj-SI for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:14 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 90E4A1FE1C; Mon, 23 Oct 2023 18:21:10 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4DFDE132FD; Mon, 23 Oct 2023 18:21:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mC9GBpO5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085270; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=45IkUCEZOaedFhIkPFn0PmHvjDJhvMRAYt/iPQx4f+U=; b=t/XfovvAeL2La78MZAT1p4O0zvUruiPJ1n2DSjFPGQgILxtziIOEHVuceNZ1rMYtzpyQUt wLN0UJn+uLfR3OEghwwwfYOExOKugbx07PL7Z+lIWMQ+dr0dmr/Qfm66TeTlcr84wK9akx zDUQ6FVrC5foJ2GybVrGvH6pjzuwpqk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085270; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=45IkUCEZOaedFhIkPFn0PmHvjDJhvMRAYt/iPQx4f+U=; b=7rCBMx/rKbMNcEYHpIhqKOf8BYW7lZR3hzSt4xspJyXrYdZiD/axTkgwKqv82iw0FfwOsK KQpt9SIMj/YQ7cCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 03/14] migration: convert migration 'uri' into 'MigrateAddress' Date: Mon, 23 Oct 2023 15:20:42 -0300 Message-Id: <20231023182053.8711-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085302852100010 Content-Type: text/plain; charset="utf-8" From: Het Gala This patch parses 'migrate' and 'migrate-incoming' QAPI's 'uri' string containing migration connection related information and stores them inside well defined 'MigrateAddress' struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/exec.c | 1 - migration/exec.h | 4 ++++ migration/migration.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/migration/exec.c b/migration/exec.c index 2bf882bbe1..32f5143dfd 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -27,7 +27,6 @@ #include "qemu/cutils.h" =20 #ifdef WIN32 -const char *exec_get_cmd_path(void); const char *exec_get_cmd_path(void) { g_autofree char *detected_path =3D g_new(char, MAX_PATH); diff --git a/migration/exec.h b/migration/exec.h index b210ffde7a..736cd71028 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -19,6 +19,10 @@ =20 #ifndef QEMU_MIGRATION_EXEC_H #define QEMU_MIGRATION_EXEC_H + +#ifdef WIN32 +const char *exec_get_cmd_path(void); +#endif void exec_start_incoming_migration(const char *host_port, Error **errp); =20 void exec_start_outgoing_migration(MigrationState *s, const char *host_por= t, diff --git a/migration/migration.c b/migration/migration.c index 67547eb6a1..639e89db43 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -66,6 +66,7 @@ #include "sysemu/qtest.h" #include "options.h" #include "sysemu/dirtylimit.h" +#include "qemu/sockets.h" =20 static NotifierList migration_state_notifiers =3D NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); @@ -428,9 +429,55 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } =20 +static bool migrate_uri_parse(const char *uri, + MigrationAddress **channel, + Error **errp) +{ + g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); + SocketAddress *saddr =3D NULL; + InetSocketAddress *isock =3D &addr->u.rdma; + strList **tail =3D &addr->u.exec.args; + + if (strstart(uri, "exec:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_EXEC; +#ifdef WIN32 + QAPI_LIST_APPEND(tail, g_strdup(exec_get_cmd_path())); + QAPI_LIST_APPEND(tail, g_strdup("/c")); +#else + QAPI_LIST_APPEND(tail, g_strdup("/bin/sh")); + QAPI_LIST_APPEND(tail, g_strdup("-c")); +#endif + QAPI_LIST_APPEND(tail, g_strdup(uri + strlen("exec:"))); + } else if (strstart(uri, "rdma:", NULL)) { + if (inet_parse(isock, uri + strlen("rdma:"), errp)) { + qapi_free_InetSocketAddress(isock); + return false; + } + addr->transport =3D MIGRATION_ADDRESS_TYPE_RDMA; + } else if (strstart(uri, "tcp:", NULL) || + strstart(uri, "unix:", NULL) || + strstart(uri, "vsock:", NULL) || + strstart(uri, "fd:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_SOCKET; + saddr =3D socket_parse(uri, errp); + if (!saddr) { + return false; + } + addr->u.socket.type =3D saddr->type; + addr->u.socket.u =3D saddr->u; + } else { + error_setg(errp, "unknown migration protocol: %s", uri); + return false; + } + + *channel =3D g_steal_pointer(&addr); + return true; +} + static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p =3D NULL; + g_autoptr(MigrationAddress) channel =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 /* URI is not suitable for migration? */ @@ -438,6 +485,10 @@ static void qemu_start_incoming_migration(const char *= uri, Error **errp) return; } =20 + if (uri && !migrate_uri_parse(uri, &channel, errp)) { + return; + } + migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP); =20 @@ -1705,12 +1756,17 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); const char *p =3D NULL; + g_autoptr(MigrationAddress) channel =3D NULL; =20 /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; } =20 + if (!migrate_uri_parse(uri, &channel, errp)) { + return; + } + resume_requested =3D has_resume && resume; if (!migrate_prepare(s, has_blk && blk, has_inc && inc, resume_requested, errp)) { --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085300; cv=none; d=zohomail.com; s=zohoarc; b=QEqrXAwymsmr+yC0oE8BQ0fd/xUhy9WjrgahGDEMdmbualWROPmSPNESwTdBze5/bmjDawzlDxQKEuTzZlMeQ2q4uvIqpHmOYTPpwgdsuRou0d69wyfcsURoHQ5a8q9/0YDuSHSwFjEVKb5gs5+k67pbHeKtayPwID7lc6U0qWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085300; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sHbjcZo5dbqAbOQNpsiy1Bc3oTnK2oMzMBTmYH742Qk=; b=b8z/eOpxZGASCoOycxqHOY828e5nRMNPYGsc0FyXcUhOXfCWogea27g6WtDavx3r4bQF9whlRrWLsvGbqaYGhYlT2IhNZfLDiBPI7xh3+GPFAwLsU5qPRktYsug1HFsefrLEPh1SYycdS38D6aOILvC4fi6mF4gJmSfJILk18XY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085300578827.9948958535417; Mon, 23 Oct 2023 11:21:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYG-0003yv-Kn; Mon, 23 Oct 2023 14:21:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYE-0003y9-QZ for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:18 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYB-0001Bz-9N for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:18 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3149C21B0C; Mon, 23 Oct 2023 18:21:14 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F14DD132FD; Mon, 23 Oct 2023 18:21:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mBZpLpa5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085274; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sHbjcZo5dbqAbOQNpsiy1Bc3oTnK2oMzMBTmYH742Qk=; b=vq8+ukCvtiXIyReRybTV/SNxn19FdUOJHOuuUMCbKTcLPLtX85NMBGWjfZvRpcYXYunnhs OHJdiEQABtb0SkvJVRqDTRc6AyK0MI1GlpTdKf46jmPcvfmILyEw5d8fjivDq2dRZPjNCb nP3438mLDffP5S4S1KmhvDRFsvekm4U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085274; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sHbjcZo5dbqAbOQNpsiy1Bc3oTnK2oMzMBTmYH742Qk=; b=tSyEm3wXpAFN55N4s0UVmjhvRyi+MAdIrh+wLFZRpAgdJd3ArdlhTJivGMpafGjFa7/d4z U1hpwkGjM5Dsu0Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 04/14] fixup! migration: convert migration 'uri' into 'MigrateAddress' Date: Mon, 23 Oct 2023 15:20:43 -0300 Message-Id: <20231023182053.8711-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -6.05 X-Spamd-Result: default: False [-6.05 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SUBJECT_HAS_EXCLAIM(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.95)[99.79%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085302798100003 Signed-off-by: Fabiano Rosas Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Juan Quintela --- migration/file.c | 2 +- migration/file.h | 1 + migration/migration.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/migration/file.c b/migration/file.c index cf5b1bf365..ec069ef329 100644 --- a/migration/file.c +++ b/migration/file.c @@ -19,7 +19,7 @@ =20 /* Remove the offset option from @filespec and return it in @offsetp. */ =20 -static int file_parse_offset(char *filespec, uint64_t *offsetp, Error **er= rp) +int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp) { char *option =3D strstr(filespec, OFFSET_OPTION); int ret; diff --git a/migration/file.h b/migration/file.h index 90fa4849e0..3888a57105 100644 --- a/migration/file.h +++ b/migration/file.h @@ -11,4 +11,5 @@ void file_start_incoming_migration(const char *filename, = Error **errp); =20 void file_start_outgoing_migration(MigrationState *s, const char *filename, Error **errp); +int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index 639e89db43..ac91984d39 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -465,6 +465,13 @@ static bool migrate_uri_parse(const char *uri, } addr->u.socket.type =3D saddr->type; addr->u.socket.u =3D saddr->u; + } else if (strstart(uri, "file:", NULL)) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_FILE; + addr->u.file.filename =3D g_strdup(uri + strlen("file:")); + if (file_parse_offset(addr->u.file.filename, &addr->u.file.offset, + errp)) { + return false; + } } else { error_setg(errp, "unknown migration protocol: %s", uri); return false; --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085394; cv=none; d=zohomail.com; s=zohoarc; b=T4dyHFVZ18QHSi/7wWBhj42qh/AFspF/Cz9fdgxrX53Z2ywwutHm3eZQGQgcjJ9K40m9Jpfx5gS7rKWhzeSIxmh3We67d1WHa1ywqw+lOn+AxYAR1YrE8a5YA53wxKxCTaq3FGoYA/zFfT9Jwu+vx3TAeE7akd0jcudjOOHEq/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085394; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ahRGKwcmMLOIXtNe9kGKmZrGKgk6klbPZWmL490TohY=; b=CAPlKNHMp6GKR4vwCQ7KEJWQKk2kng5kgrKCm6MD24ZH0m4A+EhE+2WOcF1Jj8aCKD83epepdFQWziRf4Fm02AeH+vdqPzlGSMqbaNeXXGv+NUGY89de4FX/cWXdpgPgYDfE8BgqrnLTq/WcEoC+UT2l9MskOJPzwJS5agBz1E4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16980853947101002.7622298675473; Mon, 23 Oct 2023 11:23:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYJ-00042n-Fx; Mon, 23 Oct 2023 14:21:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYH-0003za-MX for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:21 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYF-0001CH-M9 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:21 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id ECD701FE2D; Mon, 23 Oct 2023 18:21:17 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A049B132FD; Mon, 23 Oct 2023 18:21:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YP1GGpq5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ahRGKwcmMLOIXtNe9kGKmZrGKgk6klbPZWmL490TohY=; b=HB9iOF+NoeWmxg9Bclm5lpfbeEx6lmapS3TUAfH2u9TfEOlRvlNBeXX0kxsP9CmsRy+0Rv +2z2q71X9aJDgjuqcL8/cCk+zrvvPQDmFr0/x8h1foQpPd/XXrfybs4nPTNyrBjz8PUm6a qRDK5/gL1Tcw5c7CpWYORfTG+4Q8q2c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ahRGKwcmMLOIXtNe9kGKmZrGKgk6klbPZWmL490TohY=; b=4cIVN39S9NitHcxmY5CROZmKbm6rUKXp0ng1gyxXJ0bMLXxo91AN4t7cGYPN8q3mdzZyDx xnPzEmpjtzJ8guDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 05/14] migration: convert socket backend to accept MigrateAddress Date: Mon, 23 Oct 2023 15:20:44 -0300 Message-Id: <20231023182053.8711-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -6.10 X-Spamd-Result: default: False [-6.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085396699100003 From: Het Gala Socket transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for socket connection into well defined SocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/migration.c | 30 ++++++++++++++++++------------ migration/socket.c | 39 +++++++++------------------------------ migration/socket.h | 7 ++++--- 3 files changed, 31 insertions(+), 45 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ac91984d39..a929fbb3f1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -499,10 +499,15 @@ static void qemu_start_incoming_migration(const char = *uri, Error **errp) migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP); =20 - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_incoming_migration(p ? p : uri, errp); + if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &channel->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_start_incoming_migration(saddr, errp); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_start_incoming_migration(saddr->u.fd.str, errp); + } #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { if (migrate_compress()) { @@ -521,8 +526,6 @@ static void qemu_start_incoming_migration(const char *u= ri, Error **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 (strstart(uri, "file:", &p)) { file_start_incoming_migration(p, errp); } else { @@ -1787,18 +1790,21 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, } } =20 - if (strstart(uri, "tcp:", &p) || - strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL)) { - socket_start_outgoing_migration(s, p ? p : uri, &local_err); + if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &channel->u.socket; + if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { + socket_start_outgoing_migration(s, saddr, &local_err); + } else if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_FD) { + fd_start_outgoing_migration(s, saddr->u.fd.str, &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); } else if (strstart(uri, "file:", &p)) { file_start_outgoing_migration(s, p, &local_err); } else { diff --git a/migration/socket.c b/migration/socket.c index 1b6f5baefb..98e3ea1514 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -28,6 +28,8 @@ #include "trace.h" #include "postcopy-ram.h" #include "options.h" +#include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" =20 struct SocketOutgoingArgs { SocketAddress *saddr; @@ -108,19 +110,19 @@ out: object_unref(OBJECT(sioc)); } =20 -static void -socket_start_outgoing_migration_internal(MigrationState *s, - SocketAddress *saddr, - Error **errp) +void socket_start_outgoing_migration(MigrationState *s, + SocketAddress *saddr, + Error **errp) { QIOChannelSocket *sioc =3D qio_channel_socket_new(); struct SocketConnectData *data =3D g_new0(struct SocketConnectData, 1); + SocketAddress *addr =3D QAPI_CLONE(SocketAddress, saddr); =20 data->s =3D s; =20 /* in case previous migration leaked it */ qapi_free_SocketAddress(outgoing_args.saddr); - outgoing_args.saddr =3D saddr; + outgoing_args.saddr =3D addr; =20 if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET) { data->hostname =3D g_strdup(saddr->u.inet.host); @@ -135,18 +137,6 @@ socket_start_outgoing_migration_internal(MigrationStat= e *s, NULL); } =20 -void socket_start_outgoing_migration(MigrationState *s, - const char *str, - Error **errp) -{ - Error *err =3D NULL; - SocketAddress *saddr =3D 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) @@ -172,9 +162,8 @@ socket_incoming_migration_end(void *opaque) object_unref(OBJECT(listener)); } =20 -static void -socket_start_incoming_migration_internal(SocketAddress *saddr, - Error **errp) +void socket_start_incoming_migration(SocketAddress *saddr, + Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -213,13 +202,3 @@ socket_start_incoming_migration_internal(SocketAddress= *saddr, } } =20 -void socket_start_incoming_migration(const char *str, Error **errp) -{ - Error *err =3D NULL; - SocketAddress *saddr =3D 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 dc54df4e6c..5e4c33b8ea 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -19,13 +19,14 @@ =20 #include "io/channel.h" #include "io/task.h" +#include "qemu/sockets.h" =20 void socket_send_channel_create(QIOTaskFunc f, void *data); QIOChannel *socket_send_channel_create_sync(Error **errp); int socket_send_channel_destroy(QIOChannel *send); =20 -void socket_start_incoming_migration(const char *str, Error **errp); +void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); =20 -void socket_start_outgoing_migration(MigrationState *s, const char *str, - Error **errp); +void socket_start_outgoing_migration(MigrationState *s, + SocketAddress *saddr, Error **errp); #endif --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085442; cv=none; d=zohomail.com; s=zohoarc; b=bptZhsd9enZoYKoV/bdSvwFr9mFx8IZORsO7UwRHj5/JcQRcQ7R4ZL2vjrQ9L8nFZlV0yoU2HtAFS/tpTbk0+Ae10EZi50hPupckxLc/ONTnyCo5XLr94aDJRgYZu9/XQHYw8yvCoUSmdrUbYWrXTQTsWT7AcvN3QMSB3mTT2qY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085442; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3njnR7F2Mk4PbaMRNV5mzXvaSiKu7K/ea1a3GDweu2s=; b=PzJf/jZ4YXI0ouq/sivcOzuUph9wGBGYsKjYhyaDqI7DWPWI/hydspuu1ZwUZGszSpRn2MVBS51jFIBbaW1jKFVKg0S76zVSq22iYgq+pn7ZBKy3hxBFCUJSUbBaqwquGPLP3FJR4Ee6oGx5WLwXMFq1Mm4thHojGMDOSRkadPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169808544266852.42873922620856; Mon, 23 Oct 2023 11:24:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYM-00043B-6X; Mon, 23 Oct 2023 14:21:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYK-00042y-Oh for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:24 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYI-0001Cj-VZ for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:24 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D91111FE2D; Mon, 23 Oct 2023 18:21:21 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 64CC4132FD; Mon, 23 Oct 2023 18:21:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KAcQDJ65NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085281; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3njnR7F2Mk4PbaMRNV5mzXvaSiKu7K/ea1a3GDweu2s=; b=fBGveMzcpDtqFiTnfIj6IltVzFrjxbV8fuEVKgWkGrJwQn8T6RwRar1xU704LYHCjiCsei vjEzXh2mkub+0fW+MXPbhWEXL5Bl2OFCuBNcV2fEy5vrA42MjEBIyvKp4wJ8iVFNnhpLFn 5RjxfJItE37lMEjkDclpk8irzhluuMM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085281; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3njnR7F2Mk4PbaMRNV5mzXvaSiKu7K/ea1a3GDweu2s=; b=lhKdRD8lLBbV0uTKLQ3Pkxc3mttS6KEh00Wad6Aii7C7ZB4BwewcMUk26FJ1PwVttm2vJ6 KH/IzFSajh4O1uAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras , Li Zhijian Subject: [PATCH v15 06/14] migration: convert rdma backend to accept MigrateAddress Date: Mon, 23 Oct 2023 15:20:45 -0300 Message-Id: <20231023182053.8711-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -6.10 X-Spamd-Result: default: False [-6.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[14]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085444902100014 From: Het Gala RDMA based transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for RDMA connection into well defined InetSocketAddress struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/migration.c | 8 ++++---- migration/rdma.c | 33 +++++++++++---------------------- migration/rdma.h | 6 ++++-- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a929fbb3f1..df1698cd5f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -509,7 +509,7 @@ static void qemu_start_incoming_migration(const char *u= ri, Error **errp) fd_start_incoming_migration(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { if (migrate_compress()) { error_setg(errp, "RDMA and compression can't be used together"= ); return; @@ -522,7 +522,7 @@ static void qemu_start_incoming_migration(const char *u= ri, Error **errp) error_setg(errp, "RDMA and multifd can't be used together"); return; } - rdma_start_incoming_migration(p, errp); + rdma_start_incoming_migration(&channel->u.rdma, errp); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_incoming_migration(p, errp); @@ -1800,8 +1800,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { - rdma_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); diff --git a/migration/rdma.c b/migration/rdma.c index 2a1852ec7f..7a9ce5230e 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -289,7 +289,6 @@ typedef struct RDMALocalBlocks { typedef struct RDMAContext { char *host; int port; - char *host_port; =20 RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; =20 @@ -2431,9 +2430,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->channel =3D NULL; } g_free(rdma->host); - g_free(rdma->host_port); rdma->host =3D NULL; - rdma->host_port =3D NULL; } =20 =20 @@ -2723,28 +2720,16 @@ static void qemu_rdma_return_path_dest_init(RDMACon= text *rdma_return_path, rdma_return_path->is_return_path =3D true; } =20 -static RDMAContext *qemu_rdma_data_init(const char *host_port, Error **err= p) +static RDMAContext *qemu_rdma_data_init(InetSocketAddress *saddr, Error **= errp) { RDMAContext *rdma =3D NULL; - InetSocketAddress *addr; =20 rdma =3D g_new0(RDMAContext, 1); rdma->current_index =3D -1; rdma->current_chunk =3D -1; =20 - addr =3D g_new(InetSocketAddress, 1); - if (!inet_parse(addr, host_port, NULL)) { - rdma->port =3D atoi(addr->port); - rdma->host =3D g_strdup(addr->host); - rdma->host_port =3D g_strdup(host_port); - } else { - error_setg(errp, "RDMA ERROR: bad RDMA migration address '%s'", - host_port); - g_free(rdma); - rdma =3D NULL; - } - - qapi_free_InetSocketAddress(addr); + rdma->host =3D g_strdup(saddr->host); + rdma->port =3D atoi(saddr->port); return rdma; } =20 @@ -3353,6 +3338,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) .private_data_len =3D sizeof(c= ap), }; RDMAContext *rdma_return_path =3D NULL; + g_autoptr(InetSocketAddress) isock =3D g_new0(InetSocketAddress, 1); struct rdma_cm_event *cm_event; struct ibv_context *verbs; int ret; @@ -3367,13 +3353,16 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } =20 + isock->host =3D rdma->host; + isock->port =3D g_strdup_printf("%d", rdma->port); + /* * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { - rdma_return_path =3D qemu_rdma_data_init(rdma->host_port, NULL); + rdma_return_path =3D qemu_rdma_data_init(isock, NULL); if (rdma_return_path =3D=3D NULL) { rdma_ack_cm_event(cm_event); goto err_rdma_dest_wait; @@ -4072,7 +4061,8 @@ static void rdma_accept_incoming_migration(void *opaq= ue) } } =20 -void rdma_start_incoming_migration(const char *host_port, Error **errp) +void rdma_start_incoming_migration(InetSocketAddress *host_port, + Error **errp) { MigrationState *s =3D migrate_get_current(); int ret; @@ -4116,13 +4106,12 @@ cleanup_rdma: err: if (rdma) { g_free(rdma->host); - g_free(rdma->host_port); } g_free(rdma); } =20 void rdma_start_outgoing_migration(void *opaque, - const char *host_port, Error **errp) + InetSocketAddress *host_port, Error **errp) { MigrationState *s =3D opaque; RDMAContext *rdma_return_path =3D NULL; diff --git a/migration/rdma.h b/migration/rdma.h index 30b15b4466..a8d27f33b8 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -14,15 +14,17 @@ * */ =20 +#include "qemu/sockets.h" + #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H =20 #include "exec/memory.h" =20 -void rdma_start_outgoing_migration(void *opaque, const char *host_port, +void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_p= ort, Error **errp); =20 -void rdma_start_incoming_migration(const char *host_port, Error **errp); +void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **e= rrp); =20 /* * Constants used by rdma return codes --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085326; cv=none; d=zohomail.com; s=zohoarc; b=aQjZ9ko3I9ieZeefEYFQextkYYWEmh0zsRhgp5fd4bsC2MmSSPEuV2KyOKnLEw7HqG1jtYuTuOJJz0BGg9kPNvBC9yv5Aw9GmpS5yzlGdVZzGief8lm0HMSw0NpG6Qugly2eE7Ig/Op7N8PuFCaKava1cGSim/6rhLjFFA1T0bI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085326; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BhlVzTLoLO/CmynImRVIWcvhXYqGphEZ6ZnilgHSyWA=; b=UhrBlFd9Fsj0VRB34oEnHo1HKql4Vk+5K8kXqkwhJlQiHiaKqhrmjW1MP6mgfPRonYXpvjgH9cxc/WKMk7rgzxVZ8j5KolXSX7iWcxTY93UCf8FmluwLpwjxqHoYbkG11UrVsBx2mIDcsUQgPOhFaHY2zpNzhWdKaI39vc0IVMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085326057840.6599792457322; Mon, 23 Oct 2023 11:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYP-0004CA-Q1; Mon, 23 Oct 2023 14:21:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYO-00045p-Ah for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:28 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYM-0001Cz-MV for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:28 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8462E21B0B; Mon, 23 Oct 2023 18:21:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 50987132FD; Mon, 23 Oct 2023 18:21:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wM1qB6K5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085285; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhlVzTLoLO/CmynImRVIWcvhXYqGphEZ6ZnilgHSyWA=; b=qx8KNf64WWnIivSTtZIDCC7c7xQy3SmDNMWhzrq+n5m++vYAJZHOXa82IuV9yknOtZvyhQ 3zM0wAP72gy0aoBzUZRES4ABOMDY9mpgFwJ5cAGBc+criQbYBpkkLH+YOqtq6Ttaz+Qznm aoh2tGFRrdLqm0fRoUtLLoCGrBx1LvM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085285; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhlVzTLoLO/CmynImRVIWcvhXYqGphEZ6ZnilgHSyWA=; b=l90DyEPQoLHAlkG4s2TxIPIdP0EJ0zOB5tk9eptA7oRAyPRJjmEM6cZ3Tw3CSvBoFUbDqs ngfHgR9E+VK8TYBw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 07/14] migration: convert exec backend to accept MigrateAddress. Date: Mon, 23 Oct 2023 15:20:46 -0300 Message-Id: <20231023182053.8711-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085326464100001 Content-Type: text/plain; charset="utf-8" From: Het Gala Exec transport backend for 'migrate'/'migrate-incoming' QAPIs accept new wire protocol of MigrateAddress struct. It is achived by parsing 'uri' string and storing migration parameters required for exec connection into strList struct. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/exec.c | 73 +++++++++++++++++++++++++++++++------------ migration/exec.h | 4 +-- migration/migration.c | 8 ++--- 3 files changed, 59 insertions(+), 26 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 32f5143dfd..47d2f3b8fb 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -39,20 +39,51 @@ const char *exec_get_cmd_path(void) } #endif =20 -void exec_start_outgoing_migration(MigrationState *s, const char *command,= Error **errp) +/* provides the length of strList */ +static int +str_list_length(strList *list) +{ + int len =3D 0; + strList *elem; + + for (elem =3D list; elem !=3D NULL; elem =3D elem->next) { + len++; + } + + return len; +} + +static void +init_exec_array(strList *command, char **argv, Error **errp) +{ + int i =3D 0; + strList *lst; + + for (lst =3D command; lst; lst =3D lst->next) { + argv[i++] =3D lst->value; + } + + argv[i] =3D NULL; + return; +} + +void exec_start_outgoing_migration(MigrationState *s, strList *command, + Error **errp) { QIOChannel *ioc; =20 -#ifdef WIN32 - const char *argv[] =3D { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] =3D { "/bin/sh", "-c", command, NULL }; -#endif + int length =3D str_list_length(command); + g_auto(GStrv) argv =3D (char **) g_new0(const char *, length + 1); =20 - trace_migration_exec_outgoing(command); - ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + init_exec_array(command, argv, errp); + g_autofree char *new_command =3D g_strjoinv(" ", (char **)argv); + + trace_migration_exec_outgoing(new_command); + ioc =3D QIO_CHANNEL( + qio_channel_command_new_spawn( + (const char * const *) g_steal_pointer(&argv), + O_RDWR, + errp)); if (!ioc) { return; } @@ -71,20 +102,22 @@ static gboolean exec_accept_incoming_migration(QIOChan= nel *ioc, return G_SOURCE_REMOVE; } =20 -void exec_start_incoming_migration(const char *command, Error **errp) +void exec_start_incoming_migration(strList *command, Error **errp) { QIOChannel *ioc; =20 -#ifdef WIN32 - const char *argv[] =3D { exec_get_cmd_path(), "/c", command, NULL }; -#else - const char *argv[] =3D { "/bin/sh", "-c", command, NULL }; -#endif + int length =3D str_list_length(command); + g_auto(GStrv) argv =3D (char **) g_new0(const char *, length + 1); =20 - trace_migration_exec_incoming(command); - ioc =3D QIO_CHANNEL(qio_channel_command_new_spawn(argv, - O_RDWR, - errp)); + init_exec_array(command, argv, errp); + g_autofree char *new_command =3D g_strjoinv(" ", (char **)argv); + + trace_migration_exec_incoming(new_command); + ioc =3D QIO_CHANNEL( + qio_channel_command_new_spawn( + (const char * const *) g_steal_pointer(&argv), + O_RDWR, + errp)); if (!ioc) { return; } diff --git a/migration/exec.h b/migration/exec.h index 736cd71028..3107f205e3 100644 --- a/migration/exec.h +++ b/migration/exec.h @@ -23,8 +23,8 @@ #ifdef WIN32 const char *exec_get_cmd_path(void); #endif -void exec_start_incoming_migration(const char *host_port, Error **errp); +void exec_start_incoming_migration(strList *host_port, Error **errp); =20 -void exec_start_outgoing_migration(MigrationState *s, const char *host_por= t, +void exec_start_outgoing_migration(MigrationState *s, strList *host_port, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index df1698cd5f..b9ca257c6c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -524,8 +524,8 @@ static void qemu_start_incoming_migration(const char *u= ri, Error **errp) } rdma_start_incoming_migration(&channel->u.rdma, errp); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(channel->u.exec.args, errp); } else if (strstart(uri, "file:", &p)) { file_start_incoming_migration(p, errp); } else { @@ -1803,8 +1803,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); #endif - } else if (strstart(uri, "exec:", &p)) { - exec_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); } else if (strstart(uri, "file:", &p)) { file_start_outgoing_migration(s, p, &local_err); } else { --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085357; cv=none; d=zohomail.com; s=zohoarc; b=X6n4sLEkD+KdztgU0tvrv5TlZkjH//yxTPKKPMfbTyB/IkIU1uy3Q0bpoIAAIfyKabpCnev7zVfbWkNQujLOTk0/1ySaCUCG/YOjoZsZotWYND5jlExeM89OShefKPmdHqykowTieH8guCKgTQ3WG+O0ba0XyvBojJ8EHdTV704= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085357; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ReqItBZkywcU+Yf4VIMAFHyP1dTE5vJ4ykBLv4YOZLY=; b=oG4mHmq/ccGc8ydyA5bMzTS/icDHW+7xFPXhQ+/7MRlUoW0xiAKC3ZAbiaxlV4uoTEvcFUfB0hGSFY9siZ5qyJ10Zg0OpXXK6o5iqYE5n2IoZf179K33KwMd6YtWXXN1SYGz6XjIcnHD4jqTshODLuSo0JZ3Q1IioeqWMko6yq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085357753600.0008284219706; Mon, 23 Oct 2023 11:22:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYU-0004H2-2N; Mon, 23 Oct 2023 14:21:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYS-0004F3-5x for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:32 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYQ-0001DK-HM for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:31 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 56D651FE2F; Mon, 23 Oct 2023 18:21:29 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 03977132FD; Mon, 23 Oct 2023 18:21:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OEiHL6W5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ReqItBZkywcU+Yf4VIMAFHyP1dTE5vJ4ykBLv4YOZLY=; b=ePrIX7k8iYkrblMMY72ZJTgRfKhFTxiMmOknqtTLRWzwzk9RtmNfiN33ju0elXTZLrlE+d +x/XGov840toU1VYP6+mk1+qF2ES21mwJpzBCdMDvFOgnfqRwE4Vwq/NW1ZvTgLpJdaXB7 2l+PSylNOb1GhIX78/+A/r45fmqYHGg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ReqItBZkywcU+Yf4VIMAFHyP1dTE5vJ4ykBLv4YOZLY=; b=//ihfuWINZqemH1eQn2Vvvn1Dnetx2mHgrPUhL18sO7QJuBYIcRMtdPXbglIMmbQzEiVJo jRp5vQH2RZPZ0dCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 08/14] migration: Convert the file backend to the new QAPI syntax Date: Mon, 23 Oct 2023 15:20:47 -0300 Message-Id: <20231023182053.8711-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085358565100001 Content-Type: text/plain; charset="utf-8" Convert the file: URI to accept a FileMigrationArgs to be compatible with the new migration QAPI. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/file.c | 22 +++++++--------------- migration/file.h | 9 ++++++--- migration/migration.c | 10 ++++------ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/migration/file.c b/migration/file.c index ec069ef329..5d4975f43e 100644 --- a/migration/file.c +++ b/migration/file.c @@ -36,20 +36,16 @@ int file_parse_offset(char *filespec, uint64_t *offsetp= , Error **errp) return 0; } =20 -void file_start_outgoing_migration(MigrationState *s, const char *filespec, - Error **errp) +void file_start_outgoing_migration(MigrationState *s, + FileMigrationArgs *file_args, Error **e= rrp) { - g_autofree char *filename =3D g_strdup(filespec); g_autoptr(QIOChannelFile) fioc =3D NULL; - uint64_t offset =3D 0; + g_autofree char *filename =3D g_strdup(file_args->filename); + uint64_t offset =3D file_args->offset; QIOChannel *ioc; =20 trace_migration_file_outgoing(filename); =20 - if (file_parse_offset(filename, &offset, errp)) { - return; - } - fioc =3D qio_channel_file_new_path(filename, O_CREAT | O_WRONLY | O_TR= UNC, 0600, errp); if (!fioc) { @@ -73,19 +69,15 @@ static gboolean file_accept_incoming_migration(QIOChann= el *ioc, return G_SOURCE_REMOVE; } =20 -void file_start_incoming_migration(const char *filespec, Error **errp) +void file_start_incoming_migration(FileMigrationArgs *file_args, Error **e= rrp) { - g_autofree char *filename =3D g_strdup(filespec); + g_autofree char *filename =3D g_strdup(file_args->filename); QIOChannelFile *fioc =3D NULL; - uint64_t offset =3D 0; + uint64_t offset =3D file_args->offset; QIOChannel *ioc; =20 trace_migration_file_incoming(filename); =20 - if (file_parse_offset(filename, &offset, errp)) { - return; - } - fioc =3D qio_channel_file_new_path(filename, O_RDONLY, 0, errp); if (!fioc) { return; diff --git a/migration/file.h b/migration/file.h index 3888a57105..37d6a08bfc 100644 --- a/migration/file.h +++ b/migration/file.h @@ -7,9 +7,12 @@ =20 #ifndef QEMU_MIGRATION_FILE_H #define QEMU_MIGRATION_FILE_H -void file_start_incoming_migration(const char *filename, Error **errp); =20 -void file_start_outgoing_migration(MigrationState *s, const char *filename, - Error **errp); +#include "qapi/qapi-types-migration.h" + +void file_start_incoming_migration(FileMigrationArgs *file_args, Error **e= rrp); + +void file_start_outgoing_migration(MigrationState *s, + FileMigrationArgs *file_args, Error **e= rrp); int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp); #endif diff --git a/migration/migration.c b/migration/migration.c index b9ca257c6c..c8b50b1dd5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -483,7 +483,6 @@ static bool migrate_uri_parse(const char *uri, =20 static void qemu_start_incoming_migration(const char *uri, Error **errp) { - const char *p =3D NULL; g_autoptr(MigrationAddress) channel =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 @@ -526,8 +525,8 @@ static void qemu_start_incoming_migration(const char *u= ri, Error **errp) #endif } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { exec_start_incoming_migration(channel->u.exec.args, errp); - } else if (strstart(uri, "file:", &p)) { - file_start_incoming_migration(p, errp); + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_start_incoming_migration(&channel->u.file, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1765,7 +1764,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, bool resume_requested; Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); - const char *p =3D NULL; g_autoptr(MigrationAddress) channel =3D NULL; =20 /* URI is not suitable for migration? */ @@ -1805,8 +1803,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, #endif } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); - } else if (strstart(uri, "file:", &p)) { - file_start_outgoing_migration(s, p, &local_err); + } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_start_outgoing_migration(s, &channel->u.file, &local_err); } else { error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085442; cv=none; d=zohomail.com; s=zohoarc; b=Pnlb8Q2ThIl1VGWwE9hrVN9b3+jdsiGPAvkywxOM29VqImlSBrkwaajunlkOqaQx4AqAH0ICbqmONyFLBExG/Fd3/PZv2TSw+dAuOAjjIf1b6JWSQ2YB9t6EmeZ4vzD3Op+lCGL8pGA+bLI2L3hklnWGWEzMHI+2UdVRC2yRbdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085442; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5gw2+G4f+oE+8IybgTRkbt6RJ2g+9XWcSNI0Ux1F8P4=; b=daBJCQF+gvY6KSAZxFFwOXJOgnmHKD+yzGGT8TVVDxaHLED4GT0Jypll6HJ/pl44T+dXpmQXb9mb5CeQcQi684Kho5n2beZ/Rd8aT67TXy8jKFaWg5A0cuEPYWlfTcsaFusqhV8Hf5UwtPkkSobxGfwaICejAvpCzpUrV7JIuS0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085442274685.0528348316091; Mon, 23 Oct 2023 11:24:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYX-0004Hs-Gx; Mon, 23 Oct 2023 14:21:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYW-0004Hj-N1 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:36 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYU-0001Dh-HH for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:36 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3DB2A21B0B; Mon, 23 Oct 2023 18:21:33 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E5827132FD; Mon, 23 Oct 2023 18:21:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sFE4Kqm5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085293; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gw2+G4f+oE+8IybgTRkbt6RJ2g+9XWcSNI0Ux1F8P4=; b=zBO+L3MTzY1PRcMlYRbSHoie0eIenXYvRqce6B5N+Bk3lP/Dv4JhgKAGRjLKZ+JBler+kd 1xU/aLybxSN3CHW/gSNylxgRrBhCsWKZ+AFhHDy3rB766gsj9MEQ7YktLHjZJR9+fGvumK jFOF8RQOli7xALe4kOhBiA3mmFv3SHE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085293; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gw2+G4f+oE+8IybgTRkbt6RJ2g+9XWcSNI0Ux1F8P4=; b=vdcyPvdfODh3O6zi23+v5BUUJ0I463ogdDl4JC0BtrktlEdJVMAO2xnRvxbzdS27jQrFs2 dFT1R9nd1raYzSDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 09/14] migration: New migrate and migrate-incoming argument 'channels' Date: Mon, 23 Oct 2023 15:20:48 -0300 Message-Id: <20231023182053.8711-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -6.10 X-Spamd-Result: default: False [-6.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085442896100002 From: Het Gala MigrateChannelList allows to connect accross multiple interfaces. Add MigrateChannelList struct as argument to migration QAPIs. We plan to include multiple channels in future, to connnect multiple interfaces. Hence, we choose 'MigrateChannelList' as the new argument over 'MigrateChannel' to make migration QAPIs future proof. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Acked-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/migration-hmp-cmds.c | 6 +- migration/migration.c | 56 +++++++++++++++-- qapi/migration.json | 109 ++++++++++++++++++++++++++++++++- system/vl.c | 2 +- 4 files changed, 161 insertions(+), 12 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index a82597f18e..c1a73df7c0 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -447,7 +447,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qd= ict) Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); =20 - qmp_migrate_incoming(uri, &err); + qmp_migrate_incoming(uri, false, NULL, &err); =20 hmp_handle_error(mon, err); } @@ -745,8 +745,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) const char *uri =3D qdict_get_str(qdict, "uri"); Error *err =3D NULL; =20 - qmp_migrate(uri, !!blk, blk, !!inc, inc, - false, false, true, resume, &err); + qmp_migrate(uri, false, NULL, !!blk, blk, !!inc, inc, + false, false, true, resume, &err); if (hmp_handle_error(mon, err)) { return; } diff --git a/migration/migration.c b/migration/migration.c index c8b50b1dd5..4356d9e701 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -481,11 +481,34 @@ static bool migrate_uri_parse(const char *uri, return true; } =20 -static void qemu_start_incoming_migration(const char *uri, Error **errp) +static void qemu_start_incoming_migration(const char *uri, bool has_channe= ls, + MigrationChannelList *channels, + Error **errp) { g_autoptr(MigrationAddress) channel =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + /* + * Having preliminary checks for uri and channel + */ + if (has_channels) { + error_setg(errp, "'channels' argument should not be set yet."); + return; + } + + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in= " + "'migrate-incoming' qmp command "); + return; + } + + if (!uri && !has_channels) { + error_setg(errp, "neither 'uri' or 'channels' argument are " + "specified in 'migrate-incoming' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; @@ -1572,7 +1595,8 @@ void migrate_del_blocker(Error **reasonp) } } =20 -void qmp_migrate_incoming(const char *uri, Error **errp) +void qmp_migrate_incoming(const char *uri, bool has_channels, + MigrationChannelList *channels, Error **errp) { Error *local_err =3D NULL; static bool once =3D true; @@ -1590,7 +1614,7 @@ void qmp_migrate_incoming(const char *uri, Error **er= rp) return; } =20 - qemu_start_incoming_migration(uri, &local_err); + qemu_start_incoming_migration(uri, has_channels, channels, &local_err); =20 if (local_err) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); @@ -1626,7 +1650,7 @@ void qmp_migrate_recover(const char *uri, Error **err= p) * 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, false, NULL, errp); } =20 void qmp_migrate_pause(Error **errp) @@ -1757,7 +1781,8 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, return true; } =20 -void qmp_migrate(const char *uri, bool has_blk, bool blk, +void qmp_migrate(const char *uri, bool has_channels, + MigrationChannelList *channels, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, bool has_resume, bool resume, Error **errp) { @@ -1766,6 +1791,27 @@ void qmp_migrate(const char *uri, bool has_blk, bool= blk, MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationAddress) channel =3D NULL; =20 + /* + * Having preliminary checks for uri and channel + */ + if (has_channels) { + error_setg(errp, "'channels' argument should not be set yet."); + return; + } + + if (uri && has_channels) { + error_setg(errp, "'uri' and 'channels' arguments are mutually " + "exclusive; exactly one of the two should be present in= " + "'migrate' qmp command "); + return; + } + + if (!uri && !has_channels) { + error_setg(errp, "neither 'uri' or 'channels' argument are " + "specified in 'migrate' qmp command "); + return; + } + /* URI is not suitable for migration? */ if (!migration_channels_and_uri_compatible(uri, errp)) { return; diff --git a/qapi/migration.json b/qapi/migration.json index abebe23523..fa9534a661 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1565,6 +1565,34 @@ 'rdma': 'InetSocketAddress', 'file': 'FileMigrationArgs' } } =20 +## +# @MigrationChannelType: +# +# The migration channel-type request options. +# +# @main: Main outbound migration channel. +# +# Since 8.1 +## +{ 'enum': 'MigrationChannelType', + 'data': [ 'main' ] } + +## +# @MigrationChannel: +# +# Migration stream channel parameters. +# +# @channel-type: Channel type for transfering packet information. +# +# @addr: Migration endpoint configuration on destination interface. +# +# Since 8.1 +## +{ 'struct': 'MigrationChannel', + 'data': { + 'channel-type': 'MigrationChannelType', + 'addr': 'MigrationAddress' } } + ## # @migrate: # @@ -1572,6 +1600,9 @@ # # @uri: the Uniform Resource Identifier of the destination VM # +# @channels: list of migration stream channels with each stream in the +# list connected to a destination interface endpoint. +# # @blk: do block migration (full disk copy) # # @inc: incremental disk copy migration @@ -1596,14 +1627,50 @@ # 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. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 6. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } } # <- { "return": {} } +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "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', '*channels': [ 'MigrationChannel' ], + '*blk': 'bool', '*inc': 'bool', '*detach': 'bool', + '*resume': 'bool' } } =20 ## # @migrate-incoming: @@ -1614,6 +1681,9 @@ # @uri: The Uniform Resource Identifier identifying the source or # address to listen on # +# @channels: list of migration stream channels with each stream in the +# list connected to a destination interface endpoint. +# # Returns: nothing on success # # Since: 2.3 @@ -1629,13 +1699,46 @@ # # 3. The uri format is the same as for -incoming # +# 5. For now, number of migration streams is restricted to one, i.e +# number of items in 'channels' list is just 1. +# +# 4. The 'uri' and 'channels' arguments are mutually exclusive; +# exactly one of the two should be present. +# # Example: # # -> { "execute": "migrate-incoming", # "arguments": { "uri": "tcp::4446" } } # <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "socket", +# "type": "inet", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "exec", +# "args": [ "/bin/nc", "-p", "6000", +# "/some/sock" ] } } ] } } +# <- { "return": {} } +# +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "rdma", +# "host": "10.12.34.9", +# "port": "1050" } } ] } } +# <- { "return": {} } ## -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } } +{ 'command': 'migrate-incoming', + 'data': {'*uri': 'str', + '*channels': [ 'MigrationChannel' ] } } =20 ## # @xen-save-devices-state: diff --git a/system/vl.c b/system/vl.c index 92d29bf521..3fb569254a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2702,7 +2702,7 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err =3D NULL; if (strcmp(incoming, "defer") !=3D 0) { - qmp_migrate_incoming(incoming, &local_err); + qmp_migrate_incoming(incoming, false, NULL, &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085415; cv=none; d=zohomail.com; s=zohoarc; b=dUDnvjZd/yVr1i0OSYjRwhHpGq9/kOfa/UrTh5EbJBmXoYmzHaIph9U9KjYlYG4eE+82wBXMR2UI6d5neZQGzpz1WCV7jlr7+RjN59FvHDNBxYMB1M9kvc+sS+ypmYYp9JtUWx34qVhScTjibwQ9ST6WCvi8HyHeBMavBf61GHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085415; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CKye7Pqd1enq30MKET0u/d+kSFKEJVCSxbObdi2ofZc=; b=cMhMB7JBnYBX051pEyp3h/7qbfKV9NIa3Fj8S01Bq3hfkiI0ZHIwnVaaH5g29oAUHGpGq6y1VlWX/XIIVGv82FiZxn3YbGXDeSNLpQlXngM8l83ARJ/iKx9HtePxsxod+OGPVmlFOhkzEj/t9yabIk5sLoUh07sFSmZlNNZepH8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085415303475.9418178201694; Mon, 23 Oct 2023 11:23:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYb-0004V0-4K; Mon, 23 Oct 2023 14:21:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYZ-0004Jl-Fm for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:39 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYY-0001E2-2o for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:39 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E37021FE31; Mon, 23 Oct 2023 18:21:36 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A811B132FD; Mon, 23 Oct 2023 18:21:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SMNuHK25NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CKye7Pqd1enq30MKET0u/d+kSFKEJVCSxbObdi2ofZc=; b=YJOVoy4Khpo7zDRiGfGzvgh4QdN8DNWqT1Q/zkbt5Y0EZ4fxz+LQbvBGiLj2ajS+1IV/Lw iUjNOEbr/ToOdFOycyZc+HKfFBIzBxu5TJWzGZPLCkfDngOCMHvLORjFj6Y9d+h291ZYzb GifYMgbBqmdfvfO7j4LtS4/FOjVrB2A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CKye7Pqd1enq30MKET0u/d+kSFKEJVCSxbObdi2ofZc=; b=f/jF1sE0JeJUZkD6VZXHPrByhBnjKgcTYt0MZwGRNeRjNMazzMGOw+zTpJh+QGWA/4HEFO hp5kYQ6+vkN9sEAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 10/14] fixup! migration: New migrate and migrate-incoming argument 'channels' Date: Mon, 23 Oct 2023 15:20:49 -0300 Message-Id: <20231023182053.8711-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -6.05 X-Spamd-Result: default: False [-6.05 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SUBJECT_HAS_EXCLAIM(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.95)[99.80%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085416756100003 Signed-off-by: Fabiano Rosas Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Markus Armbruster Reviewed-by: Juan Quintela --- qapi/migration.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index fa9534a661..2cfdae894a 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1666,6 +1666,14 @@ # "port": "1050" } } ] } } # <- { "return": {} } # +# -> { "execute": "migrate", +# "arguments": { +# "channels": [ { "channel-type": "main", +# "addr": { "transport": "file", +# "filename": "/tmp/migfile", +# "offset": "0x1000" } } ] } } +# <- { "return": {} } +# ## { 'command': 'migrate', 'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ], --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085442; cv=none; d=zohomail.com; s=zohoarc; b=LwF894OVLG9PpZq2WGLUzeXnJe6+/xbad+vCZmUmwUQpvFYQpV1S8Mr9HTOmSUJ4hUGgRD1UAVzqlVp4hF1JSh5ZGRtOyDfq581+TjNq9oka5ko/2qnUdrVrpgK9SB7z0c2rPJS6rL/OBzqEsZAFg4XqnuTJQTDSWpdjZqaMIXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085442; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p3R0+Jms/ZcB0/ntU88sLc494xgmO7OohZhNqG+UJ1o=; b=AcaREb3kohmZqAcMbz+WbI1UrUgMrbp8+Ghx2h6F3VFvW77Gg6T02SZcMv2YEY4uUehs4jD7QNJhk6fmMcxYN4B5UTY5LmcALubHckD7Iy9aQDZRDEWAqY5aQm0g4qKTrXKs0VlsTlOQgz7FZFipEi2LowKqjBDRgLhP/u4j3b0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169808544273515.152526975660521; Mon, 23 Oct 2023 11:24:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYf-0004fF-Eb; Mon, 23 Oct 2023 14:21:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYd-0004XM-Sw for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:43 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYc-0001EO-8V for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:43 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 88B7E21B0B; Mon, 23 Oct 2023 18:21:40 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 54CFB132FD; Mon, 23 Oct 2023 18:21:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6F4pCLG5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085300; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p3R0+Jms/ZcB0/ntU88sLc494xgmO7OohZhNqG+UJ1o=; b=Lw/sNgAFxrUJRtf32sLKKdY1mQPdCNMjBSxmU5jm1ZzfTUPQl0KfLnpQ/Rqdh4JCr/ddi4 1S7X55kHkSrOFaKM4gYHt+DFDFz+RdKTO4XDYC/0OeJky3qgZgDxn7pgu8ekgEt/2c4FzQ 1TnIqdO+ljowr2KnYxG5RbL7sqX9IFM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085300; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p3R0+Jms/ZcB0/ntU88sLc494xgmO7OohZhNqG+UJ1o=; b=IVKIhzUBKaWOHex0CdBgD9USLZaeuEsmPEBxFLBsx15jJv1anKJXKDgVbTL+pXSiGYnCXN 3E1aMlbUx9OH+LAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 11/14] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Date: Mon, 23 Oct 2023 15:20:50 -0300 Message-Id: <20231023182053.8711-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -6.09 X-Spamd-Result: default: False [-6.09 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.99)[99.93%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085444853100013 From: Het Gala migration_channels_and_uri_compatible() check for transport mechanism suitable for multifd migration gets executed when the caller calls old uri syntax. It needs it to be run when using the modern MigrateChannel QAPI syntax too. After URI -> 'MigrateChannel' : migration_channels_and_uri_compatible() -> migration_channels_and_transport_compatible() passes object as argument and check for valid transport mechanism. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/migration.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4356d9e701..192b7a97be 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -107,17 +107,20 @@ static bool migration_needs_multiple_sockets(void) return migrate_multifd() || migrate_postcopy_preempt(); } =20 -static bool uri_supports_multi_channels(const char *uri) +static bool transport_supports_multi_channels(SocketAddress *saddr) { - return strstart(uri, "tcp:", NULL) || strstart(uri, "unix:", NULL) || - strstart(uri, "vsock:", NULL); + return saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || + saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK; } =20 static bool -migration_channels_and_uri_compatible(const char *uri, Error **errp) +migration_channels_and_transport_compatible(MigrationAddress *addr, + Error **errp) { if (migration_needs_multiple_sockets() && - !uri_supports_multi_channels(uri)) { + (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) && + !transport_supports_multi_channels(&addr->u.socket)) { error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)= "); return false; } @@ -509,15 +512,15 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, return; } =20 - /* URI is not suitable for migration? */ - if (!migration_channels_and_uri_compatible(uri, errp)) { - return; - } - if (uri && !migrate_uri_parse(uri, &channel, errp)) { return; } =20 + /* transport mechanism not suitable for migration? */ + if (!migration_channels_and_transport_compatible(channel, errp)) { + return; + } + migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP); =20 @@ -1812,15 +1815,15 @@ void qmp_migrate(const char *uri, bool has_channels, return; } =20 - /* URI is not suitable for migration? */ - if (!migration_channels_and_uri_compatible(uri, errp)) { - return; - } - if (!migrate_uri_parse(uri, &channel, errp)) { return; } =20 + /* transport mechanism not suitable for migration? */ + if (!migration_channels_and_transport_compatible(channel, errp)) { + return; + } + resume_requested =3D has_resume && resume; if (!migrate_prepare(s, has_blk && blk, has_inc && inc, resume_requested, errp)) { --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085384; cv=none; d=zohomail.com; s=zohoarc; b=TydJi/WDmcDvBvfXIJmMCb0HprQ8bCf1IxjBS7Fc4x9OE73zXEt0Gu5/VVpwMsIAXeed9KPnXbqCS2xi+X3s5H9MvBU+TUIlfQJUw4B7rZkKR3uQ2yCQiaxQqFj6XvEgBqXzeNRLchRv12J/dWfXPMUvJjzWTbpif/pXgD28KCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085384; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gMuF9EByigxxFjxYvHmUtxXTUZVDYlwFVzhIL0T9vI0=; b=TNJY9EzigCk5cbeejLE7EJdrIM2Eq/D04mkkZcyXfFwI3GPjooqY1y7lO5epkYxKYtJ/wC5ZiqbqktxD1R87cUQUhtiUPFpMQVQbg1CO4/2uUn7S4aDI8UrC77hHZMvpwiNNK98W0jA90S3af7FZfy3oDJSRPhw9OCa/cil+TnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085384056357.2428894313814; Mon, 23 Oct 2023 11:23:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYi-0004va-TI; Mon, 23 Oct 2023 14:21:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYh-0004qA-Hz for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:47 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYf-0001En-Ex for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:47 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2CC9A1FE1C; Mon, 23 Oct 2023 18:21:44 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F154E13A82; Mon, 23 Oct 2023 18:21:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kDItLrS5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085304; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMuF9EByigxxFjxYvHmUtxXTUZVDYlwFVzhIL0T9vI0=; b=wqCBu6KTNTUi5W5NPsXj9P48Uiz4luxrGeRJhU/BuzkLnnZwMQS2GcVYrKsHUt8Mklh0ob 04YzADkQ+z7PZfBd5ZFa66Uz+oFHbs4QyovvEggKqu6LKLY9GMXoCTHMxvnSHZERuhcmWT +wA4/76mpSVITeG8/SRiqpAxOYfvm8g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085304; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gMuF9EByigxxFjxYvHmUtxXTUZVDYlwFVzhIL0T9vI0=; b=Ra69ySVGZv+5ky0SLB4ot7o14oB6XlxhoePfrNdToL0MKjlp3R6YT6pVGXW3A6Aq9PWaqD kiNhVX/gOwyWSLCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 12/14] migration: Implement MigrateChannelList to qmp migration flow. Date: Mon, 23 Oct 2023 15:20:51 -0300 Message-Id: <20231023182053.8711-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085384787100001 Content-Type: text/plain; charset="utf-8" From: Het Gala Integrate MigrateChannelList with all transport backends (socket, exec and rdma) for both src and dest migration endpoints for qmp migration. For current series, limit the size of MigrateChannelList to single element (single interface) as runtime check. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- migration/migration.c | 101 +++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 192b7a97be..c4c2f3a266 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -433,9 +433,10 @@ void migrate_add_address(SocketAddress *address) } =20 static bool migrate_uri_parse(const char *uri, - MigrationAddress **channel, + MigrationChannel **channel, Error **errp) { + g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); SocketAddress *saddr =3D NULL; InetSocketAddress *isock =3D &addr->u.rdma; @@ -480,7 +481,9 @@ static bool migrate_uri_parse(const char *uri, return false; } =20 - *channel =3D g_steal_pointer(&addr); + val->channel_type =3D MIGRATION_CHANNEL_TYPE_MAIN; + val->addr =3D g_steal_pointer(&addr); + *channel =3D g_steal_pointer(&val); return true; } =20 @@ -488,44 +491,47 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, MigrationChannelList *channels, Error **errp) { - g_autoptr(MigrationAddress) channel =3D NULL; + MigrationChannel *channel =3D NULL; + MigrationAddress *addr =3D NULL; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 /* * Having preliminary checks for uri and channel */ - if (has_channels) { - error_setg(errp, "'channels' argument should not be set yet."); - return; - } - if (uri && has_channels) { error_setg(errp, "'uri' and 'channels' arguments are mutually " "exclusive; exactly one of the two should be present in= " "'migrate-incoming' qmp command "); return; - } - - if (!uri && !has_channels) { + } else if (channels) { + /* To verify that Migrate channel list has only item */ + if (channels->next) { + error_setg(errp, "Channel list has more than one entries"); + return; + } + channel =3D channels->value; + } else if (uri) { + /* caller uses the old URI syntax */ + if (!migrate_uri_parse(uri, &channel, errp)) { + return; + } + } else { error_setg(errp, "neither 'uri' or 'channels' argument are " "specified in 'migrate-incoming' qmp command "); return; } - - if (uri && !migrate_uri_parse(uri, &channel, errp)) { - return; - } + addr =3D channel->addr; =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(channel, errp)) { + if (!migration_channels_and_transport_compatible(addr, errp)) { return; } =20 migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP); =20 - if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &channel->u.socket; + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { @@ -534,7 +540,7 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, fd_start_incoming_migration(saddr->u.fd.str, errp); } #ifdef CONFIG_RDMA - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { if (migrate_compress()) { error_setg(errp, "RDMA and compression can't be used together"= ); return; @@ -547,12 +553,12 @@ static void qemu_start_incoming_migration(const char = *uri, bool has_channels, error_setg(errp, "RDMA and multifd can't be used together"); return; } - rdma_start_incoming_migration(&channel->u.rdma, errp); + rdma_start_incoming_migration(&addr->u.rdma, errp); #endif - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_incoming_migration(channel->u.exec.args, errp); - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_incoming_migration(&channel->u.file, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_incoming_migration(addr->u.exec.args, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_start_incoming_migration(&addr->u.file, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); } @@ -1792,35 +1798,38 @@ void qmp_migrate(const char *uri, bool has_channels, bool resume_requested; Error *local_err =3D NULL; MigrationState *s =3D migrate_get_current(); - g_autoptr(MigrationAddress) channel =3D NULL; + MigrationChannel *channel =3D NULL; + MigrationAddress *addr =3D NULL; =20 /* * Having preliminary checks for uri and channel */ - if (has_channels) { - error_setg(errp, "'channels' argument should not be set yet."); - return; - } - if (uri && has_channels) { error_setg(errp, "'uri' and 'channels' arguments are mutually " "exclusive; exactly one of the two should be present in= " "'migrate' qmp command "); return; - } - - if (!uri && !has_channels) { + } else if (channels) { + /* To verify that Migrate channel list has only item */ + if (channels->next) { + error_setg(errp, "Channel list has more than one entries"); + return; + } + channel =3D channels->value; + } else if (uri) { + /* caller uses the old URI syntax */ + if (!migrate_uri_parse(uri, &channel, errp)) { + return; + } + } else { error_setg(errp, "neither 'uri' or 'channels' argument are " "specified in 'migrate' qmp command "); return; } - - if (!migrate_uri_parse(uri, &channel, errp)) { - return; - } + addr =3D channel->addr; =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(channel, errp)) { + if (!migration_channels_and_transport_compatible(addr, errp)) { return; } =20 @@ -1837,8 +1846,8 @@ void qmp_migrate(const char *uri, bool has_channels, } } =20 - if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { - SocketAddress *saddr =3D &channel->u.socket; + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { + SocketAddress *saddr =3D &addr->u.socket; if (saddr->type =3D=3D SOCKET_ADDRESS_TYPE_INET || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_UNIX || saddr->type =3D=3D SOCKET_ADDRESS_TYPE_VSOCK) { @@ -1847,13 +1856,13 @@ void qmp_migrate(const char *uri, bool has_channels, fd_start_outgoing_migration(s, saddr->u.fd.str, &local_err); } #ifdef CONFIG_RDMA - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - rdma_start_outgoing_migration(s, &channel->u.rdma, &local_err); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + rdma_start_outgoing_migration(s, &addr->u.rdma, &local_err); #endif - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { - exec_start_outgoing_migration(s, channel->u.exec.args, &local_err); - } else if (channel->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { - file_start_outgoing_migration(s, &channel->u.file, &local_err); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { + exec_start_outgoing_migration(s, addr->u.exec.args, &local_err); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { + file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085441; cv=none; d=zohomail.com; s=zohoarc; b=R+DybN9Yn5nME4jSMbDBhqhQvidU3UaIyJLz1xYOQk0ycFlwdORc4qe80jMLwyRMoKvrgf7yuhC7TRTp/x0auSjNcChwjjXGS+vJo65t/Eol15DNI0L2rZ0N9dFcrAGFCheGYYTe9Y2zDk5A8+8Kgs+2OYmct/fZ6UHvNa+Gh5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085441; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8VREoUcre2b0Zd2fBDDwAYzz/iOqM+jPcSsusIwLH2I=; b=eQznshXW8lf0twQegYBkK9+DkKuM5yceLIgnE+N+qPN/nSFIRwIQiGDzKghUIIVaz+jDgq+qmtRWSjOZuvhUkSkDGVJTWKjRIsCH882LorDhtOV2vwbCGv0/OB72n7Z758jOSqEadGy+NgpkKok8DBg+ouNZmWNZyEcUqfTGuoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085441951572.5523376824663; Mon, 23 Oct 2023 11:24:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYn-0005C1-2I; Mon, 23 Oct 2023 14:21:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYk-0004z3-No for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:50 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYj-0001F6-2H for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:50 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BE93221B0C; Mon, 23 Oct 2023 18:21:47 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 994BC132FD; Mon, 23 Oct 2023 18:21:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kCEcGbi5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085307; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VREoUcre2b0Zd2fBDDwAYzz/iOqM+jPcSsusIwLH2I=; b=f1bxb3B4jP1oi6K0FnDAVVYZ8ecLjj7xWNslJ4Y+H0yySxkl1pNdm0zM7JlxkQrX+RahrF a2G4346jjjk0cZWMGwMaTiVCFathPKIZEWiTdtn22tSzK6DJfRhWSqAuPR4gjcBkZAu7kv BK3tUtM8JHnjiDf2tB+kJKpXK0a0L3s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085307; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VREoUcre2b0Zd2fBDDwAYzz/iOqM+jPcSsusIwLH2I=; b=hIwYxvfaAE7JGZKNZCJONGZHNZiVTGPZSTIB4T75qYlus37iZC6yQWlF+tw7yYiN+QSxJg UkV2gekVScby/cBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH v15 13/14] migration: Implement MigrateChannelList to hmp migration flow. Date: Mon, 23 Oct 2023 15:20:52 -0300 Message-Id: <20231023182053.8711-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -2.08 X-Spamd-Result: default: False [-2.08 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.98)[99.91%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085442870100001 Content-Type: text/plain; charset="utf-8" From: Het Gala Integrate MigrateChannelList with all transport backends (socket, exec and rdma) for both src and dest migration endpoints for hmp migration. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Signed-off-by: Fabiano Rosas --- migration/migration-hmp-cmds.c | 27 ++++++++++++++++++++++----- migration/migration.c | 5 ++--- migration/migration.h | 3 ++- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index c1a73df7c0..ffe32e3b9b 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -446,9 +446,18 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *q= dict) { Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); + MigrationChannelList *caps =3D NULL; + g_autoptr(MigrationChannel) channel =3D NULL; =20 - qmp_migrate_incoming(uri, false, NULL, &err); + if (!migrate_uri_parse(uri, &channel, &err)) { + goto end; + } + QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 + qmp_migrate_incoming(NULL, true, caps, &err); + qapi_free_MigrationChannelList(caps); + +end: hmp_handle_error(mon, err); } =20 @@ -744,12 +753,17 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) bool resume =3D qdict_get_try_bool(qdict, "resume", false); const char *uri =3D qdict_get_str(qdict, "uri"); Error *err =3D NULL; + MigrationChannelList *caps =3D NULL; + g_autoptr(MigrationChannel) channel =3D NULL; =20 - qmp_migrate(uri, false, NULL, !!blk, blk, !!inc, inc, + if (!migrate_uri_parse(uri, &channel, &err)) { + goto end; + } + QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); + + qmp_migrate(NULL, true, caps, !!blk, blk, !!inc, inc, false, false, true, resume, &err); - if (hmp_handle_error(mon, err)) { - return; - } + qapi_free_MigrationChannelList(caps); =20 if (!detach) { HMPMigrationStatus *status; @@ -766,6 +780,9 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) status); timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); } + +end: + hmp_handle_error(mon, err); } =20 void migrate_set_capability_completion(ReadLineState *rs, int nb_args, diff --git a/migration/migration.c b/migration/migration.c index c4c2f3a266..427965099b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -432,9 +432,8 @@ void migrate_add_address(SocketAddress *address) QAPI_CLONE(SocketAddress, address)); } =20 -static bool migrate_uri_parse(const char *uri, - MigrationChannel **channel, - Error **errp) +bool migrate_uri_parse(const char *uri, MigrationChannel **channel, + Error **errp) { g_autoptr(MigrationChannel) val =3D g_new0(MigrationChannel, 1); g_autoptr(MigrationAddress) addr =3D g_new0(MigrationAddress, 1); diff --git a/migration/migration.h b/migration/migration.h index ae82004892..c2a5333e0e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -520,7 +520,8 @@ bool check_dirty_bitmap_mig_alias_map(const BitmapMigra= tionNodeAliasList *bbm, Error **errp); =20 void migrate_add_address(SocketAddress *address); - +bool migrate_uri_parse(const char *uri, MigrationChannel **channel, + Error **errp); int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque); =20 #define qemu_ram_foreach_block \ --=20 2.35.3 From nobody Fri May 17 02:41:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1698085449; cv=none; d=zohomail.com; s=zohoarc; b=M7+n7jx9/AeMrM6MgYzGRDhC21vY+W9rrP0cMbfOAZdb6YCD9BcXJgUha6Xq9RPgru5kRPDwT/J0zIaR/sdRyodJs0RdwiElf1nUvTdwgDXzvIuroR8kAxQVU94MC5YLf57EzJDgNLPcsJenPBVSU4Xn+5UOF8YLin7kF2T8aRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698085449; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tm+Kj2yysVCXtJXjqbtLAD/Qd6fA8zNW/uko9Ebvr0w=; b=VDiyBbe3YdS97ln3kc4F3eA9mxo2gnkpG0AKv+PuzBV2Er+L/qNWYe+DrDp5IlzvC6YemtZZW682G7zs3HTGJZkOlldd/N+S2blgzbCxH9NRWeSi+Ri+ggZwAGRb+rkUclJrbf+NE0rwqcb/VvxC6BTYafAX1ZHu2duljG9ER2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698085449659881.2656771254784; Mon, 23 Oct 2023 11:24:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quzYr-0005HB-KH; Mon, 23 Oct 2023 14:21:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzYo-0005Cd-TK for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:54 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzYn-0001FM-FE for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:21:54 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C938B21B13; Mon, 23 Oct 2023 18:21:51 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 33272132FD; Mon, 23 Oct 2023 18:21:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eNkXALy5NmX8ZwAAMHmgww (envelope-from ); Mon, 23 Oct 2023 18:21:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698085311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tm+Kj2yysVCXtJXjqbtLAD/Qd6fA8zNW/uko9Ebvr0w=; b=hdrZa9FYVp2FUYv9o91++2ufOrtOpeOFg1pHz/3kcbAvpIo0LCkLOLqLHm5uNINfoE9emG S3IJzWf5896s/vCnOwogDNsXKv5d9gIdT53PPSWC8WbROMPdWLfjKAOSIbMo0VIThwMyhj hOsuCVH7FGo1Pdb4w/vSjq53SnGmoPc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698085311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tm+Kj2yysVCXtJXjqbtLAD/Qd6fA8zNW/uko9Ebvr0w=; b=goOIm/F9z+JWV2nhacyhffxFJ2v2itkETJvEESJcZ907vB8PvbJdbvi0qe+7ko60ge46iV 3G23topMiOUxW+AQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: prerna.saxena@nutanix.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 , Juan Quintela , Peter Xu , Leonardo Bras , Thomas Huth , Laurent Vivier Subject: [PATCH v15 14/14] migration: modify test_multifd_tcp_none() to use new QAPI syntax. Date: Mon, 23 Oct 2023 15:20:53 -0300 Message-Id: <20231023182053.8711-15-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231023182053.8711-1-farosas@suse.de> References: <20231023182053.8711-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -0.59 X-Spamd-Result: default: False [-0.59 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[15]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.49)[91.64%] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1698085450951100003 Content-Type: text/plain; charset="utf-8" From: Het Gala modify multifd tcp common test to incorporate the new QAPI syntax defined. Suggested-by: Aravind Retnakaran Signed-off-by: Het Gala Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- tests/qtest/migration-test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index bc70a14642..1c282e357a 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1309,7 +1309,12 @@ static int migrate_postcopy_prepare(QTestState **fro= m_ptr, =20 migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," - " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + " 'arguments': { " + " 'channels': [ { 'channel-type': 'main'= ," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ] } }"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); --=20 2.35.3