Commit 482d7c08 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-09-22' into staging



Monitor patches

# gpg: Signature made Tue 22 Sep 2015 10:33:34 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-monitor-2015-09-22:
  hmp: Restore "info pci"
  monitor: allow device_del to accept QOM paths

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 6138fbde abadcbc8
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -181,6 +181,20 @@ STEXI
@item info pic
@findex pic
Show i8259 (PIC) state.
ETEXI

    {
        .name       = "pci",
        .args_type  = "",
        .params     = "",
        .help       = "show PCI info",
        .mhandler.cmd = hmp_info_pci,
    },

STEXI
@item info pci
@findex pci
Show PCI information.
ETEXI

#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \
+2 −1
Original line number Diff line number Diff line
@@ -676,7 +676,8 @@ ETEXI
STEXI
@item device_del @var{id}
@findex device_del
Remove device @var{id}.
Remove device @var{id}. @var{id} may be a short ID
or a QOM object path.
ETEXI

    {
+1 −1
Original line number Diff line number Diff line
@@ -1951,7 +1951,7 @@
#
# Remove a device from a guest
#
# @id: the name of the device
# @id: the name or QOM path of the device
#
# Returns: Nothing on success
#          If @id is not a valid device, DeviceNotFound
+15 −5
Original line number Diff line number Diff line
@@ -771,12 +771,17 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
void qmp_device_del(const char *id, Error **errp)
{
    Object *obj;

    if (id[0] == '/') {
        obj = object_resolve_path(id, NULL);
    } else {
        char *root_path = object_get_canonical_path(qdev_get_peripheral());
        char *path = g_strdup_printf("%s/%s", root_path, id);

        g_free(root_path);
        obj = object_resolve_path_type(path, TYPE_DEVICE, NULL);
        g_free(path);
    }

    if (!obj) {
        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
@@ -784,6 +789,11 @@ void qmp_device_del(const char *id, Error **errp)
        return;
    }

    if (!object_dynamic_cast(obj, TYPE_DEVICE)) {
        error_setg(errp, "%s is not a hotpluggable device", id);
        return;
    }

    qdev_unplug(DEVICE(obj), errp);
}

+6 −1
Original line number Diff line number Diff line
@@ -321,13 +321,18 @@ Remove a device.

Arguments:

- "id": the device's ID (json-string)
- "id": the device's ID or QOM path (json-string)

Example:

-> { "execute": "device_del", "arguments": { "id": "net1" } }
<- { "return": {} }

Example:

-> { "execute": "device_del", "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
<- { "return": {} }

EQMP

    {