From nobody Sat May 4 09:05:59 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 15172287035471009.245290507611; Mon, 29 Jan 2018 04:25:03 -0800 (PST) Received: from localhost ([::1]:33744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8Ug-0001Sw-MU for importer@patchew.org; Mon, 29 Jan 2018 07:25:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8O1-0004Vl-8U for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg8Nv-0000zh-00 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg8Nu-0000zG-OK for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:02 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 197C681239 for ; Mon, 29 Jan 2018 12:18:02 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id A37C25D98E; Mon, 29 Jan 2018 12:18:00 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 13:17:50 +0100 Message-Id: <20180129121754.13033-2-quintela@redhat.com> In-Reply-To: <20180129121754.13033-1-quintela@redhat.com> References: <20180129121754.13033-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 29 Jan 2018 12:18:02 +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 v5 1/5] migration: Create tcp_port 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 tcp_port parameter. This is the only parameter than can change and we can need to be able to connect to it. Signed-off-by: Juan Quintela -- This used to be uri parameter, but it has so many troubles to reproduce that it don't just make sense. --- hmp.c | 3 +++ migration/migration.c | 8 ++++++++ qapi/migration.json | 19 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hmp.c b/hmp.c index b3de32d219..369cb991f2 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: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); + monitor_printf(mon, "%s: %d\n", + MigrationParameter_str(MIGRATION_PARAMETER_X_TCP_PORT), + params->x_tcp_port); } =20 qapi_free_MigrationParameters(params); diff --git a/migration/migration.c b/migration/migration.c index 44cbfb0ddd..eb6958dcda 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -522,6 +522,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_x_tcp_port =3D true; + params->x_tcp_port =3D s->parameters.x_tcp_port; =20 return params; } @@ -889,6 +891,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_x_tcp_port) { + dest->x_tcp_port =3D params->x_tcp_port; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -961,6 +966,9 @@ 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_x_tcp_port) { + s->parameters.x_tcp_port =3D params->x_tcp_port; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) diff --git a/qapi/migration.json b/qapi/migration.json index 4cd3d13158..26661b0df6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -488,6 +488,9 @@ # and a power of 2 # (Since 2.11) # +# @x-tcp-port: Only used for tcp, to know what the real port is +# (Since 2.12) +# # 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', 'x-tcp-port' ] } =20 ## # @MigrateSetParameters: @@ -564,6 +567,10 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# +# @x-tcp-port: Only used for tcp, to know what the real port is +# (Since 2.12) +# # 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', + '*x-tcp-port': 'uint16'} } =20 ## # @migrate-set-parameters: @@ -665,6 +673,10 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# +# @x-tcp-port: Only used for tcp, to know what the real port is +# (Since 2.12) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -681,7 +693,8 @@ '*block-incremental': 'bool' , '*x-multifd-channels': 'uint8', '*x-multifd-page-count': 'uint32', - '*xbzrle-cache-size': 'size' } } + '*xbzrle-cache-size': 'size', + '*x-tcp-port': 'uint16'} } =20 ## # @query-migrate-parameters: --=20 2.14.3 From nobody Sat May 4 09:05:59 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 15172288416648.993858568433097; Mon, 29 Jan 2018 04:27:21 -0800 (PST) Received: from localhost ([::1]:34009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8Ws-0003XI-MC for importer@patchew.org; Mon, 29 Jan 2018 07:27:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8O3-0004Vq-32 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg8Nw-00011X-RH for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56176) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg8Nw-00010s-KG for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:04 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 012858764A for ; Mon, 29 Jan 2018 12:18:04 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EB6A5D98E; Mon, 29 Jan 2018 12:18:02 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 13:17:51 +0100 Message-Id: <20180129121754.13033-3-quintela@redhat.com> In-Reply-To: <20180129121754.13033-1-quintela@redhat.com> References: <20180129121754.13033-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 29 Jan 2018 12:18:04 +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 v5 2/5] migration: Set the migration tcp port 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" We can set the port parameter as zero. This patch lets us know what port the system was choosen for us. Now we can migrate to this place. Signed-off-by: Juan Quintela -- This was migrate_set_uri(), but as we only need the tcp_port, change to that one. --- migration/migration.c | 10 ++++++++++ migration/migration.h | 2 ++ migration/socket.c | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index eb6958dcda..53818a87af 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -245,6 +245,16 @@ void migrate_send_rp_req_pages(MigrationIncomingState = *mis, const char *rbname, } } =20 +void migrate_set_port(const uint16_t port, Error **errp) +{ + MigrateSetParameters p =3D { + .has_x_tcp_port =3D true, + .x_tcp_port =3D port, + }; + + qmp_migrate_set_parameters(&p, errp); +} + void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; diff --git a/migration/migration.h b/migration/migration.h index d3b214e5ba..7c9ac3f00b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -232,4 +232,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_port(const uint16_t port, Error **errp); + #endif diff --git a/migration/socket.c b/migration/socket.c index e090097077..08606c665d 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" =20 #include "qemu-common.h" #include "qemu/error-report.h" @@ -160,17 +161,24 @@ out: } =20 =20 -static void socket_start_incoming_migration(SocketAddress *saddr, - Error **errp) +static SocketAddress *socket_start_incoming_migration(SocketAddress *saddr, + Error **errp) { QIOChannelSocket *listen_ioc =3D qio_channel_socket_new(); + SocketAddress *address; =20 qio_channel_set_name(QIO_CHANNEL(listen_ioc), "migration-socket-listener"); =20 if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { object_unref(OBJECT(listen_ioc)); - return; + return NULL; + } + + address =3D qio_channel_socket_get_local_address(listen_ioc, errp); + if (address < 0) { + object_unref(OBJECT(listen_ioc)); + return NULL; } =20 qio_channel_add_watch(QIO_CHANNEL(listen_ioc), @@ -178,14 +186,28 @@ static void socket_start_incoming_migration(SocketAdd= ress *saddr, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); + return address; } =20 void tcp_start_incoming_migration(const char *host_port, Error **errp) { Error *err =3D NULL; SocketAddress *saddr =3D tcp_build_address(host_port, &err); + if (!err) { - socket_start_incoming_migration(saddr, &err); + SocketAddress *address =3D socket_start_incoming_migration(saddr, = &err); + + if (address) { + unsigned long long port; + + if (parse_uint_full(address->u.inet.port, &port, 10) < 0) { + error_setg(errp, "error parsing port in '%s'", + address->u.inet.port); + } else { + migrate_set_port(port, errp); + } + qapi_free_SocketAddress(address); + } } qapi_free_SocketAddress(saddr); error_propagate(errp, err); @@ -194,6 +216,9 @@ void tcp_start_incoming_migration(const char *host_port= , Error **errp) void unix_start_incoming_migration(const char *path, Error **errp) { SocketAddress *saddr =3D unix_build_address(path); - socket_start_incoming_migration(saddr, errp); + SocketAddress *address; + + address =3D socket_start_incoming_migration(saddr, errp); + qapi_free_SocketAddress(address); qapi_free_SocketAddress(saddr); } --=20 2.14.3 From nobody Sat May 4 09:05:59 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 1517228931827752.7420113496296; Mon, 29 Jan 2018 04:28:51 -0800 (PST) Received: from localhost ([::1]:34210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8YN-0004qH-0i for importer@patchew.org; Mon, 29 Jan 2018 07:28:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8O5-0004Z8-Su for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg8Nz-000144-UB for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg8Nz-00013J-Mv for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A27933BD2 for ; Mon, 29 Jan 2018 12:18:07 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55F397E087; Mon, 29 Jan 2018 12:18:04 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 13:17:52 +0100 Message-Id: <20180129121754.13033-4-quintela@redhat.com> In-Reply-To: <20180129121754.13033-1-quintela@redhat.com> References: <20180129121754.13033-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 29 Jan 2018 12:18:07 +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 v5 3/5] tests: Migration ppc now inlines its program 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" No need to write it to a file. Just need a proper firmware O:-) Signed-off-by: Juan Quintela CC: Laurent Vivier --- tests/migration-test.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index fcad2ed460..26439f6071 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -18,9 +18,6 @@ #include "qemu/sockets.h" #include "chardev/char.h" #include "sysemu/sysemu.h" -#include "hw/nvram/chrp_nvram.h" - -#define MIN_NVRAM_SIZE 8192 /* from spapr_nvram.c */ =20 const unsigned start_address =3D 1024 * 1024; const unsigned end_address =3D 100 * 1024 * 1024; @@ -133,36 +130,6 @@ static void init_bootfile_x86(const char *bootpath) fclose(bootfile); } =20 -static void init_bootfile_ppc(const char *bootpath) -{ - FILE *bootfile; - char buf[MIN_NVRAM_SIZE]; - ChrpNvramPartHdr *header =3D (ChrpNvramPartHdr *)buf; - - memset(buf, 0, MIN_NVRAM_SIZE); - - /* Create a "common" partition in nvram to store boot-command property= */ - - header->signature =3D CHRP_NVPART_SYSTEM; - memcpy(header->name, "common", 6); - chrp_nvram_finish_partition(header, MIN_NVRAM_SIZE); - - /* FW_MAX_SIZE is 4MB, but slof.bin is only 900KB, - * so let's modify memory between 1MB and 100MB - * to do like PC bootsector - */ - - sprintf(buf + 16, - "boot-command=3Dhex .\" _\" begin %x %x do i c@ 1 + i c! 1000 = +loop " - ".\" B\" 0 until", end_address, start_address); - - /* Write partition to the NVRAM file */ - - bootfile =3D fopen(bootpath, "wb"); - g_assert_cmpint(fwrite(buf, MIN_NVRAM_SIZE, 1, bootfile), =3D=3D, 1); - fclose(bootfile); -} - /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -453,12 +420,14 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, if (access("/sys/module/kvm_hv", F_OK)) { accel =3D "tcg"; } - init_bootfile_ppc(bootpath); cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 256M" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" - " -drive file=3D%s,if=3Dpflash,format=3D= raw", - accel, tmpfs, bootpath); + " -prom-env '" + "boot-command=3Dhex .\" _\" begin %x %x " + "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " + "until'", accel, tmpfs, end_address, + start_address); cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 256M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" --=20 2.14.3 From nobody Sat May 4 09:05:59 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 151722850766937.837777828107846; Mon, 29 Jan 2018 04:21:47 -0800 (PST) Received: from localhost ([::1]:33421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8RW-0006xl-Pr for importer@patchew.org; Mon, 29 Jan 2018 07:21:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8O7-0004aF-2z for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg8O1-00015Q-BH for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44228) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg8O1-00014X-41 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 744FF28209 for ; Mon, 29 Jan 2018 12:18:08 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D1CD7E091; Mon, 29 Jan 2018 12:18:06 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 13:17:53 +0100 Message-Id: <20180129121754.13033-5-quintela@redhat.com> In-Reply-To: <20180129121754.13033-1-quintela@redhat.com> References: <20180129121754.13033-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 29 Jan 2018 12:18:08 +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 v5 4/5] tests: Add basic migration precopy tcp test 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" Not sharing code from precopy/unix because we have to read back the tcp parameter. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- tests/migration-test.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++= +--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 26439f6071..355e6d18e9 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -320,8 +320,7 @@ static void cleanup(const char *filename) g_free(path); } =20 -static void migrate_check_parameter(QTestState *who, const char *parameter, - const char *value) +static char *migrate_get_parameter(QTestState *who, const char *parameter) { QDict *rsp, *rsp_return; char *result; @@ -330,9 +329,18 @@ static void migrate_check_parameter(QTestState *who, c= onst char *parameter, rsp_return =3D qdict_get_qdict(rsp, "return"); result =3D g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, parameter, -1)= ); + QDECREF(rsp); + return result; +} + +static void migrate_check_parameter(QTestState *who, const char *parameter, + const char *value) +{ + char *result; + + result =3D migrate_get_parameter(who, parameter); g_assert_cmpstr(result, =3D=3D, value); g_free(result); - QDECREF(rsp); } =20 static void migrate_set_parameter(QTestState *who, const char *parameter, @@ -664,6 +672,49 @@ static void test_xbzrle_unix(void) g_free(uri); } =20 +static void test_precopy_tcp(void) +{ + char *uri; + char *port; + QTestState *from, *to; + + test_migrate_start(&from, &to, "tcp:127.0.0.1:0"); + + /* We want to pick a speed slow enough that the test completes + * quickly, but that it doesn't complete precopy even on a slow + * machine, so also set the downtime. + */ + /* 1 ms should make it not converge*/ + migrate_set_parameter(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + port =3D migrate_get_parameter(to, "x-tcp-port"); + uri =3D g_strdup_printf("tcp:127.0.0.1:%s", port); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); + g_free(uri); + g_free(port); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -684,6 +735,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); =20 qtest_add_func("/migration/precopy/unix", test_precopy_unix); + qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); qtest_add_func("/migration/deprecated", test_deprecated); qtest_add_func("/migration/postcopy/unix", test_postcopy); qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); --=20 2.14.3 From nobody Sat May 4 09:05:59 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 1517229005209550.2813056312349; Mon, 29 Jan 2018 04:30:05 -0800 (PST) Received: from localhost ([::1]:34262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8ZY-0005Zb-7M for importer@patchew.org; Mon, 29 Jan 2018 07:30:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg8O8-0004be-JG for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg8O3-000175-Tr for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg8O3-00016k-Ni for qemu-devel@nongnu.org; Mon, 29 Jan 2018 07:18:11 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13E1372665 for ; Mon, 29 Jan 2018 12:18:11 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8CAD7E080; Mon, 29 Jan 2018 12:18:08 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 13:17:54 +0100 Message-Id: <20180129121754.13033-6-quintela@redhat.com> In-Reply-To: <20180129121754.13033-1-quintela@redhat.com> References: <20180129121754.13033-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 29 Jan 2018 12:18:11 +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 v5 5/5] [RFH] tests: Add migration compress threads tests 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" Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness. For some reason, compression is not working at the moment, test is disabled until I found why. Signed-off-by: Juan Quintela --- tests/migration-test.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 52 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 355e6d18e9..02d8ae7cb6 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -715,6 +715,55 @@ static void test_precopy_tcp(void) g_free(port); } =20 +static void test_compress(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri); + + /* We want to pick a speed slow enough that the test completes + * quickly, but that it doesn't complete precopy even on a slow + * machine, so also set the downtime. + */ + /* 1 ms should make it not converge*/ + migrate_set_parameter(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "100000000"); + + migrate_set_parameter(from, "compress-threads", "4"); + migrate_set_parameter(to, "decompress-threads", "3"); + + migrate_set_capability(from, "compress", "true"); + migrate_set_capability(to, "compress", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); +} + +static void test_compress_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_compress(uri); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -739,6 +788,9 @@ int main(int argc, char **argv) qtest_add_func("/migration/deprecated", test_deprecated); qtest_add_func("/migration/postcopy/unix", test_postcopy); qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); + if (0) { + qtest_add_func("/migration/compress/unix", test_compress_unix); + } =20 ret =3D g_test_run(); =20 --=20 2.14.3