On 08/27/2015 11:26 AM, Programmingkid wrote: > > On Aug 27, 2015, at 12:13 PM, Daniel P. Berrange wrote: > >> Currently both object_del and device_del require that the >> client provide the object/device short ID. While user >> creatable objects require an ID to be provided at time of >> creation, qdev devices may be created without giving an >> ID. The only unique identifier they would then have is the >> QOM object path. >> >> Allowing device_del to accept an object path ensures all >> devices are deletable regardless of whether they have an >> ID. >> >> (qemu) device_add usb-mouse >> (qemu) qom-list /machine/peripheral-anon >> device[0] (child<usb-mouse>) >> type (string) >> (qemu) device_del /machine/peripheral-anon/device[0]
> Your patch do the job, but could be tweaked. Could we make an alias for
> "qom-list /machine/peripheral-anon" that is actually easy to remember.
> Perhaps "info devices".
>
> Also typing "device_del /machine/peripheral-anon/device[0]" seems
> unnecessary. It probably
> could be shortened to just "device_del device[0]".
You're welcome to submit follow up patches to make HMP more useful to
you ('info' is already an HMP command, so adding an 'info devices'
submode is a reasonable addition). However, the important change here
is the QMP change that management apps, like libvirt, will use; and that
interface does not need further syntactic sugar. The patch specifically
distinguishes between full QOM paths (leading '/') and short names (no
leading '/'); and your proposal to try the QOM path under
/machine/peripheral-anon/ when given just the string 'device[0]' that
did not resolve to a short name is counter to that distinguishing
factor. Besides, management apps don't care how long a string is. The
QMP interface should not be changed, and any such simplifications you
write a patch for should be limited to the HMP side.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
