From patchwork Thu Mar 14 12:40:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 227646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F5662C0094 for ; Thu, 14 Mar 2013 23:41:23 +1100 (EST) Received: from localhost ([::1]:36898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7TF-0001CL-9D for incoming@patchwork.ozlabs.org; Thu, 14 Mar 2013 08:41:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7Sg-00015l-V9 for qemu-devel@nongnu.org; Thu, 14 Mar 2013 08:40:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UG7Sd-0001EG-M8 for qemu-devel@nongnu.org; Thu, 14 Mar 2013 08:40:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UG7Sd-0001E9-7A for qemu-devel@nongnu.org; Thu, 14 Mar 2013 08:40:43 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2ECeZt4022025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 14 Mar 2013 08:40:36 -0400 Received: from redhat.com (vpn-201-138.tlv.redhat.com [10.35.201.138]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r2ECeRTP031442; Thu, 14 Mar 2013 08:40:29 -0400 Date: Thu, 14 Mar 2013 14:40:53 +0200 From: "Michael S. Tsirkin" To: Anthony Liguori , Markus Armbruster Message-ID: <402bba7ec7d64c12db96c8e751147acba6d26280.1363264726.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Eduardo Habkost , libvir-list@redhat.com, Stefan Hajnoczi , qemu-devel@nongnu.org, Luiz Capitulino , Gerd Hoffmann , Paolo Bonzini , Andreas =?us-ascii?B?PT91cy1hc2NpaT9RPz0zRD0zRnVzLWFzY2lpPTNGQj0zRlBU?= =?us-ascii?Q?91dGYtOD9RP0Y9QzM9QTRyYmVy=3F=3D_=3D=3Fus-ascii=3FB=3FUHowPT?= =?us-ascii?Q?89=3F=3D?= Subject: [Qemu-devel] [PATCH v8 3/3] qmp: add path to device_deleted event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add QOM path to device deleted event. It now becomes useful to report it for devices which don't have an ID assigned. Signed-off-by: Michael S. Tsirkin --- QMP/qmp-events.txt | 4 +++- hw/qdev.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt index 24cf3e8..dcc826d 100644 --- a/QMP/qmp-events.txt +++ b/QMP/qmp-events.txt @@ -147,9 +147,11 @@ Device removal can be initiated by the guest or by HMP/QMP commands. Data: - "device": device name (json-string, optional) +- "path": device path (json-string) { "event": "DEVICE_DELETED", - "data": { "device": "virtio-net-pci-0" }, + "data": { "device": "virtio-net-pci-0", + "path": "/machine/peripheral/virtio-net-pci-0" }, "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } DEVICE_TRAY_MOVED diff --git a/hw/qdev.c b/hw/qdev.c index 64546cf..2c861c1 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -782,9 +782,10 @@ static void device_unparent(Object *obj, const char *path) } if (dev->id) { - event_data = qobject_from_jsonf("{ 'device': %s }", dev->id); + event_data = qobject_from_jsonf("{ 'device': %s, 'path': %s }", + dev->id, path); } else { - event_data = qobject_from_jsonf("{ }"); + event_data = qobject_from_jsonf("{ 'path': %s }", path); } monitor_protocol_event(QEVENT_DEVICE_DELETED, event_data); qobject_decref(event_data);