当前位置: 首页>>代码示例>>Java>>正文


Java Datacenter类代码示例

本文整理汇总了Java中com.vmware.vim25.mo.Datacenter的典型用法代码示例。如果您正苦于以下问题:Java Datacenter类的具体用法?Java Datacenter怎么用?Java Datacenter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Datacenter类属于com.vmware.vim25.mo包,在下文中一共展示了Datacenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
  super.setUp();
  myIdxStorage = createTempDir();
  FakeModel.instance().addDatacenter("dc");
  FakeModel.instance().addFolder("cf").setParent("dc", Datacenter.class);
  FakeModel.instance().addResourcePool("rp").setParentFolder("cf");
  FakeModel.instance().addVM("image1").setParentFolder("cf");
  FakeModel.instance().addVM("image2").setParentFolder("cf");
  FakeModel.instance().addVM("image_template").setParentFolder("cf");
  FakeModel.instance().addVMSnapshot("image2", "snap");
  FakeModel.instance().getCustomizationSpecs().put("someCustomization", new CustomizationSpec());
  FakeModel.instance().getCustomizationSpecs().put("linux", new CustomizationSpec());
  myFakeApiConnector = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null);
  setInternalProperty("teamcity.vsphere.instance.status.update.delay.ms", "250");
  myTaskManager = new MyExposingVmwareUpdateTaskManager();
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:19,代码来源:VmwarePooledUpdateInstanceTaskTest.java

示例2: check_same_datacenter

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void check_same_datacenter() throws InterruptedException {
  FakeModel.instance().addDatacenter("dc2");
  FakeModel.instance().addFolder("cf2").setParent("dc2", Datacenter.class);
  FakeModel.instance().addResourcePool("rp2").setParentFolder("cf2");
  FakeModel.instance().addVM("image3").setParentFolder("cf");
  updateClientParameters(CloudProfileUtil.collectionFromJson(
    "[{sourceVmName:'image1', behaviour:'START_STOP'}," +
      "{sourceVmName:'image2',snapshot:'snap*',folder:'cf',pool:'rp',maxInstances:3,behaviour:'ON_DEMAND_CLONE'}," +
      "{sourceVmName:'image_template', snapshot:'" + VmwareConstants.CURRENT_STATE + "',folder:'cf',pool:'rp',maxInstances:3,behaviour:'FRESH_CLONE'}, " +
      "{sourceVmName:'image3',snapshot:'" + VmwareConstants.CURRENT_STATE + "'," + "folder:'cf2',pool:'rp2',maxInstances:3,behaviour:'ON_DEMAND_CLONE'}]", PROJECT_ID));
  recreateClient();

  final CloudInstanceUserData userData = createUserData("image3_agent");
  final VmwareCloudInstance vmwareCloudInstance = myClient.startNewInstance(getImageByName("image3"), userData);
  new WaitFor(10 * 1000) {
    @Override
    protected boolean condition() {
      return vmwareCloudInstance.getStatus() == InstanceStatus.ERROR && vmwareCloudInstance.getErrorInfo() != null;
    }
  }.assertCompleted();

  final String msg = vmwareCloudInstance.getErrorInfo().getMessage();
  assertContains(msg, "Unable to find folder cf2 in datacenter dc");
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:25,代码来源:VmwareCloudIntegrationTest.java

示例3: VCenterDB

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VCenterDB(String vcenterUrl, String vcenterUsername,
                 String vcenterPassword, String contrailDcName, String contrailClusterName,
                 String contrailDvsName, String ipFabricPgName, Mode mode) {
    this.vcenterUrl             = vcenterUrl;
    this.vcenterUsername        = vcenterUsername;
    this.vcenterPassword        = vcenterPassword;
    this.contrailDataCenterName = contrailDcName;
    this.contrailClusterName = contrailClusterName;
    this.contrailDvSwitchName   = contrailDvsName;
    this.contrailIpFabricPgName = ipFabricPgName;
    this.mode                   = mode;

    s_logger.info("VCenterDB(" + contrailDvsName + ", " + ipFabricPgName + ")");
    datacenters = new ConcurrentHashMap<String, Datacenter>();
    dvswitches = new ConcurrentHashMap<String, VmwareDistributedVirtualSwitch>();
    dvsPvlanMap = new ConcurrentHashMap<String, VMwareDVSPvlanMapEntry[]>();

    // Create ESXi host to vRouterVM Ip address map
    buildEsxiToVRouterIpMap();
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:21,代码来源:VCenterDB.java

示例4: getIpPoolById

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public IpPool getIpPoolById(Integer poolid,  String nwName, Datacenter dc, String dcName)
        throws RemoteException {

    if (ipPools == null) {
        ipPools = ipPoolManager.queryIpPools(dc);
        if (ipPools == null || ipPools.length == 0) {
            s_logger.debug(" Datacenter: " + dcName + " IP Pools NOT configured");
            return null;
        }
    }

    // refresh cached pools and try again
    ipPools = ipPoolManager.queryIpPools(dc);
    if (ipPools == null || ipPools.length == 0) {
        s_logger.debug(" Datacenter: " + dcName + " IP Pools NOT configured");
        return null;
    }

    return getIpPool(poolid, nwName);
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:21,代码来源:VCenterDB.java

示例5: populateVCenterServerInfo

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
private void populateVCenterServerInfo() {
    VCenterServerInfo vCenterServerInfo = vCenterPluginInfo.getVCenterServerInfo();

    if (VCenterNotify.getVcenterDB() != null) {
        vCenterServerInfo.setUrl(VCenterNotify.getVcenterDB().getVcenterUrl() );

        vCenterServerInfo.setConnected(VCenterNotify.getVCenterConnected());

        vCenterServerInfo.setOperationalStatus(VCenterNotify.getVcenterDB().getOperationalStatus());
        Datacenter dc = VCenterNotify.getVcenterDB().getDatacenter();
        if (dc != null && dc.getMOR() != null) {
            vCenterServerInfo.setDatacenterMor(dc.getMOR().getVal());
        }
        VmwareDistributedVirtualSwitch dvs = VCenterNotify.getVcenterDB().getDvs();
        if (dvs != null && dvs.getMOR() != null) {
            vCenterServerInfo.setDvsMor(dvs.getMOR().getVal());
        }
    }
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:20,代码来源:VCenterPluginResp.java

示例6: setUp

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
  super.setUp();
  FakeModel.instance().clear();
  myTaskExecutor = new CloudAsyncTaskExecutor("Test-vmware");
  myApiConnector = new FakeApiConnector(VmwareCloudIntegrationTest.TEST_SERVER_UUID, VmwareCloudIntegrationTest.PROFILE_ID);
  myIdxStorage = createTempDir();
  Map<String, String> params = new HashMap<>();
  params.put("nickname", "imageNickname");
  params.put("sourceVmName", "srcVM");
  params.put("snapshot", "srcVMSnap");
  params.put("folder", "folderId");
  params.put("pool", "rpId");
  params.put("behaviour", CloneBehaviour.FRESH_CLONE.toString());
  params.put("maxInstances", "5");
  CloudImageParameters imageParameters = new CloudImageParametersImpl(params, VmwareCloudIntegrationTest.PROJECT_ID);

  myImageDetails = new VmwareCloudImageDetails(imageParameters);

  FakeModel.instance().addDatacenter("dc2");
  FakeModel.instance().addFolder("folderId").setParent("dc2", Datacenter.class);
  FakeModel.instance().addVM("srcVM").setParentFolder("folderId");
  FakeModel.instance().addResourcePool("rpId").setParentFolder("folderId");

  FakeModel.instance().addVMSnapshot("srcVM", "srcVMSnap");

  myProfile = VmwareTestUtils.createProfileFromProps(new CloudClientParametersImpl(Collections.emptyMap(), Collections.emptyList()));
  myImage = new VmwareCloudImage(myApiConnector, myImageDetails, myTaskExecutor, myIdxStorage, myProfile);

  myCloudClient = new VMWareCloudClient(myProfile, myApiConnector, new VmwareUpdateTaskManager(), createTempDir());
  myCloudClient.populateImagesData(Collections.singletonList(myImageDetails));
  myUpdateTask = new UpdateInstancesTask<VmwareCloudInstance, VmwareCloudImage, VMWareCloudClient>(myApiConnector, myCloudClient, 10*1000, false);
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:34,代码来源:VmwareCloudImageTest.java

示例7: deleteDisk

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public void deleteDisk(String datastoreName, String fileName) {
    // Datacenter
    ManagedEntity datacenter = vmwareClient.getRootEntity();

    // Datastore
    Datastore datastore = vmwareClient.search(Datastore.class, datastoreName);
    if (datastore == null) {
        // データストアが見つからない場合
        throw new AutoException("EPROCESS-000505", datastoreName);
    }

    // ディスクの削除
    FileManager fileManager = vmwareClient.getServiceInstance().getFileManager();
    if (fileManager == null) {
        // fileManagerが利用できない場合
        throw new AutoException("EPROCESS-000533");
    }

    try {
        // ディスク削除
        fileManager.deleteDatastoreFile_Task(fileName, (Datacenter) datacenter);
        // ディスク削除後にごみができ、再度アタッチするとエラーになるので削除
        String flatname;
        flatname = fileName.substring(0, fileName.length() - 5) + "-flat.vmdk";
        fileManager.deleteDatastoreFile_Task(flatname, (Datacenter) datacenter);
    } catch (RemoteException e) {
        throw new AutoException("EPROCESS-000522", e, fileName);
    }

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100455", fileName));
    }
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:34,代码来源:VmwareProcessClient.java

示例8: getVmwareDvs

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VmwareDistributedVirtualSwitch getVmwareDvs(String name,
        Datacenter dc, String dcName)
                throws RemoteException {
    if (dvswitches.containsKey(name)) {
        return dvswitches.get(name);
    }

    String description = "<dvs " + name + ", datacenter " + dcName
            + ", vCenter " + vcenterUrl + ">.";

    InventoryNavigator inventoryNavigator = new InventoryNavigator(dc);

    VmwareDistributedVirtualSwitch dvs = null;
    try {
        dvs = (VmwareDistributedVirtualSwitch)inventoryNavigator.searchManagedEntity(
                "VmwareDistributedVirtualSwitch", name);
    } catch (RemoteException e ) {
        operationalStatus = "Failed to retrieve " + description;
        s_logger.error(operationalStatus);
        throw new RemoteException(operationalStatus, e);
    }

    if (dvs == null) {
        operationalStatus = "Failed to retrieve " + description;
        s_logger.error(operationalStatus);
        throw new RemoteException(operationalStatus);
    }

    s_logger.info("Found " + description);
    dvswitches.put(name, dvs);
    return dvs;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:33,代码来源:VCenterDB.java

示例9: getDvsPvlanMap

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public VMwareDVSPvlanMapEntry[] getDvsPvlanMap(String dvsName, Datacenter dc, String dcName)
                throws RemoteException {
    if (dvsPvlanMap.containsKey(dvsName)) {
        return dvsPvlanMap.get(dvsName);
    }

    VmwareDistributedVirtualSwitch dvs = getVmwareDvs(dvsName, dc, dcName);

    // Extract private vlan entries for the virtual switch
    VMwareDVSConfigInfo dvsConfigInfo = (VMwareDVSConfigInfo) dvs.getConfig();
    if (dvsConfigInfo == null) {
        s_logger.error("dvSwitch: " + dvsName
                + " Datacenter: " + dcName + " ConfigInfo is empty");
    }

    if (!(dvsConfigInfo instanceof VMwareDVSConfigInfo)) {
        s_logger.error("dvSwitch: " + dvsName +
                " Datacenter: " + dcName + " ConfigInfo " +
                "isn't instanceof VMwareDVSConfigInfo");
    }

    VMwareDVSPvlanMapEntry[] pvlanMapArray = dvsConfigInfo.getPvlanConfig();
    if (pvlanMapArray != null) {
        dvsPvlanMap.put(dvsName, pvlanMapArray);
        s_logger.info("Found private vlan map array on dvSwitch: " + dvsName +
                " Datacenter: " + dcName);
        return pvlanMapArray;
    }

    s_logger.error("dvSwitch: " + dvsName +
            " Datacenter: " + dcName + " Private VLAN NOT" +
            "configured");
    return null;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:35,代码来源:VCenterDB.java

示例10: isVmEventOnMonitoredCluster

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
public boolean isVmEventOnMonitoredCluster(Event event, String hostName)
    throws RemoteException {
    String dcName;
    Datacenter dc;

    // If contrailClusterName is null, all clusters under datacenter 
    // are monitored by vcenter plugin.
    if (contrailClusterName == null)
        return true;

    if (event.getHost() != null) {
        hostName = event.getHost().getName();
        HostSystem host = getVmwareHost(hostName, contrailDC, contrailDataCenterName);

        if (host != null) {
            ClusterComputeResource cluster = (ClusterComputeResource) host.getParent();
            if (cluster != null) {
                String clstrName = cluster.getName();
                if (clstrName != null && clstrName.equals(contrailClusterName)) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:28,代码来源:VCenterDB.java

示例11: createDatacenterEventFilter

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
private void createDatacenterEventFilter(Datacenter dc) throws RemoteException {

        if (dc == null) {
            s_logger.error("Cannot register for events on null datacenter  ");
            return;
        }
        s_logger.info("Register for events on datacenter ");

        String[] eventNames = {
            // Host events
            "HostConnectionLostEvent",
            "HostConnectedEvent",
            "EnteredMaintenanceModeEvent",
            "ExitMaintenanceModeEvent",

            // VM events
            // VM create events
             "VmCreatedEvent",
            "VmClonedEvent",
            "VmDeployedEvent",
            // VM modify events
            "VmPoweredOnEvent",
            "DrsVmPoweredOnEvent",
            "VmPoweredOffEvent",
            "VmSuspendedEvent",
            "VmRenamedEvent",
            "VmMacChangedEvent",
            "VmMacAssignedEvent",
            "VmReconfiguredEvent",
            // VM Migration events
            "DrsVmMigratedEvent",
            "VmMigratedEvent",
            // VM delete events
            "VmRemovedEvent"
        };

        watchManagedObjectEvents(dc, eventNames);
    }
 
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:39,代码来源:VCenterNotify.java

示例12: copyVirtualDiskTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
Task copyVirtualDiskTask(String sourceName, Datacenter sourceDatacenter, String destName,
Datacenter destDatacenter, VirtualDiskSpec destSpec, Boolean force) throws FileFault, RuntimeFault, RemoteException;
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:3,代码来源:VirtualDiskManagerApi.java

示例13: changeOwner

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public void changeOwner(String name, Datacenter datacenter, String owner) throws InvalidDatastore, FileFault, UserNotFound, RuntimeFault, RemoteException {
   //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java

示例14: copyDatastoreFileTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public Task copyDatastoreFileTask(String sourceName, Datacenter sourceDatacenter, String destinationName, Datacenter destinationDatacenter, boolean force) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   return null;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java

示例15: deleteDatastoreFileTask

import com.vmware.vim25.mo.Datacenter; //导入依赖的package包/类
@Override
public Task deleteDatastoreFileTask(String name, Datacenter datacenter) throws FileFault, InvalidDatastore, RuntimeFault, RemoteException {
   return null;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:5,代码来源:VSphereFileManager.java


注:本文中的com.vmware.vim25.mo.Datacenter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。