On 02/14/2011 06:45 AM, Luiz Capitulino wrote:
So the question is: how does the schema based design support extending
commands or events? Does it require adding new commands/events?
Well, let me ask you, how do we do that today?
Let's say that I want to add a new parameter to the `change' function so
that I can include a salt parameter as part of the password.
The way we'd do this today is by checking for the 'salt' parameter in
qdict, and if it's not present, use a random salt or something like that.
However, if I'm a QMP client, how can I tell whether you're going to
ignore my salt parameter or actually use it? Nothing in QMP tells me
this today. If I set the salt parameter in the `change' command, I'll
just get a success message.
Even if we expose a schema, but leave things as-is, having to parse the
schema as part of a function call is pretty horrible, particularly if
distros do silly things like backport some optional parameters and not
others. If those optional parameters are deeply nested in a structure,
it's even worse.
OTOH, if we introduce a new command to set the password with a salt, it
becomes very easy for the client to support. The do something as simple as:
if qmp.has_command("vnc-set-password-with-salt"):
qmp.vnc_set_password_with_salt('foobar', 'X*')
else:
window.set_weak_security_icon(True)
qmp.vnc_set_password('foobar')
Now you could answer, hey, we can add capabilities then those
capabilities can quickly get out of hand.
Regards,
Anthony Liguori
While the current code is in really in bad shape currently, I'm not sure that
having this disadvantage will pay off the new design.