On Wed, May 17, 2017 at 05:00:29PM -0500, Eric Blake wrote: > On 05/17/2017 04:25 PM, Eduardo Habkost wrote: > > Currently there's no way for QMP clients to get a list of device types > > that are really usable with -device. This information would be useful > > for management software and test scripts (like the device-crash-test > > script I have submitted recently). Interestingly, the "info qdm" HMP > > command provides this information, but no QMP command does. > > > > Add two new fields to the return value of qom-list-types: > > "user-creatable-device" and "hotpluggable-device". Also, add extra > > arguments for filtering the list of types based on the new fields. > > > > I'm not sure about the naming of the new command arguments. Maybe the > > names are too long, but I believe that "user-creatable-devices-only=false" > > would have more obvious semantics than "user-creatable-devices=false" > > (the latter looks ambiguous: it could mean "return only > > non-user-creatable devices" or "return all devices"). > > Since this is still RFC, here's a bikeshed idea: > > "just-user-creatable":false > > is shorter, and still conveys whether we care about just user_creatable > devices or all devices. >
We have a "user-creatable" QOM type name for backend object types, so I believe the -device suffix is important here. > > +++ b/qapi-schema.json > > @@ -3034,12 +3034,24 @@ > > # > > # @name: the type name found in the search > > # > > +# @user-creatable-device: If true, the type is a user-creatable device that > > +# can be used with the "-device" command-line > > option. > > +# Note that this does not guarantee that the device > > +# is going to be accepted by all machine-types. > > +# (since 2.10) > > +# > > +# @hotpluggable-device: If true, the type is a hotpluggable device that can > > +# be plugged using the "device_add" monitor command. > > +# Note that this does not guarantee that the device > > can > > +# be hotplugged on any machine-type. (since 2.10) > > Do we need the '-device' suffix in both names? I'm not opposed to it, > but don't know if it is adding any useful information. If we keep the -device suffix in "user-creatable-device", adding the suffix to "hotpluggable" would make it more consistent. > > > > ## > > { 'command': 'qom-list-types', > > - 'data': { '*implements': 'str', '*abstract': 'bool' }, > > + 'data': { '*implements': 'str', '*abstract': 'bool', > > + '*user-creatable-devices-only': 'bool', > > '*hotpluggable-devices-only': 'bool' }, > > Long line, try to keep it under 80 columns. I will fix it. Thanks. -- Eduardo