From nobody Fri Apr 19 03:57: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.zoho.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 148763624763863.81907266400435; Mon, 20 Feb 2017 16:17:27 -0800 (PST) Received: from localhost ([::1]:41580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfy8z-00081J-CG for importer@patchew.org; Mon, 20 Feb 2017 19:17:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfy7y-0007d5-PZ for qemu-devel@nongnu.org; Mon, 20 Feb 2017 19:16:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfy7t-0001UD-QR for qemu-devel@nongnu.org; Mon, 20 Feb 2017 19:16:22 -0500 Received: from mail-yw0-f182.google.com ([209.85.161.182]:35593) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cfy7t-0001U0-N0 for qemu-devel@nongnu.org; Mon, 20 Feb 2017 19:16:17 -0500 Received: by mail-yw0-f182.google.com with SMTP id l19so57133197ywc.2 for ; Mon, 20 Feb 2017 16:16:16 -0800 (PST) Received: by 10.13.227.71 with HTTP; Mon, 20 Feb 2017 16:16:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Ob39EB5WbXB44Q/IG9w5TV8h7FOyBDSivEsuH3froiI=; b=a91YVk4MZrtA24K4wDQJuDPErrAOLI90lOt3Zf+qr/a7M5k/+xGAASDIvOageYYMwf EJSf/X2nBlEbLNxCYPCGM9MSbSeayp4GNkxW9yPkJZyUYi/l/lbctbdZ2ktmPvbavchZ u7NBXZozDqVqdDFkEvvb05sQvquSS40ZP1qbRRmtBkZLSuo9uuEWjfEzIbn4wirbJg1s 5yxiMXEXzZC2B8Tg5Yp6sEYjekZLp7p8Y46MBlWy8trnnh9s4tWaYselhp2/+rPuPwD/ DqdmZXqm91bqAGkjSdcZy37pHBw6lG/OOhoYp8pnmP3GSb1gN9Yw8kVu80MfPTwi0C2E DkOw== X-Gm-Message-State: AMke39mMBcjwZHGynX5BKuHb386ynHz1zYAP5IJUnfJXTEn81cjXFUjdqaNN4oG4W+p9UCEBMOVMnRUu8jsevijA X-Received: by 10.129.94.212 with SMTP id s203mr19764256ywb.181.1487636176295; Mon, 20 Feb 2017 16:16:16 -0800 (PST) MIME-Version: 1.0 From: Germano Veit Michel Date: Tue, 21 Feb 2017 10:16:15 +1000 Message-ID: To: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , Juan Jose Quintela Carreira , Amit Shah X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.161.182 Subject: [Qemu-devel] [PATCH V2] migration: expose qemu_announce_self() via qmp 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: , 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 Content-Type: text/plain; charset="utf-8" qemu_announce_self() is triggered by qemu at the end of migrations to update the network regarding the path to the guest l2addr. however it is also useful when there is a network change such as an active bond slave swap. Essentially, it's the same as a migration from a network perspective - the guest moves to a different point in the network topology. this exposes the function via qmp. Signed-off-by: Germano Veit Michel --- include/migration/vmstate.h | 5 +++++ migration/savevm.c | 30 +++++++++++++++++++----------- qapi-schema.json | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 63e7b02..a08715c 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1042,6 +1042,11 @@ int64_t self_announce_delay(int round) return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100; } +struct AnnounceRound { + QEMUTimer *timer; + int count; +}; + void dump_vmstate_json_to_file(FILE *out_fp); #endif diff --git a/migration/savevm.c b/migration/savevm.c index 5ecd264..44e196b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -118,29 +118,37 @@ static void qemu_announce_self_iter(NICState *nic, void *opaque) qemu_send_packet_raw(qemu_get_queue(nic), buf, len); } - static void qemu_announce_self_once(void *opaque) { - static int count =3D SELF_ANNOUNCE_ROUNDS; - QEMUTimer *timer =3D *(QEMUTimer **)opaque; + struct AnnounceRound *round =3D opaque; qemu_foreach_nic(qemu_announce_self_iter, NULL); - if (--count) { + round->count--; + if (round->count) { /* delay 50ms, 150ms, 250ms, ... */ - timer_mod(timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + - self_announce_delay(count)); + timer_mod(round->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + self_announce_delay(round->count)); } else { - timer_del(timer); - timer_free(timer); + timer_del(round->timer); + timer_free(round->timer); + g_free(round); } } void qemu_announce_self(void) { - static QEMUTimer *timer; - timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, qemu_announce_self_once, &= timer); - qemu_announce_self_once(&timer); + struct AnnounceRound *round =3D g_malloc(sizeof(struct AnnounceRound)); + if (!round) + return; + round->count =3D SELF_ANNOUNCE_ROUNDS; + round->timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, qemu_announce_self_once, round); + qemu_announce_self_once(round); +} + +void qmp_announce_self(Error **errp) +{ + qemu_announce_self(); } /***********************************************************/ diff --git a/qapi-schema.json b/qapi-schema.json index baa0d26..0d9bffd 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -6080,3 +6080,21 @@ # ## { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] } + +## +# @announce-self: +# +# Trigger generation of broadcast RARP frames to update network switches. +# This can be useful when network bonds fail-over the active slave. +# +# Arguments: None. +# +# Example: +# +# -> { "execute": "announce-self" } +# <- { "return": {} } +# +# Since: 2.9 +## +{ 'command': 'announce-self' } + --=20 2.9.3