From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362598040840.1555273925536; Mon, 30 Oct 2017 04:23:18 -0700 (PDT) Received: from localhost ([::1]:39947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e989t-0006Up-3t for importer@patchew.org; Mon, 30 Oct 2017 07:23:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988A-0005Pc-Ti for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9888-0007jR-9U for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57756) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e9888-0007j2-30 for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E5522D6A27 for ; Mon, 30 Oct 2017 11:21:19 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34C39D6A0B; Mon, 30 Oct 2017 11:21:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2E5522D6A27 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:07 +0100 Message-Id: <20171030112112.6952-2-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 30 Oct 2017 11:21:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/6] qio: Make port 0 work for qio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For tcp sockets we read back what is the socket/address. So we know what is the port that we are listening into. Looked all callers of the function, and they just create the addr, use it, and drop it, so no problem that we always update the port in the address. Signed-off-by: Juan Quintela CC: Daniel P. Berrange --- util/qemu-sockets.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index b47fb45885..b099c88dd1 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -322,13 +322,16 @@ listen_failed: =20 listen_ok: if (update_addr) { + SocketAddress *addr; + + addr =3D socket_local_address(slisten, errp); g_free(saddr->host); - saddr->host =3D g_strdup(uaddr); + saddr->host =3D g_strdup(addr->u.inet.host); g_free(saddr->port); - saddr->port =3D g_strdup_printf("%d", - inet_getport(e) - port_offset); + saddr->port =3D g_strdup(addr->u.inet.port); saddr->has_ipv6 =3D saddr->ipv6 =3D e->ai_family =3D=3D PF_INET6; saddr->has_ipv4 =3D saddr->ipv4 =3D e->ai_family !=3D PF_INET6; + qapi_free_SocketAddress(addr); } freeaddrinfo(res); return slisten; @@ -1047,7 +1050,7 @@ int socket_listen(SocketAddress *addr, Error **errp) =20 switch (addr->type) { case SOCKET_ADDRESS_TYPE_INET: - fd =3D inet_listen_saddr(&addr->u.inet, 0, false, errp); + fd =3D inet_listen_saddr(&addr->u.inet, 0, true, errp); break; =20 case SOCKET_ADDRESS_TYPE_UNIX: --=20 2.13.6 From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362591580588.3106146539841; Mon, 30 Oct 2017 04:23:11 -0700 (PDT) Received: from localhost ([::1]:39946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e989k-0006R4-HB for importer@patchew.org; Mon, 30 Oct 2017 07:23:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988A-0005Pd-Tk for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9889-0007kY-Uq for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47018) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e9889-0007jy-Ol for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D79FC79706 for ; Mon, 30 Oct 2017 11:21:20 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84687D6A25; Mon, 30 Oct 2017 11:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D79FC79706 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:08 +0100 Message-Id: <20171030112112.6952-3-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 30 Oct 2017 11:21:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/6] migration: print features as on off X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Once there, do one thing for line Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/migration.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4de3b551fe..706d2407ec 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2375,10 +2375,15 @@ void migration_global_dump(Monitor *mon) { MigrationState *ms =3D migrate_get_current(); =20 - monitor_printf(mon, "globals: store-global-state=3D%d, only_migratable= =3D%d, " - "send-configuration=3D%d, send-section-footer=3D%d\n", - ms->store_global_state, ms->only_migratable, - ms->send_configuration, ms->send_section_footer); + monitor_printf(mon, "globals:\n"); + monitor_printf(mon, "store-global-state: %s\n", + ms->store_global_state ? "on" : "off"); + monitor_printf(mon, "only-migratable: %s\n", + ms->only_migratable ? "on" : "off"); + monitor_printf(mon, "send-configuration: %s\n", + ms->send_configuration ? "on" : "off"); + monitor_printf(mon, "send-section-footer: %s\n", + ms->send_section_footer ? "on" : "off"); } =20 #define DEFINE_PROP_MIG_CAP(name, x) \ --=20 2.13.6 From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362706748771.4627435513884; Mon, 30 Oct 2017 04:25:06 -0700 (PDT) Received: from localhost ([::1]:39954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e98Bd-0007oI-QT for importer@patchew.org; Mon, 30 Oct 2017 07:24:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988E-0005QW-Km for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e988D-0007mo-Nw for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58684) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e988D-0007mW-HY for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B6CF80F6C for ; Mon, 30 Oct 2017 11:21:24 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37AE3D6A0B; Mon, 30 Oct 2017 11:21:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B6CF80F6C Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:09 +0100 Message-Id: <20171030112112.6952-4-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 30 Oct 2017 11:21:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/6] migration: free addr in the same function that we created it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Otherwise, we can't use it after calling socket_start_incoming_migration Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/socket.c b/migration/socket.c index dee869044a..3a8232dd2d 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -172,7 +172,6 @@ static void socket_start_incoming_migration(SocketAddre= ss *saddr, =20 if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { object_unref(OBJECT(listen_ioc)); - qapi_free_SocketAddress(saddr); return; } =20 @@ -181,7 +180,6 @@ static void socket_start_incoming_migration(SocketAddre= ss *saddr, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); - qapi_free_SocketAddress(saddr); } =20 void tcp_start_incoming_migration(const char *host_port, Error **errp) @@ -191,6 +189,7 @@ void tcp_start_incoming_migration(const char *host_port= , Error **errp) if (!err) { socket_start_incoming_migration(saddr, &err); } + qapi_free_SocketAddress(saddr); error_propagate(errp, err); } =20 @@ -198,4 +197,5 @@ void unix_start_incoming_migration(const char *path, Er= ror **errp) { SocketAddress *saddr =3D unix_build_address(path); socket_start_incoming_migration(saddr, errp); + qapi_free_SocketAddress(saddr); } --=20 2.13.6 From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362788973697.6947687580144; Mon, 30 Oct 2017 04:26:28 -0700 (PDT) Received: from localhost ([::1]:39963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e98D4-0000ON-6s for importer@patchew.org; Mon, 30 Oct 2017 07:26:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988G-0005Rm-IH for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e988F-0007nr-DA for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e988F-0007n8-3v for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F2ACC1871F3 for ; Mon, 30 Oct 2017 11:21:26 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF92DD6A0B; Mon, 30 Oct 2017 11:21:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F2ACC1871F3 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:10 +0100 Message-Id: <20171030112112.6952-5-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 30 Oct 2017 11:21:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/6] migration: Create uri parameter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It will be used to store the uri migration parameter. Right now it is just the parameter code. Signed-off-by: Juan Quintela --- hmp.c | 7 +++++++ migration/migration.c | 13 +++++++++++++ qapi/migration.json | 18 +++++++++++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/hmp.c b/hmp.c index a01be50daa..9c544560bb 100644 --- a/hmp.c +++ b/hmp.c @@ -345,6 +345,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str(MIGRATION_PARAMETER_URI), + params->uri); } =20 qapi_free_MigrationParameters(params); @@ -1667,6 +1670,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) } p->xbzrle_cache_size =3D cache_size; break; + case MIGRATION_PARAMETER_URI: + p->has_uri =3D true; + visit_type_str(v, param, &p->uri, &err); + break; default: assert(0); } diff --git a/migration/migration.c b/migration/migration.c index 706d2407ec..3e48d37880 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -517,6 +517,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->x_multifd_page_count =3D s->parameters.x_multifd_page_count; params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; + params->has_uri =3D true; + params->uri =3D g_strdup(s->parameters.uri); =20 return params; } @@ -893,6 +895,9 @@ static void migrate_params_test_apply(MigrateSetParamet= ers *params, if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size =3D params->xbzrle_cache_size; } + if (params->has_uri) { + dest->uri =3D g_strdup(params->uri); + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -965,6 +970,10 @@ static void migrate_params_apply(MigrateSetParameters = *params, Error **errp) s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; xbzrle_cache_resize(params->xbzrle_cache_size, errp); } + if (params->has_uri) { + g_free(s->parameters.uri); + s->parameters.uri =3D g_strdup(params->uri); + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) @@ -2431,6 +2440,8 @@ static Property migration_properties[] =3D { DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, parameters.xbzrle_cache_size, DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), + DEFINE_PROP_STRING("x-uri", MigrationState, + parameters.uri), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -2465,6 +2476,7 @@ static void migration_instance_finalize(Object *obj) qemu_mutex_destroy(&ms->error_mutex); g_free(params->tls_hostname); g_free(params->tls_creds); + g_free(params->uri); qemu_sem_destroy(&ms->pause_sem); } =20 @@ -2480,6 +2492,7 @@ static void migration_instance_init(Object *obj) =20 params->tls_hostname =3D g_strdup(""); params->tls_creds =3D g_strdup(""); + params->uri =3D g_strdup(""); =20 /* Set has_* up only for parameter checks */ params->has_compress_level =3D true; diff --git a/qapi/migration.json b/qapi/migration.json index bbc4671ded..ebde890604 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -488,6 +488,9 @@ # and a power of 2 # (Since 2.11) # +# @uri: defines the method we are susing to migrate +# (Since 2.11) +# # Since: 2.4 ## { 'enum': 'MigrationParameter', @@ -496,7 +499,7 @@ 'tls-creds', 'tls-hostname', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', 'x-multifd-channels', 'x-multifd-page-count', - 'xbzrle-cache-size' ] } + 'xbzrle-cache-size', 'uri' ] } =20 ## # @MigrateSetParameters: @@ -564,6 +567,10 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# +# @uri: defines the method we are susing to migrate +# (Since 2.11) +# # Since: 2.4 ## # TODO either fuse back into MigrationParameters, or make @@ -582,7 +589,8 @@ '*block-incremental': 'bool', '*x-multifd-channels': 'int', '*x-multifd-page-count': 'int', - '*xbzrle-cache-size': 'size' } } + '*xbzrle-cache-size': 'size' , + '*uri': 'str'} } =20 ## # @migrate-set-parameters: @@ -665,6 +673,9 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# +# @uri: defines the method we are susing to migrate +# (Since 2.11) # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -681,7 +692,8 @@ '*block-incremental': 'bool' , '*x-multifd-channels': 'int', '*x-multifd-page-count': 'int', - '*xbzrle-cache-size': 'size' } } + '*xbzrle-cache-size': 'size' , + '*uri': 'str'} } =20 ## # @query-migrate-parameters: --=20 2.13.6 From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362864759959.364702230331; Mon, 30 Oct 2017 04:27:44 -0700 (PDT) Received: from localhost ([::1]:39969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e98EI-0001Cg-10 for importer@patchew.org; Mon, 30 Oct 2017 07:27:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988L-0005WE-IH for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e988H-0007om-5D for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59280) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e988G-0007oN-TK for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A9CC356D8 for ; Mon, 30 Oct 2017 11:21:28 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93F48D6A1D; Mon, 30 Oct 2017 11:21:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0A9CC356D8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:11 +0100 Message-Id: <20171030112112.6952-6-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 30 Oct 2017 11:21:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/6] migration: Now set the migration uri X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 25 ++++++++++++++++++------- migration/migration.h | 2 ++ migration/socket.c | 7 +++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3e48d37880..507226907b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -240,10 +240,21 @@ void migrate_send_rp_req_pages(MigrationIncomingState= *mis, const char *rbname, } } =20 +void migrate_set_uri(const char *uri, Error **errp) +{ + MigrateSetParameters p =3D { + .has_uri =3D true, + .uri =3D (char *)uri, + }; + + qmp_migrate_set_parameters(&p, errp); +} + void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; =20 + migrate_set_uri(uri, errp); qapi_event_send_migration(MIGRATION_STATUS_SETUP, &error_abort); if (!strcmp(uri, "defer")) { deferred_incoming_migration(errp); @@ -1363,7 +1374,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, error_setg(errp, "Guest is waiting for an incoming migration"); return; } - + migrate_set_uri(uri, errp); if (migration_is_blocked(errp)) { return; } @@ -1388,20 +1399,20 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, =20 s =3D migrate_init(); =20 - if (strstart(uri, "tcp:", &p)) { + if (strstart(s->parameters.uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA - } else if (strstart(uri, "rdma:", &p)) { + } else if (strstart(s->parameters.uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif - } else if (strstart(uri, "exec:", &p)) { + } else if (strstart(s->parameters.uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); - } else if (strstart(uri, "unix:", &p)) { + } else if (strstart(s->parameters.uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); - } else if (strstart(uri, "fd:", &p)) { + } else if (strstart(s->parameters.uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "s->parameters.uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); diff --git a/migration/migration.h b/migration/migration.h index 663415fe48..cb0ab4807a 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -210,4 +210,6 @@ void migrate_send_rp_pong(MigrationIncomingState *mis, void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rb= name, ram_addr_t start, size_t len); =20 +void migrate_set_uri(const char *uri, Error **errp); + #endif diff --git a/migration/socket.c b/migration/socket.c index 3a8232dd2d..c3ab81d1fb 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -187,7 +187,14 @@ void tcp_start_incoming_migration(const char *host_por= t, Error **errp) Error *err =3D NULL; SocketAddress *saddr =3D tcp_build_address(host_port, &err); if (!err) { + char *new_uri; socket_start_incoming_migration(saddr, &err); + if (!err) { + new_uri =3D g_strdup_printf("tcp:%s:%s", saddr->u.inet.host, + saddr->u.inet.port); + migrate_set_uri(new_uri, &err); + g_free(new_uri); + } } qapi_free_SocketAddress(saddr); error_propagate(errp, err); --=20 2.13.6 From nobody Sat Apr 27 16:54:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509362708448784.3678555584227; Mon, 30 Oct 2017 04:25:08 -0700 (PDT) Received: from localhost ([::1]:39955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e98Bi-0007qm-Ex for importer@patchew.org; Mon, 30 Oct 2017 07:25:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e988L-0005WF-IC for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e988J-0007ps-1x for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39756) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e988I-0007p9-Ol for qemu-devel@nongnu.org; Mon, 30 Oct 2017 07:21:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D2CA97EA92 for ; Mon, 30 Oct 2017 11:21:29 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60E4AD6A18; Mon, 30 Oct 2017 11:21:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D2CA97EA92 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 12:21:12 +0100 Message-Id: <20171030112112.6952-7-quintela@redhat.com> In-Reply-To: <20171030112112.6952-1-quintela@redhat.com> References: <20171030112112.6952-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 30 Oct 2017 11:21:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/6] migration: make migrate uri parameter optional X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that we have set an uri migration parameter, we can make it optional in the command line. Signed-off-by: Juan Quintela --- hmp-commands.hx | 4 ++-- hmp.c | 5 +++-- migration/migration.c | 12 +++++++++--- qapi/migration.json | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 4afd57cf5f..5be4e3934d 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -928,8 +928,8 @@ ETEXI =20 { .name =3D "migrate", - .args_type =3D "detach:-d,blk:-b,inc:-i,uri:s", - .params =3D "[-d] [-b] [-i] uri", + .args_type =3D "detach:-d,blk:-b,inc:-i,uri:-s", + .params =3D "[-d] [-b] [-i] [uri]", .help =3D "migrate to URI (using -d to not wait for completi= on)" "\n\t\t\t -b for migration without shared storage with" " full copy of disk\n\t\t\t -i for migration without " diff --git a/hmp.c b/hmp.c index 9c544560bb..f8fae740e8 100644 --- a/hmp.c +++ b/hmp.c @@ -1938,10 +1938,11 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) bool detach =3D qdict_get_try_bool(qdict, "detach", false); bool blk =3D qdict_get_try_bool(qdict, "blk", false); bool inc =3D qdict_get_try_bool(qdict, "inc", false); - const char *uri =3D qdict_get_str(qdict, "uri"); + bool has_uri =3D qdict_get_try_bool(qdict, "uri", false); + const char *uri =3D qdict_get_try_str(qdict, "uri"); Error *err =3D NULL; =20 - qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, &err); + qmp_migrate(!!has_uri, uri, !!blk, blk, !!inc, inc, false, false, &err= ); if (err) { error_report_err(err); return; diff --git a/migration/migration.c b/migration/migration.c index 507226907b..3818a83489 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1356,7 +1356,7 @@ bool migration_is_blocked(Error **errp) return false; } =20 -void qmp_migrate(const char *uri, bool has_blk, bool blk, +void qmp_migrate(bool has_uri, const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { @@ -1374,7 +1374,13 @@ void qmp_migrate(const char *uri, bool has_blk, bool= blk, error_setg(errp, "Guest is waiting for an incoming migration"); return; } - migrate_set_uri(uri, errp); + if (has_uri && uri) { + migrate_set_uri(uri, errp); + } + if (!s->parameters.uri) { + error_setg(errp, "Migration uri needs to be set"); + return; + } if (migration_is_blocked(errp)) { return; } @@ -1412,7 +1418,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, } else if (strstart(s->parameters.uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "s->parameters.uri", + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "migration uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); diff --git a/qapi/migration.json b/qapi/migration.json index ebde890604..6b9758ab99 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1042,7 +1042,7 @@ # ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool'= } } + 'data': {'*uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool= ' } } =20 ## # @migrate-incoming: --=20 2.13.6