On 12/07/2011 11:08 AM, Peter Krempa wrote: > This patch adds a set of flags to be used with the virDomainOpenConsole > API call to specify if the user wishes to interrupt an existing console > session or just to try open a new one. > > VIR_DOMAIN_CONSOLE_TRY - specifies that the caller wants to try open a > new console session if no open sessions exist > > VIR_DOMAIN_CONSOLE_FORCE - specifies that the caller wishes to interrupt > existing session and force a creation of a > new one. > --- > include/libvirt/libvirt.h.in | 12 +++++++++++- > 1 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in > index 2480add..268326b 100644 > --- a/include/libvirt/libvirt.h.in > +++ b/include/libvirt/libvirt.h.in > @@ -3346,7 +3346,17 @@ int virNWFilterGetUUIDString (virNWFilterPtr nwfilter, > char *buf); > char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter, > unsigned int flags); > - > +/** > + * virDomainConsoleFlags > + * > + * Since 0.9.7 0.9.9 (hmm, it would be really nice if we could augment http://libvirt.org/hvsupport.html to also list when a hypervisor started supporting a specific flag, rather than just the generic API). > + */ > +typedef enum { > + VIR_DOMAIN_CONSOLE_TRY = 0, /* try to open the console, don't abort active > + connection */ Since the default is 0, do we really need to name this flag? Then again, I guess it doesn't hurt. > + VIR_DOMAIN_CONSOLE_FORCE /* abort a (possibly) active console connection > + to force a new connection*/ I'd list this as an explicit (1 << 0), to make it obvious that we might add new bit-wise distinct flags in the future. > +} virDomainConsoleFlags; > > int virDomainOpenConsole(virDomainPtr dom, > const char *devname, Missing documentation of these flags in src/libvirt.c (I'm trying to earn a reputation for being a stickler about no new features without documentation, and this is a new feature). Maybe something like: diff --git i/include/libvirt/libvirt.h.in w/include/libvirt/libvirt.h.in index 268326b..845261b 100644 --- i/include/libvirt/libvirt.h.in +++ w/include/libvirt/libvirt.h.in @@ -3349,13 +3349,11 @@ char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter, /** * virDomainConsoleFlags * - * Since 0.9.7 + * Since 0.9.9 */ typedef enum { - VIR_DOMAIN_CONSOLE_TRY = 0, /* try to open the console, don't abort active - connection */ - VIR_DOMAIN_CONSOLE_FORCE /* abort a (possibly) active console connection - to force a new connection*/ + VIR_DOMAIN_CONSOLE_FORCE = (1 << 0) /* abort a (possibly) active console, + forcing a new connection*/ } virDomainConsoleFlags; int virDomainOpenConsole(virDomainPtr dom, diff --git i/src/libvirt.c w/src/libvirt.c index 9977915..af48e13 100644 --- i/src/libvirt.c +++ w/src/libvirt.c @@ -16962,7 +16962,7 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot) * @dom: a domain object * @dev_name: the console, serial or parallel port device alias, or NULL * @st: a stream to associate with the console - * @flags: unused, pass 0 + * @flags: bit-wise OR of virDomainConsoleFlags * * This opens the backend associated with a console, serial or * parallel port device on a guest, if the backend is supported. @@ -16971,6 +16971,11 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot) * in @st stream, which should have been opened in non-blocking * mode for bi-directional I/O. * + * By default, when @flags is 0, the open will fail if libvirt + * detects that the console is already in use by another client; + * passing VIR_DOMAIN_CONSOLE_FORCE will cause libvirt to forcefully + * remove the other client prior to opening this console. + * * returns 0 if the console was opened, -1 on error */ int virDomainOpenConsole(virDomainPtr dom, -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list