From patchwork Tue Mar 22 12:55:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Konishchev X-Patchwork-Id: 87914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 26934B6F7C for ; Tue, 22 Mar 2011 23:56:50 +1100 (EST) Received: from localhost ([127.0.0.1]:49717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q218g-0006kr-Jw for incoming@patchwork.ozlabs.org; Tue, 22 Mar 2011 08:56:46 -0400 Received: from [140.186.70.92] (port=51099 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2184-0006kR-6l for qemu-devel@nongnu.org; Tue, 22 Mar 2011 08:56:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2182-0007pp-HZ for qemu-devel@nongnu.org; Tue, 22 Mar 2011 08:56:08 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:33447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2182-0007p5-7M for qemu-devel@nongnu.org; Tue, 22 Mar 2011 08:56:06 -0400 Received: by vxb41 with SMTP id 41so6005635vxb.4 for ; Tue, 22 Mar 2011 05:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=PxFec/ioc9/e7fhlG1CixiqNz3Yc+Okpp7RAtMxcMnM=; b=T0oeCMhFb+ly8D51hOav52VxJ6EFX0rcwGhyht6LlFA3AyE5nRj73KXSRyRVUnuqJA 9lKBkU/GXcikyzJUbZ2BtO5f/t6BPibfF10SLPaZlOIxFsA2tAFRVJSSsHFdIXXHMiJc MDYKiX6kEaYdCYddnb6Z9JuPZLVd1YJVNr02E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OrMfQgnbOgP9K+X2Ff9P8tDO/nvZVRoZsYxYTcUddNa/cneP72MrwMVLsDRtgDjfrn ZE1b5AUs8M8CD+1Kod6+b9hQV4A+rcpSkGEtXEN5BQgseJj18LHGVZnMFPg3X6KmfxbS /xInHQ43RcT2n5bQvMJoeWx2WyGTFxGBm8cLk= MIME-Version: 1.0 Received: by 10.229.73.25 with SMTP id o25mr4583757qcj.208.1300798556923; Tue, 22 Mar 2011 05:55:56 -0700 (PDT) Received: by 10.229.189.14 with HTTP; Tue, 22 Mar 2011 05:55:56 -0700 (PDT) Date: Tue, 22 Mar 2011 15:55:56 +0300 Message-ID: From: Dmitry Konishchev To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Subject: [Qemu-devel] [PATCH] Few new QMP features X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi! I use QEMU via QMP and I've discovered that for some tasks there is no proper way to do them via QMP. I've written few patches: * One of them modifies "pci_add" command to return pci address of the added device, when user hasn't specified it (to be able to delete it via "pci_del" in the future). * The second one adds INCOMING_FINISHED QMP event which is emitted when QEMU finished incoming migration (when started with -incoming command line option). It is needed because now there is no way to determine, whether it finished or not, and QMP "cont" command just returns error. It will be awesome if you include this patches to the upstream (I've attached them to this message). From 97250c2a7eeb1506e0a1517b416046dd02720025 Mon Sep 17 00:00:00 2001 From: Dmitry Konishchev Date: Wed, 16 Mar 2011 12:31:52 +0300 Subject: [PATCH 2/2] Added a way for user to determine, whether incoming migration is finished or not --- migration.c | 1 + monitor.c | 24 ++++++++++++++++++++++++ monitor.h | 1 + qemu-monitor.hx | 19 +++++++++++++++++++ 4 files changed, 45 insertions(+), 0 deletions(-) diff --git a/migration.c b/migration.c index 468d517..1898bcc 100644 --- a/migration.c +++ b/migration.c @@ -68,6 +68,7 @@ void process_incoming_migration(QEMUFile *f) DPRINTF("successfully loaded vm state\n"); incoming_expected = false; + monitor_protocol_event(QEVENT_INCOMING_FINISHED, NULL); if (autostart) vm_start(); diff --git a/monitor.c b/monitor.c index dd5469f..6338827 100644 --- a/monitor.c +++ b/monitor.c @@ -454,6 +454,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_WATCHDOG: event_name = "WATCHDOG"; break; + case QEVENT_INCOMING_FINISHED: + event_name = "INCOMING_FINISHED"; + break; default: abort(); break; @@ -2104,6 +2107,14 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) } #endif +static void do_info_incoming_print(Monitor *mon, const QObject *data) +{ + QDict *qdict = qobject_to_qdict(data); + monitor_printf(mon, "Incoming migration status: "); + monitor_printf(mon, qdict_get_bool(qdict, "active") ? "active" : "not active"); + monitor_printf(mon, "\n"); +} + static void do_info_status_print(Monitor *mon, const QObject *data) { QDict *qdict; @@ -2123,6 +2134,11 @@ static void do_info_status_print(Monitor *mon, const QObject *data) monitor_printf(mon, "\n"); } +static void do_info_incoming(Monitor *mon, QObject **ret_data) +{ + *ret_data = qobject_from_jsonf("{ 'active': %i }", incoming_expected); +} + static void do_info_status(Monitor *mon, QObject **ret_data) { *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }", @@ -2520,6 +2536,14 @@ static const mon_cmd_t info_cmds[] = { .mhandler.info = do_info_snapshots, }, { + .name = "incoming", + .args_type = "", + .params = "", + .help = "show current incoming migration status (active|not active)", + .user_print = do_info_incoming_print, + .mhandler.info_new = do_info_incoming, + }, + { .name = "status", .args_type = "", .params = "", diff --git a/monitor.h b/monitor.h index 38b22a4..4e6ec04 100644 --- a/monitor.h +++ b/monitor.h @@ -32,6 +32,7 @@ typedef enum MonitorEvent { QEVENT_BLOCK_IO_ERROR, QEVENT_RTC_CHANGE, QEVENT_WATCHDOG, + QEVENT_INCOMING_FINISHED, QEVENT_MAX, } MonitorEvent; diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 8b1415d..b0e2dea 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -2237,6 +2237,25 @@ show list of VM snapshots ETEXI STEXI +@item info incoming +show current incoming migration status (active|not active) +ETEXI +SQMP +query-incoming +------------ + +Return a json-object with the following information: + +- "active": true if an incoming migration is active now, or false if it's already finished or hasn't been started (json-bool) + +Example: + +-> { "execute": "query-incoming" } +<- { "return": { "active": true } } + +EQMP + +STEXI @item info status show the current VM status (running|paused) ETEXI -- 1.7.1