On 08/25/2011 04:07 AM, Gerd Hoffmann wrote:
On 08/24/11 20:43, Anthony Liguori wrote:
This is a new QMP only command that only changes the VNC password.
What is wrong with "set_password vnc $secret" ?
Overloading a single function to do multiple things makes the function
hard to use. Consider the C interface:
void qmp_set_password(QmpSession *sess, const char *protocol,
const char *password, bool has_connected,
const char *connected)
Since both protocol and connected are strings, you can get hard to debug
errors by using the string "VNC" instead of "vnc" or "Keep" instead of
"keep". There's no obvious way to figure out what strings are valid for
protocol programatically so if we added rdesktop or something like that,
the interface would become awkward to use.
Likewise, it's non-intuitive that connected only has one valid value for
VNC which means that for changing the VNC password, it's just extra
typing. Compare that to:
void qmp_change_vnc_password(QmpSession *sess, const char *password)
It's impossible to use wrong. If we add a qmp_change_rdesktop_password,
it's easily detectable.
Regards,
Anthony Liguori
cheers,
Gerd