Dňa 14.12.2011 1:14, Eric Blake wrote / napísal(a):
Hmm, wondering about back-compat - what happens if we are talking to
an
older libvirt that does not know VIR_DOMAIN_CONSOLE_FORCE, but also
which does not prevent multiple connections when flags==0? At first
glance, it looks like we're stuck - there's no useful way to tell if a
console was already in use.
Yes, we would end up in a state like when you try it
now.
But maybe we could add a new API, to allow probing whether a console
is
in use. If the API exists, then we know whether the console is in use
(and we also know whether --force will work); if the API does not exist,
the we know we are talking to an older server that multiplexes
connections. Maybe we should have:
virsh console domain --safe => refuse to connect unless connection is
safe (fails on older servers)
virsh console domain --force => force connection (fails on older servers)
virsh console domain => existing behavior (connects on older servers,
even if it corrupts connection, and safely connects on newer servers)
Yes, that's definitely a good idea.
that is, I'm thinking it might be worth it to add a new --safe
option
that lets the user probe (via a new API virDomainConsoleInUse(dom,
dev_name, flags)) whether the attempt will be safe.
I was thinking about adding another flag. With that flag specified, the
virDomainConsoleOpen function would return success without any
operation, confirming, that the server is capable of handling console
connections in a safe way. The client could then open the connection
calling this function again.
What do you think about this option?
Peter