[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v3 2/7] Add flags for virDomainOpenConsole



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
                          mutualy 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.
---
Diff to v2:
- added missing documentation
- fixed version
- added flag VIR_DOMAIN_CONSOLE_SAFE that denotes usage of safe console

 include/libvirt/libvirt.h.in |   12 ++++++++++++
 src/libvirt.c                |   11 ++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index e99cd00..10c2d8f 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3642,7 +3642,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,
diff --git a/src/libvirt.c b/src/libvirt.c
index 8be4e13..0d89f1b 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -17380,7 +17380,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: 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.
@@ -17389,6 +17389,15 @@ 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.
+ *
+ * If flag VIR_DOMAIN_CONSOLE_SAFE the console is opened only in the
+ * case the hypervisor driver supports safe (mutually exclusive)
+ * console handling.
+ *
  * returns 0 if the console was opened, -1 on error
  */
 int virDomainOpenConsole(virDomainPtr dom,
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]