From patchwork Mon Oct 30 11:21:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 10032335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C2566039A for ; Mon, 30 Oct 2017 11:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 548D128818 for ; Mon, 30 Oct 2017 11:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47F1328858; Mon, 30 Oct 2017 11:27:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E460028818 for ; Mon, 30 Oct 2017 11:27:29 +0000 (UTC) Received: from localhost ([::1]:39966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e98E5-0000iV-9E for patchwork-qemu-devel@patchwork.kernel.org; Mon, 30 Oct 2017 07:27:29 -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) 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 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) 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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, } } +void migrate_set_uri(const char *uri, Error **errp) +{ + MigrateSetParameters p = { + .has_uri = true, + .uri = (char *)uri, + }; + + qmp_migrate_set_parameters(&p, errp); +} + void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; + 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, bool blk, s = migrate_init(); - 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* rbname, ram_addr_t start, size_t len); +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_port, Error **errp) Error *err = NULL; SocketAddress *saddr = tcp_build_address(host_port, &err); if (!err) { + char *new_uri; socket_start_incoming_migration(saddr, &err); + if (!err) { + new_uri = 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);