On 03/01/2012 03:30 PM, Eric Blake wrote:
On 03/01/2012 02:10 PM, Anthony Liguori wrote:
2) Execute the following QMP command
{ "execute": "qmp_capabilities" }
{ "execute": "blockdev-transaction", "arguments":
{'actions': [
{ 'type': 'snapshot', 'data' :
{ 'device': 'ide0-hd0', 'snapshot-file':
'/home/pbonzini/base.qcow2' } },
{ 'type': 'mirror', 'data' :
{ 'device': 'ide0-hd0', 'target': '/home/pbonzini/mirror.qcow2'
} } ] } }
{ "execute": "cont" }
We don't have schema introspection today. How would one determine when
new transaction types are available?
I think we need some sort of introspection method too in order for
clients to figure out when the command is extended.
I agree that introspection is necessary. Up till now, libvirt could get
by with query-commands (either a command exists or it doesn't). But now
we have the case where blockdev-transaction might exist, but doesn't
support the particular union action such as 'mirror' that libvirt wants
to use.
Could this be something we wire up to the query-commands command?
Something like:
{ 'type': 'CommandInfo', 'data': {'name': 'str', '*syntax': 'str'} }
{ 'command': 'query-commands,
'data': { '*syntax': 'bool', '*names': ['str'] },
'returns': ['CommandInfo'] }
where the normal {"execute":"qemu-commands"} just returns the list of
command names, but {"execute":"qemu-commands", "arguments": { "syntax":
"true", "names" : [ "blockdev-transaction" ] } } then returns:
{"return":[{"name":"blockdev-transaction", "syntax":"{ 'command' ...
}"}], "id":"..."}
that is, return back the qapi-schema.json description of the command.
Actually, I'd guess you'd also want to be able to query 'type' listings,
not just 'command's, so maybe this deserves a new monitor command rather
than shoe-horning it onto an existing one.
Yes, this is what I would like to do, but it's a requires a bit of work to
implement. You'd have to either install qapi-schema.json and read it at run
time or serialize it to a C data structure that can then be used to initialize a
QObject.
Nothing Earth shattering, just a fair amount of bit moving.
Regards,
Anthony Liguori