[libvirt] [PATCH 1/4] esx: parse new URI param 'allow_unsafe'

Martin Kletzander mkletzan at redhat.com
Mon May 5 09:47:02 UTC 2014


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 docs/drvesx.html.in | 14 ++++++++++++++
 src/esx/esx_util.c  | 13 ++++++++++++-
 src/esx/esx_util.h  |  2 ++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index 0816baf..d941763 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -185,6 +185,20 @@ vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
                 override the default port 1080.
             </td>
         </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>


diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index f84ecd5..87bca64 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -1,7 +1,7 @@
 /*
  * esx_util.c: utility functions for the VMware ESX driver
  *
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2012, 2014 Red Hat, Inc.
  * Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte at googlemail.com>
  * Copyright (C) 2009 Maximilian Wilhelm <max at rfc2324.org>
  *
@@ -46,6 +46,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
     size_t i;
     int noVerify;
     int autoAnswer;
+    int allowUnsafe;
     char *tmp;

     if (!parsedUri || *parsedUri) {
@@ -150,6 +151,16 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
                     goto cleanup;
                 }
             }
+        } else 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;
+            }
+
+            (*parsedUri)->allowUnsafe = allowUnsafe;
         } else {
             VIR_WARN("Ignoring unexpected query parameter '%s'",
                      queryParam->name);
diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index c6f14bb..0846ece 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -1,6 +1,7 @@
 /*
  * esx_util.h: utility functions for the VMware ESX driver
  *
+ * Copyright (C) 2014 Red Hat, Inc.
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte at googlemail.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -38,6 +39,7 @@ struct _esxUtil_ParsedUri {
     char *proxy_hostname;
     int proxy_port;
     char *path;
+    bool allowUnsafe;
 };

 int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri);
-- 
1.9.2




More information about the libvir-list mailing list