Monitor patches

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWASBuAAoJEDhwtADrkYZThHQQAISLZIf0paX0ELIX5GcWopEt
 SXKOxNZh3JGLuO+UVybcIYXejzgzWMxyvPKDU21F2rzjj06I1c60Oau7ckXs52SF
 dbZbRNgjal9UDX0zWl6blxETgVbnVx9AFNCV7wju3ZJXROv8SD9dl4Jr8pZ6Q9Nf
 AaqywL7yLcKsmXUWPZ9iIQpMoXA2DqBVUT7RveZzTxCLctTuANxX3iUDdg+CQRdb
 bW3j+luJu88GB0KCAXTs7Vd6Q2C3cD4OWEuF+l5OeTSbmdGmVHgLyUT/c8TnFvUi
 IcENlK5HDcp4FBFTtOokL4FeZ3EMWTAcAKgCk0nstNiHSb+iS2l9xm9ESeR/uIzn
 TL5Mv82MYQ/xGl9zBV9b6ezzaTKaX22ywmMYsVm/XOJhWo/epujuCvoTOSlnLiFV
 T2sFLmgvb7jLGBbGffoUZdz4M6ve9hgAEUySIIrtBOgIgGmS9zmXWtJZWE6aMPWi
 jj+SooUvcCVxreW9BpRs9HdCQMdjGgbXx66bUyErw3ESicYFyQCNP35k4h80E8rb
 0VddUZnaBqcoZg4Y/zXvNfIK/XezSWYBh+fOwCgIWmATVbyx6ecn2e7l8p8AM6wH
 pKwNGW/13pII1WH2V6p1TDbBXd9fWKG3K5NocPKt0iTokA+/X9CDoCFcZELYq8GR
 4OL10ASuuexWpm379vPB
 =NoIY
 -----END PGP SIGNATURE-----

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: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-09-22 16:51:36 +01:00
commit 482d7c0854
5 changed files with 38 additions and 8 deletions

View File

@ -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) || \

View File

@ -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
{

View File

@ -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

View File

@ -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);
}

View File

@ -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
{