On 02/02/2012 04:04 AM, Peter Krempa wrote:
> What you have is good, but you should also add --safe and --force
to
> 'virsh start --console' and 'virsh create --console'. Hmm, for
virsh
> start, naming it --force might be risky since we already have
> --force-boot; there, I might go --force-console. It also means that if
> we ever add unambiguous prefix option parsing, then --force would be
> ambiguous; oh well.
>
Well, I thought that for those commands the --safe and --force
(especialy force) do not make sense and therefore I didn't implement
them.
Oh, right - now that you mention it, it makes total sense - the act of
starting a domain means that no one else can be using the console, and
the race window between virsh.c's two calls to start and then grab the
console is probably not worth worrying about.
So, as a compromise - how about documenting in the commit message your
rationale for not providing the new flags for start and create, and I
withdraw my request for adding those flags.
When the domain is stopped there's only a minimal chance that
someone might create a console session before the virsh command manages
to open it. The --safe comand might be relevant to guarantee that the
console doesn't get messed up lated.
I don't think we need it. It doesn't matter whether the first console
is opened with 0 or with SAFE; either way, when second attempt is tried,
the results will be the same: with 0, you get safe behavior with a new
server and shared console with an old server; with SAFE, you get safe
behavior with a new server and rejected command with an old server. Or
put another way, we aren't maintaining state on whether SAFE was used on
the original open, so there's no need for a flag to request extra state.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org