Package com.cloud.hypervisor.vmware.mo

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


                    s_logger.debug("There is already a VM snapshot task running, wait for it");
                    context.getVimClient().waitForTask(taskMor);
                }
            }

            HostMO hostMo = (HostMO)hyperHost;
            vmMo = hyperHost.findVmOnHyperHost(vmName);

            if (vmMo == null) {
                vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
            }

            if (vmMo == null) {
                String msg = "Unable to find VM for RevertToVMSnapshotCommand";
                s_logger.debug(msg);

                return new RevertToVMSnapshotAnswer(cmd, false, msg);
            } else {
                if (cmd.isReloadVm()) {
                    vmMo.reload();
                }

                boolean result = false;

                if (snapshotName != null) {
                    ManagedObjectReference morSnapshot = vmMo.getSnapshotMor(snapshotName);

                    result = hostMo.revertToSnapshot(morSnapshot);
                } else {
                    return new RevertToVMSnapshotAnswer(cmd, false, "Unable to find the snapshot by name " + snapshotName);
                }

                if (result) {
View Full Code Here


    public static VirtualMachineMO pickOneVmOnRunningHost(List<VirtualMachineMO> vmList, boolean bFirstFit) throws Exception {
        List<VirtualMachineMO> candidates = new ArrayList<VirtualMachineMO>();

        for (VirtualMachineMO vmMo : vmList) {
            HostMO hostMo = vmMo.getRunningHost();
            if (hostMo.isHyperHostConnected())
                candidates.add(vmMo);
        }

        if (candidates.size() == 0)
            return null;
View Full Code Here

                    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

            Map<VmwareResource, Map<String, String>> resources = new HashMap<VmwareResource, Map<String, String>>();
            for (ManagedObjectReference morHost : morHosts) {
                Map<String, String> details = new HashMap<String, String>();
                Map<String, Object> params = new HashMap<String, Object>();

                HostMO hostMo = new HostMO(context, morHost);
                details.put("url", hostMo.getHostName());
                details.put("username", username);
                details.put("password", password);
                String guid = morHost.getType() + ":" + morHost.getValue() + "@" + url.getHost();
                details.put("guid", guid);

                params.put("url", hostMo.getHostName());
                params.put("username", username);
                params.put("password", password);
                params.put("zone", Long.toString(dcId));
                params.put("pod", Long.toString(podId));
                params.put("cluster", Long.toString(clusterId));
View Full Code Here

        morHyperHost.setType(hostTokens[0]);
        morHyperHost.setValue(hostTokens[1]);

        if (morHyperHost.getType().equalsIgnoreCase("HostSystem")) {
            HostMO hostMo = new HostMO(context, morHyperHost);

            try {

                ManagedObjectReference mor = hostMo.getHyperHostCluster();
                ClusterMO clusterMo = new ClusterMO(hostMo.getContext(), mor);
                List<Pair<ManagedObjectReference, String>> hostsInCluster = clusterMo.getClusterHosts();
                for (Pair<ManagedObjectReference, String> hostPair : hostsInCluster) {
                    HostMO hostIteratorMo = new HostMO(hostMo.getContext(), hostPair.first());

                    VmwareHypervisorHostNetworkSummary netSummary = hostIteratorMo
                            .getHyperHostNetworkSummary(hostIteratorMo.getHostType() == VmwareHostType.ESXi ? cmd
                                    .getContextParam("manageportgroup") : cmd.getContextParam("serviceconsole"));
                    _resource.ensureOutgoingRuleForAddress(netSummary.getHostIp());

                    s_logger.info("Setup firewall rule for host: " + netSummary.getHostIp());
                }
View Full Code Here

        morHyperHost.setType(hostTokens[0]);
        morHyperHost.setValue(hostTokens[1]);

        if (morHyperHost.getType().equalsIgnoreCase("HostSystem")) {
            HostMO hostMo = new HostMO(context, morHyperHost);
            try {
                VmwareHypervisorHostNetworkSummary netSummary = hostMo
                        .getHyperHostNetworkSummary(hostMo.getHostType() == VmwareHostType.ESXi ? cmd
                                .getContextParam("manageportgroup") : cmd.getContextParam("serviceconsole"));
                assert (netSummary != null);
                if (netSummary.getHostIp() != null && !netSummary.getHostIp().isEmpty()) {
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Context validation succeeded. Validated via host: " + netSummary.getHostIp()
View Full Code Here

                        VirtualMachineDiskInfo diskInfo = null;
                        if(vol.getChainInfo() != null)
                          diskInfo = _gson.fromJson(vol.getChainInfo(), VirtualMachineDiskInfo.class);
                       
                       
                        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 (resource.getVmState(vmMo) != State.Stopped) {
                            vmMo.safePowerOff(_shutdown_waitMs);
View Full Code Here

            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

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

            }

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

            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

TOP

Related Classes of com.cloud.hypervisor.vmware.mo.HostMO

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.