]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add flags for virDomainOpenConsole
authorPeter Krempa <pkrempa@redhat.com>
Wed, 12 Oct 2011 11:19:48 +0000 (13:19 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 27 Feb 2012 14:05:16 +0000 (15:05 +0100)
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_SAFE - specifies that the console connection should
                          be opened only if the hypervisor supports
                          mutually exclusive access to console devices

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
src/libvirt.c

index 6238ebb4330e6ac2b23e2c3837555bbbe311de64..58c4366e5208c2433c43163705e2a2c66cc60bbc 100644 (file)
@@ -3749,7 +3749,19 @@ int                     virNWFilterGetUUIDString (virNWFilterPtr nwfilter,
                                                   char *buf);
 char *                  virNWFilterGetXMLDesc    (virNWFilterPtr nwfilter,
                                                   unsigned int flags);
+/**
+ * virDomainConsoleFlags
+ *
+ * Since 0.9.10
+ */
+typedef enum {
 
+    VIR_DOMAIN_CONSOLE_FORCE = (1 << 0), /* abort a (possibly) active console
+                                            connection to force a new
+                                            connection */
+    VIR_DOMAIN_CONSOLE_SAFE = (1 << 1), /* check if the console driver supports
+                                           safe console operations */
+} virDomainConsoleFlags;
 
 int virDomainOpenConsole(virDomainPtr dom,
                          const char *devname,
index 8f98047fb7cff3b0d2d1024027817f0916d62cad..c2e973343e9293a043494c1540d70536589d1f41 100644 (file)
@@ -17771,7 +17771,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: extra flags; not used yet, so callers should always pass 0
+ * @flags: bitwise-OR of virDomainConsoleFlags
  *
  * This opens the backend associated with a console, serial or
  * parallel port device on a guest, if the backend is supported.
@@ -17780,7 +17780,21 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot)
  * in @st stream, which should have been opened in non-blocking
  * mode for bi-directional I/O.
  *
- * returns 0 if the console was opened, -1 on error
+ * 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.
+ *
+ * If flag VIR_DOMAIN_CONSOLE_SAFE the console is opened only in the
+ * case where the hypervisor driver supports safe (mutually exclusive)
+ * console handling.
+ *
+ * Older servers did not support either flag, and also did not forbid
+ * simultaneous clients on a console, with potentially confusing results.
+ * When passing @flags of 0 in order to support a wider range of server
+ * versions, it is up to the client to ensure mutual exclusion.
+ *
+ * Returns 0 if the console was opened, -1 on error
  */
 int virDomainOpenConsole(virDomainPtr dom,
                          const char *dev_name,