cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject git commit: updated refs/heads/master to 3a91500
Date Tue, 05 Nov 2013 10:35:31 GMT
Updated Branches:
  refs/heads/master 1058e3049 -> 3a9150017


CLOUDSTACK-3715. Socket timeout error is observed in VMware setup if a VMware task (RelocateVM_Task,
CloneVM_Task etc.) takes more than 10 minutes. Making this value configurable to allow admins
to modify the timeout if required. It defaults to the current value i.e. 10 minutes.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3a915001
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3a915001
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3a915001

Branch: refs/heads/master
Commit: 3a9150017339fa9447e7e30b854ccd3351695dcc
Parents: 1058e30
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Sun Nov 3 18:42:24 2013 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Tue Nov 5 15:59:03 2013 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareManager.java  |  2 ++
 .../vmware/manager/VmwareManagerImpl.java         |  9 +++++++++
 .../vmware/resource/VmwareContextFactory.java     |  1 +
 .../VmwareSecondaryStorageContextFactory.java     | 18 +++++++++++++++++-
 server/src/com/cloud/configuration/Config.java    |  1 +
 .../hypervisor/vmware/util/VmwareClient.java      | 10 ++++++++--
 .../vmware/mo/TestVmwareContextFactory.java       |  1 +
 7 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
index 6c67599..bc0c9a4 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
@@ -69,5 +69,7 @@ public interface VmwareManager {
     
     public String getRootDiskController();
 
+    public int getVcenterSessionTimeout();
+
     boolean isLegacyZone(long dcId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 9af0aa0..183d676 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -177,6 +177,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
     int _additionalPortRangeStart;
     int _additionalPortRangeSize;
     int _routerExtraPublicNics = 2;
+    int _vCenterSessionTimeout = 600000; // Timeout in milliseconds
 
     String _reserveCpu = "false";
 
@@ -279,6 +280,9 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
 
         _routerExtraPublicNics = NumbersUtil.parseInt(_configDao.getValue(Config.RouterExtraPublicNics.key()),
2);
 
+        _vCenterSessionTimeout = NumbersUtil.parseInt(_configDao.getValue(Config.VmwareVcenterSessionTimeout.key()),
600) * 1000;
+        s_logger.info("VmwareManagerImpl config - vmware.vcenter.session.timeout: " + _vCenterSessionTimeout);
+
         _reserveCpu = _configDao.getValue(Config.VmwareReserveCpu.key());
         if(_reserveCpu == null || _reserveCpu.isEmpty()) {
             _reserveCpu = "false";
@@ -986,6 +990,11 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
     }
 
     @Override
+    public int getVcenterSessionTimeout() {
+        return _vCenterSessionTimeout;
+    }
+
+    @Override
     public List<Class<?>> getCommands() {
         List<Class<?>> cmdList = new ArrayList<Class<?>>();
         cmdList.add(AddVmwareDcCmd.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
index 3079998..f108fda 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
@@ -63,6 +63,7 @@ public class VmwareContextFactory {
 			s_logger.debug("initialize VmwareContext. url: " + serviceUrl + ", username: " + vCenterUserName
+ ", password: " + StringUtils.getMaskedPasswordForDisplay(vCenterPassword));
 
 		VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
+		vimClient.setVcenterSessionTimeout(s_vmwareMgr.getVcenterSessionTimeout());
 		vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
 
 		VmwareContext context = new VmwareContext(vimClient, vCenterAddress);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
index 253d6fd..3d7a18d 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
@@ -16,11 +16,17 @@
 // under the License.
 package com.cloud.storage.resource;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
 import org.apache.log4j.Logger;
 
+import com.cloud.configuration.Config;
+import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.hypervisor.vmware.util.VmwareClient;
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.hypervisor.vmware.util.VmwareContextPool;
+import com.cloud.utils.NumbersUtil;
 
 public class VmwareSecondaryStorageContextFactory {
     private static final Logger s_logger = Logger.getLogger(VmwareSecondaryStorageContextFactory.class);
@@ -28,20 +34,30 @@ public class VmwareSecondaryStorageContextFactory {
 	private static volatile int s_seq = 1;
 
 	private static VmwareContextPool s_pool;
+    private static ConfigurationDao s_configDao;
+
+    @Inject ConfigurationDao _configDao;
 
 	public static void initFactoryEnvironment() {
 		System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
 		s_pool = new VmwareContextPool();
 	}
 
+    @PostConstruct
+        void init() {
+            s_configDao = _configDao;
+    }
+
 	public static VmwareContext create(String vCenterAddress, String vCenterUserName, String
vCenterPassword) throws Exception {
 		assert(vCenterAddress != null);
 		assert(vCenterUserName != null);
 		assert(vCenterPassword != null);
 
 		String serviceUrl = "https://" + vCenterAddress + "/sdk/vimService";
+        int vCenterSessionTimeout = NumbersUtil.parseInt(s_configDao.getValue(Config.VmwareVcenterSessionTimeout.key()),
600) * 1000;
 		VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
-		vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
+        vimClient.setVcenterSessionTimeout(vCenterSessionTimeout);
+        vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
 		VmwareContext context = new VmwareContext(vimClient, vCenterAddress);
 		assert(context != null);
 		

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index e787576..e441325 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -265,6 +265,7 @@ public enum Config {
     VmwareRecycleHungWorker("Advanced", ManagementServer.class, Boolean.class, "vmware.recycle.hung.wokervm",
"false", "Specify whether or not to recycle hung worker VMs", null),
     VmwareHungWorkerTimeout("Advanced", ManagementServer.class, Long.class, "vmware.hung.wokervm.timeout",
"7200", "Worker VM timeout in seconds", null),
     VmwareEnableNestedVirtualization("Advanced", ManagementServer.class, Boolean.class, "vmware.nested.virtualization",
"false", "When set to true this will enable nested virtualization when this is supported by
the hypervisor", null),
+    VmwareVcenterSessionTimeout("Advanced", ManagementServer.class, Long.class, "vmware.vcenter.session.timeout",
"600", "VMware client timeout in seconds", null),
 
     // Midonet
     MidoNetAPIServerAddress("Network", ManagementServer.class, String.class, "midonet.apiserver.address",
"http://localhost:8081", "Specify the address at which the Midonet API server can be contacted
(if using Midonet)", null),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
index d1adbc2..a0122d2 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -109,6 +109,7 @@ public class VmwareClient {
     private VimPortType vimPort;
     private String serviceCookie;
     private final String SVC_INST_NAME = "ServiceInstance";
+    private int vCenterSessionTimeout = 600000; // Timeout in milliseconds
 
     private boolean isConnected = false;
 
@@ -132,8 +133,8 @@ public class VmwareClient {
         ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
         ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
 
-        ctxt.put("com.sun.xml.internal.ws.request.timeout", 600000);
-        ctxt.put("com.sun.xml.internal.ws.connect.timeout", 600000);
+        ctxt.put("com.sun.xml.internal.ws.request.timeout", vCenterSessionTimeout);
+        ctxt.put("com.sun.xml.internal.ws.connect.timeout", vCenterSessionTimeout);
 
         ServiceContent serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
 
@@ -616,4 +617,9 @@ public class VmwareClient {
        }
        return propmor;
     }
+
+    public void setVcenterSessionTimeout(int vCenterSessionTimeout) {
+        this.vCenterSessionTimeout = vCenterSessionTimeout;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a915001/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
----------------------------------------------------------------------
diff --git a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
b/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
index c0bd562..c8363d6 100644
--- a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
+++ b/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
@@ -48,6 +48,7 @@ public class TestVmwareContextFactory {
 			s_logger.debug("initialize VmwareContext. url: " + serviceUrl + ", username: " + vCenterUserName
+ ", password: " + StringUtils.getMaskedPasswordForDisplay(vCenterPassword));
 
 		VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
+        vimClient.setVcenterSessionTimeout(600000); // Timeout in milliseconds
 		vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
 
 		VmwareContext context = new VmwareContext(vimClient, vCenterAddress);


Mime
View raw message