[Libguestfs] [PATCH 3/3] v2v: vCenter: Remove proxy environment variables (RHBZ#1354507).

Richard W.M. Jones rjones at redhat.com
Wed Feb 22 15:29:24 UTC 2017


Currently imports from vCenter sometimes obey proxy environment
variables (eg. $http_proxy) and sometimes don't.  The initial libvirt
connection to fetch metadata never uses the proxy, but because the
subsequent conversion and copying uses libcurl, it will pick up on
proxy environment variables.

This makes no sense, and in any case vCenter is really slow as it is
without putting another device into the data path.  Therefore ensure
that libcurl does not see any proxy environment variables by unsetting
them.
---
 v2v/input_libvirt_vcenter_https.ml | 13 +++++++++++++
 v2v/virt-v2v.pod                   | 16 +++-------------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/v2v/input_libvirt_vcenter_https.ml b/v2v/input_libvirt_vcenter_https.ml
index 7976821..79dff43 100644
--- a/v2v/input_libvirt_vcenter_https.ml
+++ b/v2v/input_libvirt_vcenter_https.ml
@@ -20,6 +20,7 @@
 
 open Common_gettext.Gettext
 open Common_utils
+open Unix_utils.Env
 
 open Types
 open Utils
@@ -48,6 +49,18 @@ object
 
     error_if_libvirt_does_not_support_json_backingfile ();
 
+    (* Remove proxy environment variables so curl doesn't try to use
+     * them.  Libvirt doesn't use the proxy anyway, and using a proxy
+     * is generally a bad idea because vCenter is slow enough as it is
+     * without putting another device in the way (RHBZ#1354507).
+     *)
+    unsetenv "https_proxy";
+    unsetenv "all_proxy";
+    unsetenv "no_proxy";
+    unsetenv "HTTPS_PROXY";
+    unsetenv "ALL_PROXY";
+    unsetenv "NO_PROXY";
+
     (* Get the libvirt XML.  This also checks (as a side-effect)
      * that the domain is not running.  (RHBZ#1138586)
      *)
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 86e6e9c..4c7204b 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -1187,19 +1187,9 @@ forwards the information, so if you have a firewall between vCenter
 and its hypervisors you may need to open additional ports (consult
 VMware documentation).
 
-=head3 vCenter: Proxy settings
-
-To copy the disks, virt-v2v uses L<libcurl(3)>.  The Curl library
-obeys the proxy environment variables, in particular C<https_proxy>,
-C<all_proxy> and C<no_proxy> (C<HTTPS_PROXY>, C<ALL_PROXY> and
-C<NO_PROXY> can also be used, but the lowercase named environment
-variables take precedence).
-
-If these environment variables are set then copying may happen via the
-proxy, and so a different set of ports may need to be opened in the
-firewall.
-
-The port 5480 connection never uses a proxy.
+The proxy environment variables (C<https_proxy>, C<all_proxy>,
+C<no_proxy>, C<HTTPS_PROXY>, C<ALL_PROXY> and C<NO_PROXY>) are
+B<ignored> when doing vCenter conversions.
 
 =head1 INPUT FROM VMWARE OVA
 
-- 
2.9.3




More information about the Libguestfs mailing list