Package com.vmware.vim25.mo

Examples of com.vmware.vim25.mo.ClusterComputeResource


        VirtualMachineSnapshotTree[] snapTree =
            vm_.getSnapshot().getRootSnapshotList();

        if (snapTree == null) { return null; }
       
        VirtualMachineSnapshotTree st =
            findSnapshotInTree(snapTree, vmSnap);
        return st;
    }
View Full Code Here


     */
    private VirtualMachineSnapshotTree findSnapshotInTree
        (VirtualMachineSnapshotTree[] snapTree, VirtualMachineSnapshot vmSnap)
    {
        for (int i = 0; i < snapTree.length; i ++) {
            VirtualMachineSnapshotTree node = snapTree[i];
            if (node.getSnapshot().equals(vmSnap.getMOR())) {
                return node;
            }
            VirtualMachineSnapshotTree[] childTree =
                node.getChildSnapshotList();
            if (childTree != null) {
                VirtualMachineSnapshotTree ret =
                    findSnapshotInTree(childTree, vmSnap);
                if (ret != null) {
                    return ret;
                }
            }
View Full Code Here

     */
    private ManagedObjectReference findSnapshotInTree
        (VirtualMachineSnapshotTree[] snapTree, String snapName)
    {
        for (int i = 0; i < snapTree.length; i ++) {
            VirtualMachineSnapshotTree node = snapTree[i];
            if (snapName.equals(node.getName())) {
                return node.getSnapshot();
            } else {
                VirtualMachineSnapshotTree[] childTree =
                    node.getChildSnapshotList();
                if (childTree != null) {
                    ManagedObjectReference mor =
                        findSnapshotInTree(childTree, snapName);
                    if (mor != null) { return mor; }
                }
View Full Code Here

        ctrl.setKey(ckey_);
        ctrl.setBusNumber(busNumber_);
        if (isScsi) {
            assert ctrl instanceof VirtualSCSIController;
            VirtualSCSIController scsiCtrl = (VirtualSCSIController) ctrl;
            scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
        }
        controllerSpec.setDevice(ctrl);

        return controllerSpec;
    }
View Full Code Here

   
    ManagedObjectReference mref_drs = new ManagedObjectReference();
    mref_drs.set_value(drs_obj_id);
    mref_drs.setType("ClusterComputeResource");
   
    ClusterComputeResource ccr = (ClusterComputeResource )MorUtil.createExactManagedEntity(si.getServerConnection(), mref_drs);
   
    ClusterConfigSpec ccs = new ClusterConfigSpec();
    ClusterDrsConfigInfo cdci = new ClusterDrsConfigInfo();
    if("manual".equals(mode))
      cdci.setDefaultVmBehavior(DrsBehavior.manual);
    else
      cdci.setDefaultVmBehavior(DrsBehavior.fullyAutomated);
    cdci.setVmotionRate(new Integer(5));
    ccs.setDrsConfig(cdci);
   
    ccr.reconfigureCluster_Task(ccs, true);
   
    si.getServerConnection().logout();
    System.out.println("End of changing DRS config to " + args[3]);
  }
View Full Code Here

    // initialize the system, set up web services
    ServiceInstance si = new ServiceInstance(url, username, password, true);
   
    //create the MOR object for DRS cluster
    ManagedObjectReference mref_drs = createMOR("ClusterComputeResource", drs_obj_id);
    ClusterComputeResource ccr = (ClusterComputeResource )
      MorUtil.createExactManagedEntity(si.getServerConnection(), mref_drs);
   
    // create a new ClusterConfigSpec and populate it with related data for affinity rule
    ClusterConfigSpec ccs = new ClusterConfigSpec();

    ClusterAffinityRuleSpec cars = new ClusterAffinityRuleSpec();
    cars.setName("App and DB Appliance Bundle");
    cars.setEnabled(Boolean.TRUE);
    ManagedObjectReference vm1 = createMOR("VirtualMachine", vm1_oid);
    ManagedObjectReference vm2 = createMOR("VirtualMachine", vm2_oid);
    cars.setVm(new ManagedObjectReference[] {vm1, vm2});
   
    ClusterRuleSpec crs = new ClusterRuleSpec();
    //*NOTE*: the following setOperation has to be called since operation must be set.
    crs.setOperation(ArrayUpdateOperation.add);
    crs.setInfo(cars);

    ccs.setRulesSpec(new ClusterRuleSpec[] {crs});

    // make a call to set the configuration.
    ccr.reconfigureCluster_Task(ccs, true);

    si.getServerConnection().logout();
   
    System.out.println("Done with setting affinity rule for DRS cluster.");
  }
View Full Code Here

      System.out.println("There is no DRS cluster. Exiting.");
      si.getServerConnection().logout();
      return;
    }

    ClusterComputeResource ccr =
        ((ClusterComputeResource)mes[0]);
    EmailMessenger em = new EmailMessenger(
        "mailhost1.vmware.com", "username", "password");

    for(;;)
    {
      StringBuffer sb = new StringBuffer();
      ClusterRecommendation[] recs = ccr.getRecommendation();
      if(recs!=null)
      {
        for(int i=0; i< recs.length; i++)
        {
          sb.append("\n\nRecommendation #" + (i+1));
View Full Code Here

    ManagedEntity[] clusters = new InventoryNavigator(rootFolder).searchManagedEntities("ClusterComputeResource");

    ArrayList<String> clusterList=new ArrayList<String>();
   
    ClusterComputeResource a;
   
    for(int i=0; i<clusters.length; i++)
    {
      ClusterComputeResource cluster = (ClusterComputeResource) clusters[i];
      clusterList.add(cluster.getName());
    }
    return clusterList;
  }
View Full Code Here

        /* Get the HostSystem */
        HostSystem host = getAvailableHost(hostName);
        assert host != null;

        /* Check the specified datastore exists and available with the host. */
        Datastore datastore = getAvailableDatastore(datastoreName, host);
        assert datastore != null;
       
        /* create spec */
        Folder vmFolder = null;
        OvfCreateImportSpecParams importSpecParams
            = new OvfCreateImportSpecParams();
        String ovfDescriptor = "";

        vmFolder = (Folder) host.getVms()[0].getParent();

        importSpecParams.setLocale("US");
        importSpecParams.setEntityName(newVmName);
        importSpecParams.setDeploymentOption("");
        OvfNetworkMapping networkMapping = new OvfNetworkMapping();
        networkMapping.setName("Network 1");
        networkMapping.setNetwork(host.getNetworks()[0].getMOR());
        importSpecParams.setNetworkMapping(new OvfNetworkMapping[] { networkMapping });
        importSpecParams.setPropertyMapping(null);

        /* read ovf from the file. */
        ovfDescriptor = readOvfContent(ovfPath);

        /* create ovf descriptor */
        ovfDescriptor = escapeSpecialChars(ovfDescriptor);
        //logger_.info("ovfDesc: " + ovfDescriptor);

        ResourcePool rp = ((ComputeResource) host.getParent()).getResourcePool();

        logger_.fine(String.format("vmname: %s\n" +
                                   "resourcepool: %s\n" +
                                   "host:%s\n" +
                                   "datastore:%s\n",
                                   newVmName,
                                   rp.getName(),
                                   host.getName(),
                                   datastore.getName()));
       
        OvfCreateImportSpecResult ovfImportResult = null;
        HttpNfcLease httpNfcLease = null;       

        /* create import spec */
 
View Full Code Here

    private Datastore getAvailableDatastore
        (String datastoreName, HostSystem host)
        throws Exception
    {
        assert host != null;
        Datastore datastore = null;

        if (datastoreName != null) {
            List<Datastore> datastores = getAllDatastoreList(host);
            for (Datastore d: datastores) {
                if (datastoreName.equals(d.getName())) {
                    datastore = d; break;
                }
            }
        }

        if (datastoreName != null && datastore == null) {
            logger_.warning
                (String.format("Datastore %s not found.", datastoreName));
            datastoreName = null;
        }
       
        if (datastoreName == null) {
            datastore = getDefaultDatastore(host);
            logger_.info
                (String.format
                 ("Use default datastore %s.", datastore.getName()));
        }
       
        if (datastore == null) {
            throw new Exception("datastore is null.");
        }
View Full Code Here

TOP

Related Classes of com.vmware.vim25.mo.ClusterComputeResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.