From nobody Sat Apr 5 18:35:23 2025 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=1738168194; cv=none; d=zohomail.com; s=zohoarc; b=NNV3ZkMNuOLX2/oIYXQJo5Wmc5w0q1h6Fv8vFQJH6csBOuPbVarDr/E13ldLG30BwSmB1DFSBAvwyNFF8PYSu6YB19Liy801xhFskzFKXqdiVYDejss+wPYs1TUjnz9GYDl2n58sRIlyE9GZp/P9Q8nmPIDe9+9yW0j9glAdKHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738168194; 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=TUnVXpFQqxzjBZXmvQTIkTsUNjcdzug5M7k2BEjvNoA=; b=C4VaYDnqCYq9hu5UlB/Z8JaYAdv9NU8V5H0sAlJE66duJhYgT66LySERVWh8pVWm/OdKp5ZZrTBO04sXHYUsHw7L4vZoSEcErlpQlIDJCKrgRautDphlKd8qF/rdScjvspZN7ZG1iK/X++nwGOZtqEe5I+B3DcOZhGV3Ofz7vXA= 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 1738168194853869.0482530751128; Wed, 29 Jan 2025 08:29:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tdAXL-0005F9-VR; Wed, 29 Jan 2025 11:03:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tdAVV-0003HE-AM for qemu-devel@nongnu.org; Wed, 29 Jan 2025 11:01:39 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tdAVT-0005Hg-6i for qemu-devel@nongnu.org; Wed, 29 Jan 2025 11:01:37 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8B9661F383; Wed, 29 Jan 2025 16:01:33 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 42572137DB; Wed, 29 Jan 2025 16:01:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id AJQLAdxQmmffPAAAD6G6ig (envelope-from ); Wed, 29 Jan 2025 16:01:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738166493; 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=TUnVXpFQqxzjBZXmvQTIkTsUNjcdzug5M7k2BEjvNoA=; b=TSKWmTIQ56yNCM13wPSFmspGltRJ9iRe2PEccMUXQVnjrlnRtuUCajKQrWOefuAuBBpQ5G Lx3h9mxVvb3Y0kuAcSw6B6YN3qWQzIHJ/2r/4Wdv+RKTC7fY2rSB8zlzFE5Et+eRFksbWa VGbHoqTNirSM5SF2AQ6ah/xCo5TLaVY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738166493; 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=TUnVXpFQqxzjBZXmvQTIkTsUNjcdzug5M7k2BEjvNoA=; b=Dy2CKKNO0AbM2qLHhl/17rjv9IcCqGg3VX8UJtUNT68qPvWrDV+M1AL3eY64561pZvUlxd ogJYzqzMCvPCh0BA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738166493; 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=TUnVXpFQqxzjBZXmvQTIkTsUNjcdzug5M7k2BEjvNoA=; b=TSKWmTIQ56yNCM13wPSFmspGltRJ9iRe2PEccMUXQVnjrlnRtuUCajKQrWOefuAuBBpQ5G Lx3h9mxVvb3Y0kuAcSw6B6YN3qWQzIHJ/2r/4Wdv+RKTC7fY2rSB8zlzFE5Et+eRFksbWa VGbHoqTNirSM5SF2AQ6ah/xCo5TLaVY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738166493; 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=TUnVXpFQqxzjBZXmvQTIkTsUNjcdzug5M7k2BEjvNoA=; b=Dy2CKKNO0AbM2qLHhl/17rjv9IcCqGg3VX8UJtUNT68qPvWrDV+M1AL3eY64561pZvUlxd ogJYzqzMCvPCh0BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Steve Sistare Subject: [PULL 13/42] migration: incoming channel Date: Wed, 29 Jan 2025 13:00:30 -0300 Message-Id: <20250129160059.6987-14-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250129160059.6987-1-farosas@suse.de> References: <20250129160059.6987-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,oracle.com:email]; RCVD_TLS_ALL(0.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.223.131; 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1738168195257019000 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Extend the -incoming option to allow an @MigrationChannel to be specified. This allows channels other than 'main' to be described on the command line, which will be needed for CPR. Signed-off-by: Steve Sistare Acked-by: Peter Xu Link: https://lore.kernel.org/r/1736967650-129648-13-git-send-email-steven.= sistare@oracle.com Signed-off-by: Fabiano Rosas --- migration/migration.c | 21 ++++++++++++++++----- qemu-options.hx | 21 +++++++++++++++++++++ system/vl.c | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b5ee98e691..5f2540fac3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -695,7 +695,8 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, if (channels) { /* To verify that Migrate channel list has only item */ if (channels->next) { - error_setg(errp, "Channel list has more than one entries"); + error_setg(errp, "Channel list must have only one entry, " + "for type 'main'"); return; } addr =3D channels->value->addr; @@ -2054,6 +2055,7 @@ void qmp_migrate(const char *uri, bool has_channels, MigrationState *s =3D migrate_get_current(); g_autoptr(MigrationChannel) channel =3D NULL; MigrationAddress *addr =3D NULL; + MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] =3D { NULL }; =20 /* * Having preliminary checks for uri and channel @@ -2064,12 +2066,21 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 if (channels) { - /* To verify that Migrate channel list has only item */ - if (channels->next) { - error_setg(errp, "Channel list has more than one entries"); + for ( ; channels; channels =3D channels->next) { + MigrationChannelType type =3D channels->value->channel_type; + + if (channelv[type]) { + error_setg(errp, "Channel list has more than one %s entry", + MigrationChannelType_str(type)); + return; + } + channelv[type] =3D channels->value; + } + addr =3D channelv[MIGRATION_CHANNEL_TYPE_MAIN]->addr; + if (!addr) { + error_setg(errp, "Channel list has no main entry"); return; } - addr =3D channels->value->addr; } =20 if (uri) { diff --git a/qemu-options.hx b/qemu-options.hx index 90fad31590..3d1af7325b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4940,10 +4940,18 @@ DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ "-incoming exec:cmdline\n" \ " accept incoming migration on given file descriptor\n"= \ " or from given external command\n" \ + "-incoming \n" \ + " accept incoming migration on the migration channel\n"= \ "-incoming defer\n" \ " wait for the URI to be specified via migrate_incoming= \n", QEMU_ARCH_ALL) SRST +The -incoming option specifies the migration channel for an incoming +migration. It may be used multiple times to specify multiple +migration channel types. The channel type is specified in , +or is 'main' for all other forms of -incoming. If multiple -incoming +options are specified for a channel type, the last one takes precedence. + ``-incoming tcp:[host]:port[,to=3Dmaxport][,ipv4=3Don|off][,ipv6=3Don|off]= `` \=20 ``-incoming rdma:host:port[,ipv4=3Don|off][,ipv6=3Don|off]`` @@ -4963,6 +4971,19 @@ SRST Accept incoming migration as an output from specified external command. =20 +``-incoming `` + Accept incoming migration on the migration channel. For the syntax + of , see the QAPI documentation of ``MigrationChannel``. + Examples: + :: + + -incoming '{"channel-type": "main", + "addr": { "transport": "socket", + "type": "unix", + "path": "my.sock" }}' + + -incoming main,addr.transport=3Dsocket,addr.type=3Dunix,addr.path= =3Dmy.sock + ``-incoming defer`` Wait for the URI to be specified via migrate\_incoming. The monitor can be used to change settings (such as migration parameters) prior diff --git a/system/vl.c b/system/vl.c index c567826718..504f05b954 100644 --- a/system/vl.c +++ b/system/vl.c @@ -123,6 +123,7 @@ #include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-compat.h" #include "qapi/qapi-visit-machine.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/qapi-visit-ui.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-commands-migration.h" @@ -159,6 +160,8 @@ typedef struct DeviceOption { static const char *cpu_option; static const char *mem_path; static const char *incoming; +static const char *incoming_str[MIGRATION_CHANNEL_TYPE__MAX]; +static MigrationChannel *incoming_channels[MIGRATION_CHANNEL_TYPE__MAX]; static const char *loadvm; static const char *accelerators; static bool have_custom_ram_size; @@ -1813,6 +1816,30 @@ static void object_option_add_visitor(Visitor *v) QTAILQ_INSERT_TAIL(&object_opts, opt, next); } =20 +static void incoming_option_parse(const char *str) +{ + MigrationChannelType type =3D MIGRATION_CHANNEL_TYPE_MAIN; + MigrationChannel *channel; + Visitor *v; + + if (!strcmp(str, "defer")) { + channel =3D NULL; + } else if (migrate_is_uri(str)) { + migrate_uri_parse(str, &channel, &error_fatal); + } else { + v =3D qobject_input_visitor_new_str(str, "channel-type", &error_fa= tal); + visit_type_MigrationChannel(v, NULL, &channel, &error_fatal); + visit_free(v); + type =3D channel->channel_type; + } + + /* New incoming spec replaces the previous */ + qapi_free_MigrationChannel(incoming_channels[type]); + incoming_channels[type] =3D channel; + incoming_str[type] =3D str; + incoming =3D incoming_str[MIGRATION_CHANNEL_TYPE_MAIN]; +} + static void object_option_parse(const char *str) { QemuOpts *opts; @@ -2738,8 +2765,11 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err =3D NULL; if (strcmp(incoming, "defer") !=3D 0) { - qmp_migrate_incoming(incoming, false, NULL, true, true, - &local_err); + g_autofree MigrationChannelList *channels =3D + g_new0(MigrationChannelList, 1); + + channels->value =3D incoming_channels[MIGRATION_CHANNEL_TYPE_M= AIN]; + qmp_migrate_incoming(NULL, true, channels, true, true, &local_= err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); @@ -3458,7 +3488,7 @@ void qemu_init(int argc, char **argv) if (!incoming) { runstate_set(RUN_STATE_INMIGRATE); } - incoming =3D optarg; + incoming_option_parse(optarg); break; case QEMU_OPTION_only_migratable: only_migratable =3D 1; --=20 2.35.3