Package com.vmware.vim25.mo

Examples of com.vmware.vim25.mo.HostSystem


     */
    private HostSystem getAvailableHost(String hostName)
        throws Exception
    {

        HostSystem host = null;

        if (hostName != null) {
            List<HostSystem> hosts = getAllHostList();
            for (HostSystem h: hosts) {
                if (hostName.equals(h.getName())) {
                    host = h; break;
                }
            }
        }

        if (hostName != null && host == null) {
            logger_.warning
                (String.format("Host %s not found.", hostName));
            hostName = null;
        }
       
        if (hostName == null) {
            host = getDefaultHost();
            logger_.info(String.format
                         ("Use default host %s.", host.getName()));
        }

        if (host == null) {
            throw new Exception("host is null.");
        }
View Full Code Here


    String password = clp.get_option("password");
    String hostname = clp.get_option("hostname");

    ServiceInstance si = new ServiceInstance(new URL(urlStr),
        username, password, true);
    HostSystem host = (HostSystem) new InventoryNavigator(si
        .getRootFolder()).searchManagedEntity("HostSystem",
        hostname);

    if (host == null) {
      System.out.println("Host cannot be found");
      return;
    }

    HostAutoStartManager hasm = host.getHostAutoStartManager();
    if (hasm == null) {
      System.out
          .println("HostAutoStartManager is not available.");
      return;
    }
View Full Code Here

    ServiceInstance si = new ServiceInstance(
        new URL(args[0]), args[1], args[2], true);

    String hostname = args[3];
    Folder rootFolder = si.getRootFolder();
    HostSystem host = null;
    host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntity("HostSystem", hostname);

    if(host==null)
    {
      System.out.println("Cannot find the host:" + hostname);
      si.getServerConnection().logout();
      return;
    }
    HostDateTimeSystem hdts = host.getHostDateTimeSystem();
   
    HostDateTimeInfo info = hdts.getDateTimeInfo();

    System.out.println("The NTP Servers:");
    HostNtpConfig cfg = info.getNtpConfig();
View Full Code Here

    ServiceInstance si = new ServiceInstance(new URL(urlStr),
        username, password, true);
    Folder rootFolder = si.getRootFolder();

    HostSystem host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntities("HostSystem")[0];

    System.out.println(host.getName());
    HostServiceTicket ticket = host.acquireCimServicesTicket();
    System.out.println("\nHost Name:" + ticket.getHost());
    System.out.println("sessionId=" + ticket.getSessionId());
    System.out.println("sslThumpprint="
        + ticket.getSslThumbprint());
    System.out.println("serviceVersion="
View Full Code Here

    String ovfLocal = args[4];
    String hostip = args[3];
    String newVmName = args[5];
   
    HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);
     
    System.out.println("Host Name : " + host.getName());
    System.out.println("Network : " + host.getNetworks()[0].getName());
    System.out.println("Datastore : " + host.getDatastores()[0].getName());

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

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

    String ovfDescriptor = readOvfContent(ovfLocal);
    if (ovfDescriptor == null)
    {
      si.getServerConnection().logout();
      return;
    }
   
    System.out.println("ovfDesc:" + ovfDescriptor);
     
    ResourcePool rp = ((ComputeResource)host.getParent()).getResourcePool();

    OvfCreateImportSpecResult ovfImportResult = si.getOvfManager().createImportSpec(
        ovfDescriptor, rp, host.getDatastores()[0], importSpecParams);

    if(ovfImportResult==null)
    {
      si.getServerConnection().logout();
      return;
View Full Code Here

    String hostname = "dev.acme.com";
    String portGroupName = "ViMaster PortGroup";
    String switchName = "ViMaster Switch";

    Folder rootFolder = si.getRootFolder();
    HostSystem host = null;
    host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntity("HostSystem", hostname);

    HostNetworkSystem hns = host.getHostNetworkSystem();

    // add a virtual switch
    HostVirtualSwitchSpec spec = new HostVirtualSwitchSpec();
    spec.setNumPorts(8);
    hns.addVirtualSwitch(switchName, spec);
View Full Code Here

    ServiceInstance si = new ServiceInstance(
        new URL(args[0]), args[1], args[2], true);

    String hostname = args[3];
    Folder rootFolder = si.getRootFolder();
    HostSystem host = null;
    host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntity("HostSystem", hostname);

    if(host==null)
    {
      System.out.println("Cannot find the host:" + hostname);
      si.getServerConnection().logout();
      return;
    }
   
    HostFirewallSystem hss = host.getHostFirewallSystem();
   
    HostFirewallInfo hsi = hss.getFirewallInfo();
   
    System.out.println("Default Firewall Policy:");
    HostFirewallDefaultPolicy defPolicy = hsi.getDefaultPolicy();
View Full Code Here

      new URL(args[0]), args[1], args[2], true);
   
    String hostname = "sjin-dev1.eng.vmware.com";

    Folder rootFolder = si.getRootFolder();
    HostSystem host = null;

    host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntity("HostSystem", hostname);
 
    if(host==null)
    {
      System.out.println("Host not found");
      si.getServerConnection().logout();
      return;
    }
   
    HostDatastoreSystem hds = host.getHostDatastoreSystem();
   
    HostNasVolumeSpec hnvs = new HostNasVolumeSpec();
    hnvs.setRemoteHost("10.20.140.25");
    hnvs.setRemotePath("/home/vm_share");
    hnvs.setLocalPath("VM_Share");
View Full Code Here

      String vAppOrVmName = args[3];
      String hostip = args[4];
      String entityType = args[5];
      String targetDir = args[6];

      HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);
       
      System.out.println("Host Name : " + host.getName());
      System.out.println("Network : " + host.getNetworks()[0].getName());
      System.out.println("Datastore : " + host.getDatastores()[0].getName());

      InventoryNavigator iv = new InventoryNavigator(si.getRootFolder());
     
      HttpNfcLease hnLease = null;
     
View Full Code Here

      new URL(args[0]), args[1], args[2], true);
   
    String hostname = "sjin-dev1.eng.vmware.com";

    Folder rootFolder = si.getRootFolder();
    HostSystem host = null;

    host = (HostSystem) new InventoryNavigator(
        rootFolder).searchManagedEntity("HostSystem", hostname);
 
    if(host==null)
    {
      System.out.println("Host not found");
      si.getServerConnection().logout();
      return;
    }
   
    HostStorageSystem hds = host.getHostStorageSystem();
   
    System.out.println("Supported file system volume types:");  
    HostFileSystemVolumeInfo vi = hds.getFileSystemVolumeInfo();
    printFileVolumeInfo(vi);
View Full Code Here

TOP

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

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.