On Wed, Jan 26, 2011 at 4:05 PM, Iustin Pop <ius...@google.com> wrote: > On Mon, Jan 17, 2011 at 03:58:51PM -0200, Miguel Di Ciurcio Filho wrote: >> Hi list, >> >> I'm hacking some code to use QMP[1] to control KVM instances, instead >> of the traditional monitor. > > Interesting. > >> Commands to the monitor are concatenated with arguments when they are >> required and passed 'ready to run' to _CallMonitorCommand(). >> >> `egrep _CallMonitorCommand lib/hypervisor/hv_kvm.py` to have look. >> >> Some issues I've identified: >> >> 1) QMP arguments and monitor arguments sometimes differ: >> `migrate -d tcp:1.1.1.1:5555` >> VS >> { "execute": "migrate", "arguments": { "uri": "tcp:1.1.1.1:5555" } } >> >> 2) QMP and traditional monitor commands some times differ, eg: >> `change vnc password` >> VS >> { "execute": "set_password", "arguments": { "protocol": "vnc", >> "password": "secret" } } >> >> It is mandatory to support both QMP and the traditional monitor, so >> here are the questions I have: >> >> 1) Would it be better to abstract each command to a method >> _ChangeVNCPassword(), and inside this methods verify the arguments and >> make the call to QMP or the traditional monitor. > > This would be lot of work… > >> 2) Use a generic and unique interface, and then check command, the >> arguments and then call _CallMonitorCommand() or _CallQMPCommand() > > … but this doesn't work due to changed arguments. > > Have you tried to talk with the QMP developers about standardizing the > argument/commands between QMP and the standard monitor? >
I think the traditional commands/arguments are fixed because they are a historical interface, and it's a bit late to change the QMP protocol now... I think we need to implement it, and do it in a way so that we can use it when it's available, and in the future just drop traditional monitor support when we decide to depend on a KVM version with QMP enabled (not for another few versions of Ganeti). :) Is it possible to have a table with QMP and traditional arguments together, and then lookup at runtime what string to use depending on whether QMP is enabled or not? :) Thanks, Guido