Examples of HostMO


Examples of com.cloud.hypervisor.vmware.mo.HostMO

          String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK);
          int nicMasks = Integer.parseInt(nicMasksStr);
          nicMasks &= ~(1 << publicNicInfo.first().intValue());
          vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks));

            HostMO hostMo = vmMo.getRunningHost();
            List<NetworkDetails> networks = vmMo.getNetworksWithDetails();
            for (NetworkDetails netDetails : networks) {
                if (netDetails.getGCTag() != null && netDetails.getGCTag().equalsIgnoreCase("true")) {
                    if (netDetails.getVMMorsOnNetwork() == null || netDetails.getVMMorsOnNetwork().length == 1) {
                        cleanupNetwork(hostMo, netDetails);
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

                VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
                nicBacking.setDeviceName(networkInfo.second());
                nicBacking.setNetwork(networkInfo.first());
                device.setBacking(nicBacking);
            } else {
                HostMO hostMo = vmMo.getRunningHost();
                DatacenterMO dataCenterMo = new DatacenterMO(hostMo.getContext(), hostMo.getHyperHostDatacenter());
                device.setBacking(dataCenterMo.getDvPortBackingInfo(networkInfo));
            }

            VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
            VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

            }

            NicTO[] nics = vm.getNics();
            for (NicTO nic : nics) {
                // prepare network on the host
                prepareNetworkFromNicInfo(new HostMO(getServiceContext(), _morHyperHost), nic);
            }

            String secStoreUrl = mgr.getSecondaryStorageStoreUrl(Long.parseLong(_dcId));
            if(secStoreUrl == null) {
                String msg = "secondary storage for dc " + _dcId + " is not ready yet?";
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

        VmwareManager mgr = dcMo.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
     
        ObjectContent[] ocs = dcMo.getHostPropertiesOnDatacenterHostFolder(new String[] { "name", "parent" });
        if (ocs != null && ocs.length > 0) {
            for (ObjectContent oc : ocs) {
                HostMO hostMo = new HostMO(dcMo.getContext(), oc.getObj());
                VmwareHypervisorHostNetworkSummary netSummary = hostMo.getHyperHostNetworkSummary(mgr.getManagementPortGroupByHost(hostMo));
                if (destIp.equalsIgnoreCase(netSummary.getHostIp())) {
                    return new HostMO(dcMo.getContext(), oc.getObj());
                }
            }
        }

        throw new Exception("Unable to locate dest host by " + destIp);
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

                    if (vmMo != null) {
                        if (s_logger.isInfoEnabled()) {
                            s_logger.info("Destroy root volume and VM itself. vmName " + vmName);
                        }

                        HostMO hostMo = vmMo.getRunningHost();
                        List<NetworkDetails> networks = vmMo.getNetworksWithDetails();
                       
                        // tear down all devices first before we destroy the VM to avoid accidently delete disk backing files
                        if (getVmState(vmMo) != State.Stopped)
                          vmMo.safePowerOff(_shutdown_waitMs);
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

        VmwareContext context = getServiceContext();

        try {
            VmwareHypervisorHost hyperHost = getHyperHost(context);
            if (hyperHost instanceof HostMO) {
                HostMO hostMo = (HostMO) hyperHost;

                List<Pair<ManagedObjectReference, String>> dsList = hostMo.getLocalDatastoreOnHost();
                for (Pair<ManagedObjectReference, String> dsPair : dsList) {
                    DatastoreMO dsMo = new DatastoreMO(context, dsPair.first());

                    String poolUuid = dsMo.getCustomFieldValue(CustomFieldConstants.CLOUD_UUID);
                    if (poolUuid == null || poolUuid.isEmpty()) {
                        poolUuid = UUID.randomUUID().toString();
                        dsMo.setCustomFieldValue(CustomFieldConstants.CLOUD_UUID, poolUuid);
                    }

                    DatastoreSummary dsSummary = dsMo.getSummary();
                    String address = hostMo.getHostName();
                    StoragePoolInfo pInfo = new StoragePoolInfo(poolUuid, address, dsMo.getMor().get_value(), "", StoragePoolType.LVM, dsSummary.getCapacity(), dsSummary.getFreeSpace());
                    StartupStorageCommand cmd = new StartupStorageCommand();
                    cmd.setName(poolUuid);
                    cmd.setPoolInfo(pInfo);
                    cmd.setGuid(poolUuid); // give storage host the same UUID as the local storage pool itself
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

        try {
          int maxVncPorts = 64;
          int vncPort = 0;
          Random random = new Random();
 
          HostMO vmOwnerHost = vmMo.getRunningHost();
 
          ManagedObjectReference morParent = vmOwnerHost.getParentMor();
          HashMap<String, Integer> portInfo;
          if(morParent.getType().equalsIgnoreCase("ClusterComputeResource")) {
            ClusterMO clusterMo = new ClusterMO(vmOwnerHost.getContext(), morParent);
            portInfo = clusterMo.getVmVncPortsOnCluster();
          } else {
            portInfo = vmOwnerHost.getVmVncPortsOnHost();
          }
         
          // allocate first at 5900 - 5964 range
          Collection<Integer> existingPorts = portInfo.values();
          int val = random.nextInt(maxVncPorts);
          int startVal = val;
          do {
              if (!existingPorts.contains(5900 + val)) {
                  vncPort = 5900 + val;
                  break;
              }
 
              val = (++val) % maxVncPorts;
          } while (val != startVal);
         
          if(vncPort == 0) {
              s_logger.info("we've run out of range for ports between 5900-5964 for the cluster, we will try port range at 59000-60000");

              Pair<Integer, Integer> additionalRange = mgr.getAddiionalVncPortRange();
              maxVncPorts = additionalRange.second();
              val = random.nextInt(maxVncPorts);
              startVal = val;
              do {
                  if (!existingPorts.contains(additionalRange.first() + val)) {
                      vncPort = additionalRange.first() + val;
                      break;
                  }
 
                  val = (++val) % maxVncPorts;
              } while (val != startVal);
          }
 
          if (vncPort == 0) {
              throw new Exception("Unable to find an available VNC port on host");
          }
 
          if (s_logger.isInfoEnabled()) {
              s_logger.info("Configure VNC port for VM " + vmName + ", port: " + vncPort + ", host: " + vmOwnerHost.getHyperHostName());
          }
 
          return VmwareHelper.composeVncOptions(optionsToMerge, true, vncPassword, vncPort, keyboardLayout);
        } finally {
          try {
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

    }

    @Override
    public VmwareHypervisorHost getHyperHost(VmwareContext context, Command cmd) {
        if (_morHyperHost.getType().equalsIgnoreCase("HostSystem")) {
          return new HostMO(context, _morHyperHost);
        }
        return new ClusterMO(context, _morHyperHost);
    }
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

                    if(cleanupMaid.getDatacenterMorValue() != null) {
                      DatacenterMO dcMo = new DatacenterMO(context, "Datacenter", cleanupMaid.getDatacenterMorValue());
                      vmMo = dcMo.findVm(cleanupMaid.getVmName());
                    } else {
                      assert(cleanupMaid.getHostMorValue() != null);
                      HostMO hostMo = new HostMO(context, "HostSystem", cleanupMaid.getHostMorValue());
                      ClusterMO clusterMo = new ClusterMO(context, hostMo.getHyperHostCluster());
                      vmMo = clusterMo.findVmOnHyperHost(cleanupMaid.getVmName());
                    }
                   
                    if(vmMo != null) {
                        s_logger.info("Found left over dummy VM " + cleanupMaid.getVmName() + ", destroy it");
View Full Code Here

Examples of com.cloud.hypervisor.vmware.mo.HostMO

            String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK);
            int nicMasks = Integer.parseInt(nicMasksStr);
            nicMasks &= ~(1 << publicNicInfo.first().intValue());
            vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks));

            HostMO hostMo = vmMo.getRunningHost();
            List<NetworkDetails> networks = vmMo.getNetworksWithDetails();
            for (NetworkDetails netDetails : networks) {
                if (netDetails.getGCTag() != null && netDetails.getGCTag().equalsIgnoreCase("true")) {
                    if (netDetails.getVMMorsOnNetwork() == null || netDetails.getVMMorsOnNetwork().length == 1) {
                        cleanupNetwork(hostMo, netDetails);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.