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>,
afaerber@suse.de
Subject: [Qemu-devel] [PATCH v9 3/3] qmp: add path to device_deleted event
Date: Thu, 21 Mar 2013 14:07:18 +0200 [thread overview]
Message-ID: <e78f366bf92dbeced4321a49b6af716381c6022c.1363633627.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1363633627.git.mst@redhat.com>
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 <mst@redhat.com>
---
QMP/qmp-events.txt | 4 +++-
hw/qdev.c | 7 +++++--
2 files changed, 8 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 5e8a89c..0cdf568 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -764,6 +764,7 @@ static void device_unparent(Object *obj)
DeviceClass *dc = DEVICE_GET_CLASS(dev);
BusState *bus;
QObject *event_data;
+ gchar *path = object_get_canonical_path(obj);
while (dev->num_child_bus) {
bus = QLIST_FIRST(&dev->child_bus);
@@ -784,12 +785,14 @@ static void device_unparent(Object *obj)
}
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);
+ g_free(path);
}
static void device_class_init(ObjectClass *class, void *data)
--
MST
next prev parent reply other threads:[~2013-03-21 12:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 12:07 [Qemu-devel] [PATCH v9 0/3] DEVICE_DELETED event Michael S. Tsirkin
2013-03-21 12:07 ` [Qemu-devel] [PATCH v9 1/3] qdev: " Michael S. Tsirkin
2013-03-21 12:22 ` Markus Armbruster
2013-03-21 12:07 ` [Qemu-devel] [PATCH v9 2/3] qom: call class destructor before unparent Michael S. Tsirkin
2013-03-21 12:25 ` Paolo Bonzini
2013-03-21 12:30 ` Michael S. Tsirkin
2013-03-21 12:47 ` Paolo Bonzini
2013-03-21 12:07 ` Michael S. Tsirkin [this message]
2013-03-21 12:23 ` [Qemu-devel] [PATCH v9 3/3] qmp: add path to device_deleted event Markus Armbruster
2013-03-21 12:57 ` [Qemu-devel] [PATCH v9 0/3] DEVICE_DELETED event Andreas Färber
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=e78f366bf92dbeced4321a49b6af716381c6022c.1363633627.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).