Search in sources :

Example 71 with VmwareHypervisorHost

use of com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost in project cloudstack by apache.

the class VmwareResource method execute.

protected Answer execute(CheckVirtualMachineCommand cmd) {
    final String vmName = cmd.getVmName();
    PowerState powerState = PowerState.PowerUnknown;
    Integer vncPort = null;
    VmwareContext context = getServiceContext();
    VmwareHypervisorHost hyperHost = getHyperHost(context);
    try {
        VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
        if (vmMo != null) {
            powerState = getVmPowerState(vmMo);
            return new CheckVirtualMachineAnswer(cmd, powerState, vncPort);
        } else {
            s_logger.warn("Can not find vm " + vmName + " to execute CheckVirtualMachineCommand");
            return new CheckVirtualMachineAnswer(cmd, powerState, vncPort);
        }
    } catch (Throwable e) {
        createLogMessageException(e, cmd);
        return new CheckVirtualMachineAnswer(cmd, powerState, vncPort);
    }
}
Also used : CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) PowerState(com.cloud.vm.VirtualMachine.PowerState) VirtualMachinePowerState(com.vmware.vim25.VirtualMachinePowerState)

Example 72 with VmwareHypervisorHost

use of com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost in project cloudstack by apache.

the class VmwareResource method execute.

protected Answer execute(PingTestCommand cmd) {
    String controlIp = cmd.getRouterIp();
    if (controlIp != null) {
        String args = " -c 1 -n -q " + cmd.getPrivateIp();
        try {
            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", getSystemVmKeyFile(), null, "/bin/ping" + args);
            if (result.first())
                return new Answer(cmd);
        } catch (Exception e) {
            s_logger.error("Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e);
        }
        return new Answer(cmd, false, "PingTestCommand failed");
    } else {
        VmwareContext context = getServiceContext();
        VmwareHypervisorHost hyperHost = getHyperHost(context);
        try {
            HostMO hostMo = (HostMO) hyperHost;
            ClusterMO clusterMo = new ClusterMO(context, hostMo.getHyperHostCluster());
            VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
            List<Pair<ManagedObjectReference, String>> hosts = clusterMo.getClusterHosts();
            for (Pair<ManagedObjectReference, String> entry : hosts) {
                HostMO hostInCluster = new HostMO(context, entry.first());
                String hostIp = hostInCluster.getHostManagementIp(mgr.getManagementPortGroupName());
                if (hostIp != null && hostIp.equals(cmd.getComputingHostIp())) {
                    if (hostInCluster.isHyperHostConnected())
                        return new Answer(cmd);
                    else
                        return new Answer(cmd, false, "PingTestCommand failed");
                }
            }
        } catch (Exception e) {
            s_logger.error("Unable to execute ping command on host (" + cmd.getComputingHostIp() + "). failure due to " + VmwareHelper.getExceptionMessage(e), e);
        }
        return new Answer(cmd, false, "PingTestCommand failed");
    }
}
Also used : HostMO(com.cloud.hypervisor.vmware.mo.HostMO) VmwareManager(com.cloud.hypervisor.vmware.manager.VmwareManager) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) ClusterMO(com.cloud.hypervisor.vmware.mo.ClusterMO) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException) SetupPersistentNetworkAnswer(com.cloud.agent.api.SetupPersistentNetworkAnswer) ModifyTargetsAnswer(com.cloud.agent.api.ModifyTargetsAnswer) MigrateVmToPoolAnswer(com.cloud.agent.api.MigrateVmToPoolAnswer) GetVncPortAnswer(com.cloud.agent.api.GetVncPortAnswer) ManageSnapshotAnswer(com.cloud.agent.api.ManageSnapshotAnswer) CreatePrivateTemplateAnswer(com.cloud.agent.api.storage.CreatePrivateTemplateAnswer) GetVmVncTicketAnswer(com.cloud.agent.api.GetVmVncTicketAnswer) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) MigrateVolumeAnswer(com.cloud.agent.api.storage.MigrateVolumeAnswer) GetVolumeStatsAnswer(com.cloud.agent.api.GetVolumeStatsAnswer) SetupAnswer(com.cloud.agent.api.SetupAnswer) GetVmStatsAnswer(com.cloud.agent.api.GetVmStatsAnswer) GetVmNetworkStatsAnswer(com.cloud.agent.api.GetVmNetworkStatsAnswer) StopAnswer(com.cloud.agent.api.StopAnswer) NetworkUsageAnswer(com.cloud.agent.api.NetworkUsageAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) CheckOnHostAnswer(com.cloud.agent.api.CheckOnHostAnswer) CheckHealthAnswer(com.cloud.agent.api.CheckHealthAnswer) RevertToVMSnapshotAnswer(com.cloud.agent.api.RevertToVMSnapshotAnswer) CopyVolumeAnswer(com.cloud.agent.api.storage.CopyVolumeAnswer) AttachIsoAnswer(com.cloud.agent.api.AttachIsoAnswer) CreateVMSnapshotAnswer(com.cloud.agent.api.CreateVMSnapshotAnswer) DeleteVMSnapshotAnswer(com.cloud.agent.api.DeleteVMSnapshotAnswer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) RebootAnswer(com.cloud.agent.api.RebootAnswer) GetStoragePoolCapabilitiesAnswer(com.cloud.agent.api.GetStoragePoolCapabilitiesAnswer) PrimaryStorageDownloadAnswer(com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer) StartAnswer(com.cloud.agent.api.StartAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) MigrateAnswer(com.cloud.agent.api.MigrateAnswer) CreateVolumeFromSnapshotAnswer(com.cloud.agent.api.CreateVolumeFromSnapshotAnswer) CheckNetworkAnswer(com.cloud.agent.api.CheckNetworkAnswer) ReplugNicAnswer(com.cloud.agent.api.ReplugNicAnswer) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) ScaleVmAnswer(com.cloud.agent.api.ScaleVmAnswer) MigrateWithStorageAnswer(com.cloud.agent.api.MigrateWithStorageAnswer) ResizeVolumeAnswer(com.cloud.agent.api.storage.ResizeVolumeAnswer) BackupSnapshotAnswer(com.cloud.agent.api.BackupSnapshotAnswer) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) GetUnmanagedInstancesAnswer(com.cloud.agent.api.GetUnmanagedInstancesAnswer) ValidateSnapshotAnswer(com.cloud.agent.api.ValidateSnapshotAnswer) ReadyAnswer(com.cloud.agent.api.ReadyAnswer) PrepareUnmanageVMInstanceAnswer(com.cloud.agent.api.PrepareUnmanageVMInstanceAnswer) PrepareForMigrationAnswer(com.cloud.agent.api.PrepareForMigrationAnswer) GetVmDiskStatsAnswer(com.cloud.agent.api.GetVmDiskStatsAnswer) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) Pair(com.cloud.utils.Pair) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 73 with VmwareHypervisorHost

use of com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost in project cloudstack by apache.

the class VmwareResource method execute.

private Answer execute(SetupPersistentNetworkCommand cmd) {
    VmwareHypervisorHost host = getHyperHost(getServiceContext());
    String hostname = null;
    VmwareContext context = getServiceContext();
    HostMO hostMO = new HostMO(context, host.getMor());
    try {
        prepareNetworkFromNicInfo(hostMO, cmd.getNic(), false, null);
        hostname = host.getHyperHostName();
    } catch (Exception e) {
        return new SetupPersistentNetworkAnswer(cmd, false, "failed to setup port-group due to: " + e.getLocalizedMessage());
    }
    return new SetupPersistentNetworkAnswer(cmd, true, hostname);
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) SetupPersistentNetworkAnswer(com.cloud.agent.api.SetupPersistentNetworkAnswer) HostMO(com.cloud.hypervisor.vmware.mo.HostMO) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException)

Example 74 with VmwareHypervisorHost

use of com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost in project cloudstack by apache.

the class VmwareResource method getVmStats.

private HashMap<String, VmStatsEntry> getVmStats(List<String> vmNames) throws Exception {
    VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
    HashMap<String, VmStatsEntry> vmResponseMap = new HashMap<String, VmStatsEntry>();
    ManagedObjectReference perfMgr = getServiceContext().getServiceContent().getPerfManager();
    VimPortType service = getServiceContext().getService();
    PerfCounterInfo rxPerfCounterInfo = null;
    PerfCounterInfo txPerfCounterInfo = null;
    PerfCounterInfo diskReadIOPerfCounterInfo = null;
    PerfCounterInfo diskWriteIOPerfCounterInfo = null;
    PerfCounterInfo diskReadKbsPerfCounterInfo = null;
    PerfCounterInfo diskWriteKbsPerfCounterInfo = null;
    Integer windowInterval = getVmwareWindowTimeInterval();
    final XMLGregorianCalendar startTime = VmwareHelper.getXMLGregorianCalendar(new Date(), windowInterval);
    final XMLGregorianCalendar endTime = VmwareHelper.getXMLGregorianCalendar(new Date(), 0);
    List<PerfCounterInfo> cInfo = getServiceContext().getVimClient().getDynamicProperty(perfMgr, "perfCounter");
    for (PerfCounterInfo info : cInfo) {
        if ("net".equalsIgnoreCase(info.getGroupInfo().getKey()) && "average".equalsIgnoreCase(info.getRollupType().value())) {
            if ("transmitted".equalsIgnoreCase(info.getNameInfo().getKey())) {
                txPerfCounterInfo = info;
            }
            if ("received".equalsIgnoreCase(info.getNameInfo().getKey())) {
                rxPerfCounterInfo = info;
            }
        }
        if ("virtualdisk".equalsIgnoreCase(info.getGroupInfo().getKey())) {
            if ("numberReadAveraged".equalsIgnoreCase(info.getNameInfo().getKey())) {
                diskReadIOPerfCounterInfo = info;
            }
            if ("numberWriteAveraged".equalsIgnoreCase(info.getNameInfo().getKey())) {
                diskWriteIOPerfCounterInfo = info;
            }
            if ("read".equalsIgnoreCase(info.getNameInfo().getKey())) {
                diskReadKbsPerfCounterInfo = info;
            }
            if ("write".equalsIgnoreCase(info.getNameInfo().getKey())) {
                diskWriteKbsPerfCounterInfo = info;
            }
        }
    }
    int key = ((HostMO) hyperHost).getCustomFieldKey("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
    if (key == 0) {
        s_logger.warn("Custom field " + CustomFieldConstants.CLOUD_VM_INTERNAL_NAME + " is not registered ?!");
    }
    String instanceNameCustomField = "value[" + key + "]";
    final String numCpuStr = "summary.config.numCpu";
    final String cpuUseStr = "summary.quickStats.overallCpuUsage";
    final String guestMemUseStr = "summary.quickStats.guestMemoryUsage";
    final String memLimitStr = "resourceConfig.memoryAllocation.limit";
    final String memMbStr = "config.hardware.memoryMB";
    final String allocatedCpuStr = "summary.runtime.maxCpuUsage";
    ObjectContent[] ocs = hyperHost.getVmPropertiesOnHyperHost(new String[] { "name", numCpuStr, cpuUseStr, guestMemUseStr, memLimitStr, memMbStr, allocatedCpuStr, instanceNameCustomField });
    if (ocs != null && ocs.length > 0) {
        for (ObjectContent oc : ocs) {
            List<DynamicProperty> objProps = oc.getPropSet();
            if (objProps != null) {
                String name = null;
                String numberCPUs = null;
                double maxCpuUsage = 0;
                String memlimit = null;
                String memkb = null;
                String guestMemusage = null;
                String vmNameOnVcenter = null;
                String vmInternalCSName = null;
                double allocatedCpu = 0;
                for (DynamicProperty objProp : objProps) {
                    if (objProp.getName().equals("name")) {
                        vmNameOnVcenter = objProp.getVal().toString();
                    } else if (objProp.getName().contains(instanceNameCustomField)) {
                        if (objProp.getVal() != null)
                            vmInternalCSName = ((CustomFieldStringValue) objProp.getVal()).getValue();
                    } else if (objProp.getName().equals(guestMemUseStr)) {
                        guestMemusage = objProp.getVal().toString();
                    } else if (objProp.getName().equals(numCpuStr)) {
                        numberCPUs = objProp.getVal().toString();
                    } else if (objProp.getName().equals(cpuUseStr)) {
                        maxCpuUsage = NumberUtils.toDouble(objProp.getVal().toString());
                    } else if (objProp.getName().equals(memLimitStr)) {
                        memlimit = objProp.getVal().toString();
                    } else if (objProp.getName().equals(memMbStr)) {
                        memkb = objProp.getVal().toString();
                    } else if (objProp.getName().equals(allocatedCpuStr)) {
                        allocatedCpu = NumberUtils.toDouble(objProp.getVal().toString());
                    }
                }
                maxCpuUsage = (maxCpuUsage / allocatedCpu) * 100;
                if (vmInternalCSName != null) {
                    name = vmInternalCSName;
                } else {
                    name = vmNameOnVcenter;
                }
                if (!vmNames.contains(name)) {
                    continue;
                }
                ManagedObjectReference vmMor = hyperHost.findVmOnHyperHost(name).getMor();
                assert (vmMor != null);
                double networkReadKBs = 0;
                double networkWriteKBs = 0;
                double diskReadIops = 0;
                double diskWriteIops = 0;
                double diskReadKbs = 0;
                double diskWriteKbs = 0;
                final ArrayList<PerfMetricId> perfMetricsIds = new ArrayList<PerfMetricId>();
                if (rxPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(rxPerfCounterInfo, ""));
                }
                if (txPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(txPerfCounterInfo, ""));
                }
                if (diskReadIOPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(diskReadIOPerfCounterInfo, "*"));
                }
                if (diskWriteIOPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(diskWriteIOPerfCounterInfo, "*"));
                }
                if (diskReadKbsPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(diskReadKbsPerfCounterInfo, ""));
                }
                if (diskWriteKbsPerfCounterInfo != null) {
                    perfMetricsIds.add(VmwareHelper.createPerfMetricId(diskWriteKbsPerfCounterInfo, ""));
                }
                if (perfMetricsIds.size() > 0) {
                    try {
                        final PerfQuerySpec qSpec = new PerfQuerySpec();
                        qSpec.setEntity(vmMor);
                        qSpec.setFormat("normal");
                        qSpec.setIntervalId(windowInterval);
                        qSpec.setStartTime(startTime);
                        qSpec.setEndTime(endTime);
                        qSpec.getMetricId().addAll(perfMetricsIds);
                        final List<PerfEntityMetricBase> perfValues = service.queryPerf(perfMgr, Collections.singletonList(qSpec));
                        for (final PerfEntityMetricBase perfValue : perfValues) {
                            if (!(perfValue instanceof PerfEntityMetric)) {
                                continue;
                            }
                            final List<PerfMetricSeries> seriesList = ((PerfEntityMetric) perfValue).getValue();
                            for (final PerfMetricSeries series : seriesList) {
                                if (!(series instanceof PerfMetricIntSeries)) {
                                    continue;
                                }
                                final List<Long> values = ((PerfMetricIntSeries) series).getValue();
                                double sum = 0;
                                for (final Long value : values) {
                                    sum += value;
                                }
                                double avg = sum / (values.size() * 1f);
                                if (series.getId().getCounterId() == rxPerfCounterInfo.getKey()) {
                                    networkReadKBs = avg;
                                }
                                if (series.getId().getCounterId() == txPerfCounterInfo.getKey()) {
                                    networkWriteKBs = avg;
                                }
                                if (series.getId().getCounterId() == diskReadIOPerfCounterInfo.getKey()) {
                                    diskReadIops += avg;
                                }
                                if (series.getId().getCounterId() == diskWriteIOPerfCounterInfo.getKey()) {
                                    diskWriteIops += avg;
                                }
                                if (series.getId().getCounterId() == diskReadKbsPerfCounterInfo.getKey()) {
                                    diskReadKbs = avg;
                                }
                                if (series.getId().getCounterId() == diskWriteKbsPerfCounterInfo.getKey()) {
                                    diskWriteKbs = avg;
                                }
                            }
                        }
                    } catch (Exception e) {
                        s_logger.error(String.format("Unable to execute PerfQuerySpec due to: [%s]. The window interval is enabled in vCenter?", VmwareHelper.getExceptionMessage(e)), e);
                    }
                }
                final VmStatsEntry vmStats = new VmStatsEntry(NumberUtils.toDouble(memkb) * 1024, NumberUtils.toDouble(guestMemusage) * 1024, NumberUtils.toDouble(memlimit) * 1024, maxCpuUsage, networkReadKBs, networkWriteKBs, NumberUtils.toInt(numberCPUs), "vm");
                vmStats.setDiskReadIOs(diskReadIops);
                vmStats.setDiskWriteIOs(diskWriteIops);
                vmStats.setDiskReadKBs(diskReadKbs);
                vmStats.setDiskWriteKBs(diskWriteKbs);
                vmResponseMap.put(name, vmStats);
            }
        }
    }
    return vmResponseMap;
}
Also used : PerfCounterInfo(com.vmware.vim25.PerfCounterInfo) DynamicProperty(com.vmware.vim25.DynamicProperty) HashMap(java.util.HashMap) HostMO(com.cloud.hypervisor.vmware.mo.HostMO) ArrayList(java.util.ArrayList) VmStatsEntry(com.cloud.agent.api.VmStatsEntry) PerfEntityMetricBase(com.vmware.vim25.PerfEntityMetricBase) ObjectContent(com.vmware.vim25.ObjectContent) PerfMetricIntSeries(com.vmware.vim25.PerfMetricIntSeries) PerfMetricSeries(com.vmware.vim25.PerfMetricSeries) PerfMetricId(com.vmware.vim25.PerfMetricId) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) VimPortType(com.vmware.vim25.VimPortType) Date(java.util.Date) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) PerfQuerySpec(com.vmware.vim25.PerfQuerySpec) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) PerfEntityMetric(com.vmware.vim25.PerfEntityMetric)

Example 75 with VmwareHypervisorHost

use of com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost in project cloudstack by apache.

the class VmwareResource method execute.

protected ScaleVmAnswer execute(ScaleVmCommand cmd) {
    VmwareContext context = getServiceContext();
    VirtualMachineTO vmSpec = cmd.getVirtualMachine();
    try {
        VmwareHypervisorHost hyperHost = getHyperHost(context);
        VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
        VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
        int ramMb = getReservedMemoryMb(vmSpec);
        long hotaddIncrementSizeInMb;
        long hotaddMemoryLimitInMb;
        long requestedMaxMemoryInMb = vmSpec.getMaxRam() / (1024 * 1024);
        // Check if VM is really running on hypervisor host
        if (getVmPowerState(vmMo) != PowerState.PowerOn) {
            throw new CloudRuntimeException("Found that the VM " + vmMo.getVmName() + " is not running. Unable to scale-up this VM");
        }
        // Check max hot add limit
        hotaddIncrementSizeInMb = vmMo.getHotAddMemoryIncrementSizeInMb();
        hotaddMemoryLimitInMb = vmMo.getHotAddMemoryLimitInMb();
        if (requestedMaxMemoryInMb > hotaddMemoryLimitInMb) {
            throw new CloudRuntimeException("Memory of VM " + vmMo.getVmName() + " cannot be scaled to " + requestedMaxMemoryInMb + "MB." + " Requested memory limit is beyond the hotadd memory limit for this VM at the moment is " + hotaddMemoryLimitInMb + "MB.");
        }
        // Check increment is multiple of increment size
        long reminder = hotaddIncrementSizeInMb > 0 ? requestedMaxMemoryInMb % hotaddIncrementSizeInMb : 0;
        if (reminder != 0) {
            requestedMaxMemoryInMb = requestedMaxMemoryInMb + hotaddIncrementSizeInMb - reminder;
        }
        // Check if license supports the feature
        VmwareHelper.isFeatureLicensed(hyperHost, FeatureKeyConstants.HOTPLUG);
        VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), getReservedCpuMHZ(vmSpec), (int) requestedMaxMemoryInMb, ramMb, vmSpec.getLimitCpuUse());
        if (!vmMo.configureVm(vmConfigSpec)) {
            throw new Exception("Unable to execute ScaleVmCommand");
        }
    } catch (Exception e) {
        s_logger.error(String.format("ScaleVmCommand failed due to: [%s].", VmwareHelper.getExceptionMessage(e)), e);
        return new ScaleVmAnswer(cmd, false, String.format("Unable to execute ScaleVmCommand due to: [%s].", e.toString()));
    }
    return new ScaleVmAnswer(cmd, true, null);
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) ScaleVmAnswer(com.cloud.agent.api.ScaleVmAnswer) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException)

Aggregations

VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)85 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)65 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)65 RemoteException (java.rmi.RemoteException)59 UnsupportedEncodingException (java.io.UnsupportedEncodingException)57 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)48 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)46 CloudException (com.cloud.exception.CloudException)40 InternalErrorException (com.cloud.exception.InternalErrorException)40 IOException (java.io.IOException)40 ConnectException (java.net.ConnectException)40 ConfigurationException (javax.naming.ConfigurationException)40 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)31 HostMO (com.cloud.hypervisor.vmware.mo.HostMO)27 DatacenterMO (com.cloud.hypervisor.vmware.mo.DatacenterMO)23 Pair (com.cloud.utils.Pair)15 VolumeObjectTO (org.apache.cloudstack.storage.to.VolumeObjectTO)12 Answer (com.cloud.agent.api.Answer)11 AttachIsoAnswer (com.cloud.agent.api.AttachIsoAnswer)10 BackupSnapshotAnswer (com.cloud.agent.api.BackupSnapshotAnswer)10