Search in sources :

Example 1 with VmwareClient

use of com.cloud.hypervisor.vmware.util.VmwareClient in project cloudstack by apache.

the class VmwareContextFactory method create.

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";
    if (s_logger.isDebugEnabled())
        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);
    context.registerStockObject(VmwareManager.CONTEXT_STOCK_NAME, s_vmwareMgr);
    context.registerStockObject("serviceconsole", s_vmwareMgr.getServiceConsolePortGroupName());
    context.registerStockObject("manageportgroup", s_vmwareMgr.getManagementPortGroupName());
    context.registerStockObject("noderuninfo", String.format("%d-%d", s_clusterMgr.getManagementNodeId(), s_clusterMgr.getCurrentRunId()));
    context.setPoolInfo(s_pool, VmwareContextPool.composePoolKey(vCenterAddress, vCenterUserName));
    return context;
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VmwareClient(com.cloud.hypervisor.vmware.util.VmwareClient)

Example 2 with VmwareClient

use of com.cloud.hypervisor.vmware.util.VmwareClient in project cloudstack by apache.

the class TestVmwareContextFactory method create.

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";
    if (s_logger.isDebugEnabled())
        s_logger.debug("initialize VmwareContext. url: " + serviceUrl + ", username: " + vCenterUserName + ", password: " + StringUtils.getMaskedPasswordForDisplay(vCenterPassword));
    VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
    vimClient.setVcenterSessionTimeout(1200000);
    vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
    VmwareContext context = new VmwareContext(vimClient, vCenterAddress);
    return context;
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VmwareClient(com.cloud.hypervisor.vmware.util.VmwareClient)

Example 3 with VmwareClient

use of com.cloud.hypervisor.vmware.util.VmwareClient in project cloudstack by apache.

the class VmwareSecondaryStorageContextFactory method create.

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";
    VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
    vimClient.setVcenterSessionTimeout(s_vCenterSessionTimeout);
    vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
    VmwareContext context = new VmwareContext(vimClient, vCenterAddress);
    assert (context != null);
    context.setPoolInfo(s_pool, VmwareContextPool.composePoolKey(vCenterAddress, vCenterUserName));
    return context;
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VmwareClient(com.cloud.hypervisor.vmware.util.VmwareClient)

Aggregations

VmwareClient (com.cloud.hypervisor.vmware.util.VmwareClient)3 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)3