[PATCH 2/4] vmware: parse new URI param 'allow_unsafe'

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

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 docs/drvvmware.html.in     | 35 +++++++++++++++++++++++++++++++++++
 src/vmware/vmware_conf.h   |  2 ++
 src/vmware/vmware_driver.c | 17 ++++++++++++++++-
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/docs/drvvmware.html.in b/docs/drvvmware.html.in
index 240afd0..c2f7d38 100644
--- a/docs/drvvmware.html.in
+++ b/docs/drvvmware.html.in
@@ -51,6 +51,41 @@ vmwarews+tcp://user@xxxxxxxxxxx/session  (remote access to VMware Workstation, S
 vmwarews+ssh://user@xxxxxxxxxxx/session  (remote access to VMware Workstation, SSH tunnelled)
 </pre>

+    <h4><a name="extraparams">Extra parameters</a></h4>
+    <p>
+        Extra parameters can be added to a URI as part of the query string
+        (the part following <code>?</code>). A single parameter is formed by a
+        <code>name=value</code> pair. Multiple parameters are separated by
+        <code>&amp;</code>.
+    </p>
+<pre>
+?<span style="color: #E50000">allow_unsafe=1</span>
+</pre>
+    <p>
+        The driver understands the extra parameters shown below.
+    </p>
+    <table class="top_table">
+        <tr>
+            <th>Name</th>
+            <th>Values</th>
+            <th>Meaning</th>
+        </tr>
+        <tr>
+            <td>
+                <code>allow_unsafe</code>
+            </td>
+            <td>
+                <code>0</code> or <code>1</code>
+            </td>
+            <td>
+                If set to 1, this disables check for supported
+                virtualHW.version, so connections to newer versions
+                than supported is possible.  The default value is 0.
+                <span class="since">Since 1.2.5</since>
+            </td>
+        </tr>
+    </table>
+
     <h2><a name="xmlconfig">Example domain XML config</a></h2>

 <pre>
diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
index 1f3c41a..6ab838c 100644
--- a/src/vmware/vmware_conf.h
+++ b/src/vmware/vmware_conf.h
@@ -51,6 +51,8 @@ struct vmware_driver {
     unsigned long version;
     int type;
     char *vmrun;
+
+    bool allowUnsafe;
 };

 typedef struct _vmwareDomain {
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 6edc0bc..b0a3279 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -1,6 +1,6 @@
 /*---------------------------------------------------------------------------*/
 /*
- * Copyright (C) 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2011-2012, 2014 Red Hat, Inc.
  * Copyright 2010, diateam (www.diateam.net)
  * Copyright (C) 2013. Doug Goldstein <cardoe@xxxxxxxxxx>
  *
@@ -99,6 +99,7 @@ vmwareConnectOpen(virConnectPtr conn,
     struct vmware_driver *driver;
     size_t i;
     char *tmp;
+    int allowUnsafe;

     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

@@ -157,6 +158,20 @@ vmwareConnectOpen(virConnectPtr conn,
         goto cleanup;
     }

+    for (i = 0; i < conn->uri->paramsCount; i++) {
+        virURIParamPtr queryParam = &conn->uri->params[i];
+        if (STRCASEEQ(queryParam->name, "allow_unsafe")) {
+            if (virStrToLong_i(queryParam->value, NULL, 10, &allowUnsafe) < 0 ||
+                (allowUnsafe != 0 && allowUnsafe != 1)) {
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("Query parameter 'allow_unsafe' has unexpected value "
+                                 "'%s' (should be 0 or 1)"), queryParam->value);
+                goto cleanup;
+            }
+            driver->allowUnsafe = allowUnsafe;
+        }
+    }
+
     /* Match the non-'vmware' part of the scheme as the driver backend */
     driver->type = vmwareDriverTypeFromString(tmp);

-- 
1.9.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]