qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>,
	Markus Armbruster <armbru@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	libvir-list@redhat.com, "Stefan Hajnoczi" <stefanha@gmail.com>,
	qemu-devel@nongnu.org, "Luiz Capitulino" <lcapitulino@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	Andreas =?us-ascii?B?PT91dGYtOD9RP0Y9QzM9QTRyYmVyPz0=?=
	<afaerber@suse.de>
Subject: [Qemu-devel] [PATCH v6 3/3] qmp: add path to device_deleted event
Date: Wed, 13 Mar 2013 19:46:24 +0200	[thread overview]
Message-ID: <3c5866736dc124947670a4166541cf71b3f3e21f.1363196546.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1363196545.git.mst@redhat.com>

Add QOM path to device deleted event.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 QMP/qmp-events.txt | 4 +++-
 hw/qdev.c          | 9 ++++-----
 2 files changed, 7 insertions(+), 6 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 50bf2e6..2c861c1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -782,14 +782,13 @@ 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 = NULL;
+        event_data = qobject_from_jsonf("{ 'path': %s }", path);
     }
     monitor_protocol_event(QEVENT_DEVICE_DELETED, event_data);
-    if (event_data) {
-        qobject_decref(event_data);
-    }
+    qobject_decref(event_data);
 }
 
 static void device_class_init(ObjectClass *class, void *data)
-- 
MST

      parent reply	other threads:[~2013-03-13 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 17:46 [Qemu-devel] [PATCH v6 0/3] DEVICE_DELETED event Michael S. Tsirkin
2013-03-13 17:46 ` [Qemu-devel] [PATCH v6 1/3] qdev: " Michael S. Tsirkin
2013-03-14  8:06   ` Markus Armbruster
2013-03-14  8:48     ` Michael S. Tsirkin
2013-03-14 12:13       ` Markus Armbruster
2013-03-14 12:22         ` Michael S. Tsirkin
2013-03-14 23:31           ` [Qemu-devel] [libvirt] " Eric Blake
2013-03-14  8:53     ` [Qemu-devel] " Michael S. Tsirkin
2013-03-14 12:24       ` Markus Armbruster
2013-03-13 17:46 ` [Qemu-devel] [PATCH v6 2/3] qom: pass original path to unparent method Michael S. Tsirkin
2013-03-13 17:46 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c5866736dc124947670a4166541cf71b3f3e21f.1363196546.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).