[libvirt] [PATCH v3 3/7] virsh: add support for VIR_DOMAIN_CONSOLE_* flags

Eric Blake eblake at redhat.com
Thu Feb 2 15:24:09 UTC 2012

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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120202/3a1a82e4/attachment-0001.sig>

More information about the libvir-list mailing list