Package com.vmware.vim25

Examples of com.vmware.vim25.VMwareDVSConfigSpec


        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 */
 
View Full Code Here


                                   newVmName,
                                   rp.getName(),
                                   host.getName(),
                                   datastore.getName()));
       
        OvfCreateImportSpecResult ovfImportResult = null;
        HttpNfcLease httpNfcLease = null;       

        /* create import spec */
        ovfImportResult =
            conn_.getServiceInstance().getOvfManager().createImportSpec
            (ovfDescriptor, rp, datastore, importSpecParams);

        /* import execution */
        try {
            httpNfcLease =
                rp.importVApp(ovfImportResult.getImportSpec(), vmFolder, host);
        } catch (Exception e) {
            logger_.warning("importVapp failed.");
            throw e;
        }

View Full Code Here

        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);
View Full Code Here

 
  public ObjectContent[] getVmPropertiesOnHyperHost(String[] propertyPaths) throws Exception {
    if(s_logger.isTraceEnabled())
      s_logger.trace("vCenter API trace - retrieveProperties() for VM properties. target MOR: " + _mor.get_value() + ", properties: " + new Gson().toJson(propertyPaths));
   
    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("VirtualMachine");
    pSpec.setPathSet(propertyPaths);
   
      TraversalSpec host2VmTraversal = new TraversalSpec();
      host2VmTraversal.setType("HostSystem");
      host2VmTraversal.setPath("vm");
      host2VmTraversal.setName("host2VmTraversal");
View Full Code Here

  @Override
  public ObjectContent[] getDatastorePropertiesOnHyperHost(String[] propertyPaths) throws Exception {
    if(s_logger.isTraceEnabled())
      s_logger.trace("vCenter API trace - retrieveProperties() on Datastore properties. target MOR: " + _mor.get_value() + ", properties: " + new Gson().toJson(propertyPaths));

    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("Datastore");
    pSpec.setPathSet(propertyPaths);
   
      TraversalSpec host2DatastoreTraversal = new TraversalSpec();
      host2DatastoreTraversal.setType("HostSystem");
      host2DatastoreTraversal.setPath("datastore");
      host2DatastoreTraversal.setName("host2DatastoreTraversal");
View Full Code Here

  public ManagedObjectReference getNetworkMor(String portGroupName) throws Exception {
    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("Network");
    pSpec.setPathSet(new String[] {"summary.name"});
   
      TraversalSpec host2NetworkTraversal = new TraversalSpec();
      host2NetworkTraversal.setType("HostSystem");
      host2NetworkTraversal.setPath("network");
      host2NetworkTraversal.setName("host2NetworkTraversal");

      ObjectSpec oSpec = new ObjectSpec();
      oSpec.setObj(_mor);
      oSpec.setSkip(Boolean.TRUE);
      oSpec.setSelectSet(new SelectionSpec[] { host2NetworkTraversal });
View Full Code Here

   
    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("VirtualMachine");
    pSpec.setPathSet(propertyPaths);
   
      TraversalSpec host2VmTraversal = new TraversalSpec();
      host2VmTraversal.setType("HostSystem");
      host2VmTraversal.setPath("vm");
      host2VmTraversal.setName("host2VmTraversal");

      ObjectSpec oSpec = new ObjectSpec();
      oSpec.setObj(_mor);
      oSpec.setSkip(Boolean.TRUE);
      oSpec.setSelectSet(new SelectionSpec[] { host2VmTraversal });
View Full Code Here

    PropertySpec pSpec = new PropertySpec();
    pSpec.setType("Datastore");
    pSpec.setPathSet(propertyPaths);
   
      TraversalSpec host2DatastoreTraversal = new TraversalSpec();
      host2DatastoreTraversal.setType("HostSystem");
      host2DatastoreTraversal.setPath("datastore");
      host2DatastoreTraversal.setName("host2DatastoreTraversal");

      ObjectSpec oSpec = new ObjectSpec();
      oSpec.setObj(_mor);
      oSpec.setSkip(Boolean.TRUE);
      oSpec.setSelectSet(new SelectionSpec[] { host2DatastoreTraversal });
View Full Code Here

                }
            }
        }

        // First create a DVSconfig spec.
        VMwareDVSConfigSpec dvsSpec = new VMwareDVSConfigSpec();
        // Next, add the required primary and secondary vlan config specs to the dvs config spec.
        if (!vlanmap.containsKey(vid)) {
            VMwareDVSPvlanConfigSpec ppvlanConfigSpec = createDVPortPvlanConfigSpec(vid, vid, PvlanType.promiscuous, PvlanOperation.add);
            dvsSpec.getPvlanConfigSpec().add(ppvlanConfigSpec);
        }
        if ( !vid.equals(spvlanid) && !vlanmap.containsKey(spvlanid)) {
            VMwareDVSPvlanConfigSpec spvlanConfigSpec = createDVPortPvlanConfigSpec(vid, spvlanid, PvlanType.isolated, PvlanOperation.add);
            dvsSpec.getPvlanConfigSpec().add(spvlanConfigSpec);
        }

        if (dvsSpec.getPvlanConfigSpec().size() > 0) {
            // We have something to configure on the DVS... so send it the command.
            // When reconfiguring a vmware DVSwitch, we need to send in the configVersion in the spec.
            // Let's retrieve this switch's configVersion first.
            String dvsConfigVersion = dvSwitchMo.getDVSConfigVersion(morDvSwitch);
            dvsSpec.setConfigVersion(dvsConfigVersion);

            // Reconfigure the dvs using this spec.
            try {
                dvSwitchMo.updateVMWareDVSwitchGetTask(morDvSwitch, dvsSpec);
            } catch (AlreadyExistsFaultMsg e) {
View Full Code Here

                }
            }
        }

        // First create a DVSconfig spec.
        VMwareDVSConfigSpec dvsSpec = new VMwareDVSConfigSpec();
        // Next, add the required primary and secondary vlan config specs to the dvs config spec.
        if (!vlanmap.containsKey(vid)) {
            VMwareDVSPvlanConfigSpec ppvlanConfigSpec = createDVPortPvlanConfigSpec(vid, vid, PvlanType.promiscuous, PvlanOperation.add);
            dvsSpec.getPvlanConfigSpec().add(ppvlanConfigSpec);
        }
        if (!vid.equals(spvlanid) && !vlanmap.containsKey(spvlanid)) {
            VMwareDVSPvlanConfigSpec spvlanConfigSpec = createDVPortPvlanConfigSpec(vid, spvlanid, PvlanType.isolated, PvlanOperation.add);
            dvsSpec.getPvlanConfigSpec().add(spvlanConfigSpec);
        }

        if (dvsSpec.getPvlanConfigSpec().size() > 0) {
            // We have something to configure on the DVS... so send it the command.
            // When reconfiguring a vmware DVSwitch, we need to send in the configVersion in the spec.
            // Let's retrieve this switch's configVersion first.
            String dvsConfigVersion = dvSwitchMo.getDVSConfigVersion(morDvSwitch);
            dvsSpec.setConfigVersion(dvsConfigVersion);

            // Reconfigure the dvs using this spec.
            try {
                dvSwitchMo.updateVMWareDVSwitchGetTask(morDvSwitch, dvsSpec);
            } catch (AlreadyExistsFaultMsg e) {
View Full Code Here

TOP

Related Classes of com.vmware.vim25.VMwareDVSConfigSpec

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.