|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.storage.resource; |
18 | 18 |
|
19 | | -import javax.annotation.PostConstruct; |
20 | | -import javax.inject.Inject; |
21 | | - |
22 | 19 | import org.apache.log4j.Logger; |
23 | 20 |
|
24 | | -import com.cloud.configuration.Config; |
25 | | -import com.cloud.configuration.dao.ConfigurationDao; |
26 | 21 | import com.cloud.hypervisor.vmware.util.VmwareClient; |
27 | 22 | import com.cloud.hypervisor.vmware.util.VmwareContext; |
28 | 23 | import com.cloud.hypervisor.vmware.util.VmwareContextPool; |
29 | | -import com.cloud.utils.NumbersUtil; |
30 | 24 |
|
31 | 25 | public class VmwareSecondaryStorageContextFactory { |
32 | 26 | private static final Logger s_logger = Logger.getLogger(VmwareSecondaryStorageContextFactory.class); |
33 | 27 |
|
34 | 28 | private static volatile int s_seq = 1; |
35 | 29 |
|
36 | 30 | private static VmwareContextPool s_pool; |
37 | | - private static ConfigurationDao s_configDao; |
38 | | - |
39 | | - @Inject ConfigurationDao _configDao; |
40 | 31 |
|
41 | 32 | public static void initFactoryEnvironment() { |
42 | 33 | System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory"); |
43 | 34 | s_pool = new VmwareContextPool(); |
44 | 35 | } |
45 | 36 |
|
46 | | - @PostConstruct |
47 | | - void init() { |
48 | | - s_configDao = _configDao; |
49 | | - } |
50 | | - |
51 | 37 | public static VmwareContext create(String vCenterAddress, String vCenterUserName, String vCenterPassword) throws Exception { |
52 | 38 | assert(vCenterAddress != null); |
53 | 39 | assert(vCenterUserName != null); |
54 | 40 | assert(vCenterPassword != null); |
55 | 41 |
|
56 | 42 | String serviceUrl = "https://" + vCenterAddress + "/sdk/vimService"; |
57 | | - int vCenterSessionTimeout = NumbersUtil.parseInt(s_configDao.getValue(Config.VmwareVcenterSessionTimeout.key()), 600) * 1000; |
58 | 43 | VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++); |
59 | | - vimClient.setVcenterSessionTimeout(vCenterSessionTimeout); |
60 | | - vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword); |
| 44 | + vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword); |
61 | 45 | VmwareContext context = new VmwareContext(vimClient, vCenterAddress); |
62 | 46 | assert(context != null); |
63 | 47 |
|
|
0 commit comments