Search in sources :

Example 46 with VirtualMachineMO

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

the class VmwareResource method execute.

private ReplugNicAnswer execute(ReplugNicCommand cmd) {
    getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
    VmwareContext context = getServiceContext();
    try {
        VmwareHypervisorHost hyperHost = getHyperHost(context);
        String vmName = cmd.getVmName();
        VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
        if (vmMo == null) {
            if (hyperHost instanceof HostMO) {
                ClusterMO clusterMo = new ClusterMO(hyperHost.getContext(), ((HostMO) hyperHost).getParentMor());
                vmMo = clusterMo.findVmOnHyperHost(vmName);
            }
        }
        if (vmMo == null) {
            String msg = "Router " + vmName + " no longer exists to execute ReplugNic command";
            s_logger.error(msg);
            throw new Exception(msg);
        }
        /*
            if(!isVMWareToolsInstalled(vmMo)){
                String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
                s_logger.debug(errMsg);
                return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
            }
             */
        // Fallback to E1000 if no specific nicAdapter is passed
        VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
        Map<String, String> details = cmd.getDetails();
        if (details != null) {
            nicDeviceType = VirtualEthernetCardType.valueOf((String) details.get("nicAdapter"));
        }
        NicTO nicTo = cmd.getNic();
        VirtualDevice nic = findVirtualNicDevice(vmMo, nicTo.getMac());
        if (nic == null) {
            return new ReplugNicAnswer(cmd, false, "Nic to replug not found");
        }
        Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, false, cmd.getVMType());
        String dvSwitchUuid = null;
        if (VmwareHelper.isDvPortGroup(networkInfo.first())) {
            ManagedObjectReference dcMor = hyperHost.getHyperHostDatacenter();
            DatacenterMO dataCenterMo = new DatacenterMO(context, dcMor);
            ManagedObjectReference dvsMor = dataCenterMo.getDvSwitchMor(networkInfo.first());
            dvSwitchUuid = dataCenterMo.getDvSwitchUuid(dvsMor);
            s_logger.info("Preparing NIC device on dvSwitch : " + dvSwitchUuid);
            VmwareHelper.updateDvNicDevice(nic, networkInfo.first(), dvSwitchUuid);
        } else {
            s_logger.info("Preparing NIC device on network " + networkInfo.second());
            VmwareHelper.updateNicDevice(nic, networkInfo.first(), networkInfo.second());
        }
        configureNicDevice(vmMo, nic, VirtualDeviceConfigSpecOperation.EDIT, "ReplugNicCommand");
        return new ReplugNicAnswer(cmd, true, "success");
    } catch (Exception e) {
        s_logger.error("Unexpected exception: ", e);
        return new ReplugNicAnswer(cmd, false, "Unable to execute ReplugNicCommand due to " + e.toString());
    }
}
Also used : HostMO(com.cloud.hypervisor.vmware.mo.HostMO) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) VirtualDevice(com.vmware.vim25.VirtualDevice) ReplugNicAnswer(com.cloud.agent.api.ReplugNicAnswer) VirtualEthernetCardType(com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType) 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) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) NicTO(com.cloud.agent.api.to.NicTO) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) DatacenterMO(com.cloud.hypervisor.vmware.mo.DatacenterMO)

Example 47 with VirtualMachineMO

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

the class VmwareResource method mapSpecDisksToClonedDisksAndTearDownDatadisks.

/**
 * Modify the specDisks information to match the cloned VM's disks (from vmMo VM)
 */
private void mapSpecDisksToClonedDisksAndTearDownDatadisks(VirtualMachineMO vmMo, String vmInternalCSName, DiskTO[] specDisks) {
    try {
        s_logger.debug("Mapping spec disks information to cloned VM disks for VM " + vmInternalCSName);
        if (vmMo != null && ArrayUtils.isNotEmpty(specDisks)) {
            List<VirtualDisk> vmDisks = vmMo.getVirtualDisksOrderedByKey();
            List<VirtualDisk> rootDisks = new ArrayList<>();
            List<DiskTO> sortedRootDisksFromSpec = Arrays.asList(sortVolumesByDeviceId(specDisks)).stream().filter(x -> x.getType() == Volume.Type.ROOT).collect(Collectors.toList());
            for (int i = 0; i < sortedRootDisksFromSpec.size(); i++) {
                DiskTO specDisk = sortedRootDisksFromSpec.get(i);
                VirtualDisk vmDisk = vmDisks.get(i);
                DataTO dataVolume = specDisk.getData();
                if (dataVolume instanceof VolumeObjectTO) {
                    VolumeObjectTO volumeObjectTO = (VolumeObjectTO) dataVolume;
                    if (!volumeObjectTO.getSize().equals(vmDisk.getCapacityInBytes())) {
                        s_logger.info("Mapped disk size is not the same as the cloned VM disk size: " + volumeObjectTO.getSize() + " - " + vmDisk.getCapacityInBytes());
                    }
                    VirtualDeviceBackingInfo backingInfo = vmDisk.getBacking();
                    if (backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
                        VirtualDiskFlatVer2BackingInfo backing = (VirtualDiskFlatVer2BackingInfo) backingInfo;
                        String fileName = backing.getFileName();
                        if (StringUtils.isNotBlank(fileName)) {
                            String[] fileNameParts = fileName.split(" ");
                            String datastoreUuid = fileNameParts[0].replace("[", "").replace("]", "");
                            String relativePath = fileNameParts[1].split("/")[1].replace(".vmdk", "");
                            String vmSpecDatastoreUuid = volumeObjectTO.getDataStore().getUuid().replaceAll("-", "");
                            if (!datastoreUuid.equals(vmSpecDatastoreUuid)) {
                                s_logger.info("Mapped disk datastore UUID is not the same as the cloned VM datastore UUID: " + datastoreUuid + " - " + vmSpecDatastoreUuid);
                            }
                            volumeObjectTO.setPath(relativePath);
                            specDisk.setPath(relativePath);
                            rootDisks.add(vmDisk);
                        } else {
                            s_logger.error("Empty backing filename for volume " + volumeObjectTO.getName());
                        }
                    } else {
                        s_logger.error("Could not get volume backing info for volume " + volumeObjectTO.getName());
                    }
                }
            }
            vmDisks.removeAll(rootDisks);
            if (CollectionUtils.isNotEmpty(vmDisks)) {
                s_logger.info("Tearing down datadisks for deploy-as-is VM");
                tearDownVMDisks(vmMo, vmDisks);
            }
        }
    } catch (Exception e) {
        String msg = "Error mapping deploy-as-is VM disks from cloned VM " + vmInternalCSName;
        s_logger.error(msg, e);
        throw new CloudRuntimeException(e);
    }
}
Also used : VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) IAgentControl(com.cloud.agent.IAgentControl) SetupPersistentNetworkAnswer(com.cloud.agent.api.SetupPersistentNetworkAnswer) VirtualMachineRelocateSpecDiskLocator(com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator) VirtualEthernetCardOpaqueNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardOpaqueNetworkBackingInfo) VMwareDVSPortSetting(com.vmware.vim25.VMwareDVSPortSetting) StringUtils(org.apache.commons.lang3.StringUtils) ModifyTargetsAnswer(com.cloud.agent.api.ModifyTargetsAnswer) VmConfigInfo(com.vmware.vim25.VmConfigInfo) PvlanSetupCommand(com.cloud.agent.api.PvlanSetupCommand) Map(java.util.Map) VAppProductInfo(com.vmware.vim25.VAppProductInfo) ResizeVolumeCommand(com.cloud.agent.api.storage.ResizeVolumeCommand) TrafficType(com.cloud.network.Networks.TrafficType) VimPortType(com.vmware.vim25.VimPortType) VirtualMachineVideoCard(com.vmware.vim25.VirtualMachineVideoCard) VmwareContextPool(com.cloud.hypervisor.vmware.util.VmwareContextPool) VirtualDevice(com.vmware.vim25.VirtualDevice) VmwareHypervisorHostNetworkSummary(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary) MigrateVmToPoolAnswer(com.cloud.agent.api.MigrateVmToPoolAnswer) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) ObjectContent(com.vmware.vim25.ObjectContent) ModifyTargetsCommand(com.cloud.agent.api.ModifyTargetsCommand) ClusterMO(com.cloud.hypervisor.vmware.mo.ClusterMO) SetupGuestNetworkCommand(com.cloud.agent.api.SetupGuestNetworkCommand) DasVmPriority(com.vmware.vim25.DasVmPriority) NasDatastoreInfo(com.vmware.vim25.NasDatastoreInfo) VmwareDistributedVirtualSwitchPvlanSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchPvlanSpec) GetVncPortAnswer(com.cloud.agent.api.GetVncPortAnswer) PingTestCommand(com.cloud.agent.api.PingTestCommand) DVPortConfigSpec(com.vmware.vim25.DVPortConfigSpec) ArrayUpdateOperation(com.vmware.vim25.ArrayUpdateOperation) VmwareStorageProcessor(com.cloud.storage.resource.VmwareStorageProcessor) CustomFieldStringValue(com.vmware.vim25.CustomFieldStringValue) HostInternetScsiHba(com.vmware.vim25.HostInternetScsiHba) CopyCommand(org.apache.cloudstack.storage.command.CopyCommand) UnPlugNicCommand(com.cloud.agent.api.UnPlugNicCommand) UnregisterNicCommand(com.cloud.agent.api.UnregisterNicCommand) ManageSnapshotAnswer(com.cloud.agent.api.ManageSnapshotAnswer) DistributedVirtualSwitchPortConnection(com.vmware.vim25.DistributedVirtualSwitchPortConnection) CreatePrivateTemplateAnswer(com.cloud.agent.api.storage.CreatePrivateTemplateAnswer) GetVmVncTicketAnswer(com.cloud.agent.api.GetVmVncTicketAnswer) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) DatastoreFile(com.cloud.hypervisor.vmware.mo.DatastoreFile) MigrateVolumeAnswer(com.cloud.agent.api.storage.MigrateVolumeAnswer) ReplugNicCommand(com.cloud.agent.api.ReplugNicCommand) VmwareStorageSubsystemCommandHandler(com.cloud.storage.resource.VmwareStorageSubsystemCommandHandler) Duration(org.joda.time.Duration) MigrateVmToPoolCommand(com.cloud.agent.api.MigrateVmToPoolCommand) OptionValue(com.vmware.vim25.OptionValue) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) GetVolumeStatsAnswer(com.cloud.agent.api.GetVolumeStatsAnswer) GetStorageStatsCommand(com.cloud.agent.api.GetStorageStatsCommand) FeatureKeyConstants(com.cloud.hypervisor.vmware.mo.FeatureKeyConstants) UnmanagedInstanceTO(org.apache.cloudstack.vm.UnmanagedInstanceTO) GetVolumeStatsCommand(com.cloud.agent.api.GetVolumeStatsCommand) SetupAnswer(com.cloud.agent.api.SetupAnswer) VAppOvfSectionInfo(com.vmware.vim25.VAppOvfSectionInfo) ConnectException(java.net.ConnectException) GetVmNetworkStatsCommand(com.cloud.agent.api.GetVmNetworkStatsCommand) SetSourceNatCommand(com.cloud.agent.api.routing.SetSourceNatCommand) StoragePodSummary(com.vmware.vim25.StoragePodSummary) NicTO(com.cloud.agent.api.to.NicTO) Vlan(com.cloud.dc.Vlan) GuestInfo(com.vmware.vim25.GuestInfo) GetVmVncTicketCommand(com.cloud.agent.api.GetVmVncTicketCommand) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) GetVncPortCommand(com.cloud.agent.api.GetVncPortCommand) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) IOException(java.io.IOException) CreateStoragePoolCommand(com.cloud.agent.api.CreateStoragePoolCommand) DB(com.cloud.utils.db.DB) NetworkMO(com.cloud.hypervisor.vmware.mo.NetworkMO) StoragepodMO(com.cloud.hypervisor.vmware.mo.StoragepodMO) GetVmStatsAnswer(com.cloud.agent.api.GetVmStatsAnswer) VmwareHelper(com.cloud.hypervisor.vmware.util.VmwareHelper) Command(com.cloud.agent.api.Command) NetworkUsageCommand(com.cloud.agent.api.NetworkUsageCommand) ReadyCommand(com.cloud.agent.api.ReadyCommand) UnregisterVMCommand(com.cloud.agent.api.UnregisterVMCommand) MigrateVolumeCommand(com.cloud.agent.api.storage.MigrateVolumeCommand) StorageSubsystemCommandHandler(com.cloud.storage.resource.StorageSubsystemCommandHandler) StartCommand(com.cloud.agent.api.StartCommand) HypervisorHostHelper(com.cloud.hypervisor.vmware.mo.HypervisorHostHelper) VirtualMachineBootOptions(com.vmware.vim25.VirtualMachineBootOptions) Date(java.util.Date) DatastoreMO(com.cloud.hypervisor.vmware.mo.DatastoreMO) PerfEntityMetricBase(com.vmware.vim25.PerfEntityMetricBase) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) Random(java.util.Random) CheckNetworkCommand(com.cloud.agent.api.CheckNetworkCommand) VmwareStorageProcessorConfigurableFields(com.cloud.storage.resource.VmwareStorageProcessor.VmwareStorageProcessorConfigurableFields) ResourceType(com.cloud.configuration.Resource.ResourceType) StartupCommand(com.cloud.agent.api.StartupCommand) GetVmNetworkStatsAnswer(com.cloud.agent.api.GetVmNetworkStatsAnswer) HostHostBusAdapter(com.vmware.vim25.HostHostBusAdapter) StopAnswer(com.cloud.agent.api.StopAnswer) IpAssocCommand(com.cloud.agent.api.routing.IpAssocCommand) Gson(com.google.gson.Gson) NetworkDetails(com.cloud.hypervisor.vmware.mo.NetworkDetails) VirtualDeviceFileBackingInfo(com.vmware.vim25.VirtualDeviceFileBackingInfo) NetworkUsageAnswer(com.cloud.agent.api.NetworkUsageAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) VirtualDiskFlatVer2BackingInfo(com.vmware.vim25.VirtualDiskFlatVer2BackingInfo) GuestNicInfo(com.vmware.vim25.GuestNicInfo) TimeZone(java.util.TimeZone) Collection(java.util.Collection) VirtualUSBController(com.vmware.vim25.VirtualUSBController) UUID(java.util.UUID) Pair(com.cloud.utils.Pair) Collectors(java.util.stream.Collectors) RemoteException(java.rmi.RemoteException) CheckOnHostAnswer(com.cloud.agent.api.CheckOnHostAnswer) MigrateWithStorageCommand(com.cloud.agent.api.MigrateWithStorageCommand) StoragePoolInfo(com.cloud.agent.api.StoragePoolInfo) PingCommand(com.cloud.agent.api.PingCommand) VirtualMachineFileLayoutEx(com.vmware.vim25.VirtualMachineFileLayoutEx) CheckHealthAnswer(com.cloud.agent.api.CheckHealthAnswer) StoragePoolType(com.cloud.storage.Storage.StoragePoolType) NetUtils(com.cloud.utils.net.NetUtils) RevertToVMSnapshotAnswer(com.cloud.agent.api.RevertToVMSnapshotAnswer) PingRoutingCommand(com.cloud.agent.api.PingRoutingCommand) ManageSnapshotCommand(com.cloud.agent.api.ManageSnapshotCommand) ConfigDrive(org.apache.cloudstack.storage.configdrive.ConfigDrive) DeployAsIsInfoTO(com.cloud.agent.api.to.DeployAsIsInfoTO) GetStoragePoolCapabilitiesCommand(com.cloud.agent.api.GetStoragePoolCapabilitiesCommand) VirtualMachine(com.cloud.vm.VirtualMachine) PerfCounterInfo(com.vmware.vim25.PerfCounterInfo) StorageSubSystemCommand(org.apache.cloudstack.storage.command.StorageSubSystemCommand) UpgradeSnapshotCommand(com.cloud.agent.api.UpgradeSnapshotCommand) BroadcastDomainType(com.cloud.network.Networks.BroadcastDomainType) ValidateSnapshotCommand(com.cloud.agent.api.ValidateSnapshotCommand) CreateVMSnapshotCommand(com.cloud.agent.api.CreateVMSnapshotCommand) InternalErrorException(com.cloud.exception.InternalErrorException) CopyVolumeAnswer(com.cloud.agent.api.storage.CopyVolumeAnswer) DatastoreSummary(com.vmware.vim25.DatastoreSummary) HostVmStateReportEntry(com.cloud.agent.api.HostVmStateReportEntry) PrepareUnmanageVMInstanceCommand(com.cloud.agent.api.PrepareUnmanageVMInstanceCommand) AttachIsoAnswer(com.cloud.agent.api.AttachIsoAnswer) HashSet(java.util.HashSet) MigrateCommand(com.cloud.agent.api.MigrateCommand) SshHelper(com.cloud.utils.ssh.SshHelper) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) ScaleVmCommand(com.cloud.agent.api.ScaleVmCommand) IpAssocVpcCommand(com.cloud.agent.api.routing.IpAssocVpcCommand) HostCapability(com.vmware.vim25.HostCapability) MapUtils(org.apache.commons.collections.MapUtils) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO) CustomFieldConstants(com.cloud.hypervisor.vmware.mo.CustomFieldConstants) TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) VolumeStatsEntry(com.cloud.agent.api.VolumeStatsEntry) VirtualVmxnet3(com.vmware.vim25.VirtualVmxnet3) VirtualVmxnet2(com.vmware.vim25.VirtualVmxnet2) DiskTO(com.cloud.agent.api.to.DiskTO) VirtualSCSIController(com.vmware.vim25.VirtualSCSIController) PbmProfileManagerMO(com.cloud.hypervisor.vmware.mo.PbmProfileManagerMO) NumbersUtil.toHumanReadableSize(com.cloud.utils.NumbersUtil.toHumanReadableSize) ApiConstants(org.apache.cloudstack.api.ApiConstants) HostFileSystemMountInfo(com.vmware.vim25.HostFileSystemMountInfo) VirtualDeviceConfigSpecOperation(com.vmware.vim25.VirtualDeviceConfigSpecOperation) GetHostStatsCommand(com.cloud.agent.api.GetHostStatsCommand) GsonHelper(com.cloud.serializer.GsonHelper) NiciraNvpApiVersion(com.cloud.utils.nicira.nvp.plugin.NiciraNvpApiVersion) VmwareTrafficLabel(com.cloud.network.VmwareTrafficLabel) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) Comparator(java.util.Comparator) SetupPersistentNetworkCommand(com.cloud.agent.api.SetupPersistentNetworkCommand) VmwareStorageMount(com.cloud.hypervisor.vmware.manager.VmwareStorageMount) ModifyStoragePoolCommand(com.cloud.agent.api.ModifyStoragePoolCommand) ArrayUtils(org.apache.commons.lang.ArrayUtils) DeleteStoragePoolCommand(com.cloud.agent.api.DeleteStoragePoolCommand) OVFPropertyTO(com.cloud.agent.api.to.deployasis.OVFPropertyTO) DynamicProperty(com.vmware.vim25.DynamicProperty) Arrays(java.util.Arrays) PlugNicCommand(com.cloud.agent.api.PlugNicCommand) VirtualRoutingResource(com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource) VmConfigSpec(com.vmware.vim25.VmConfigSpec) PerfQuerySpec(com.vmware.vim25.PerfQuerySpec) DatacenterMO(com.cloud.hypervisor.vmware.mo.DatacenterMO) PrimaryStorageDownloadCommand(com.cloud.agent.api.storage.PrimaryStorageDownloadCommand) VirtualSwitchType(com.cloud.hypervisor.vmware.mo.VirtualSwitchType) HostStorageSystemMO(com.cloud.hypervisor.vmware.mo.HostStorageSystemMO) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) PowerState(com.cloud.vm.VirtualMachine.PowerState) VirtualRouterDeployer(com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer) CloudException(com.cloud.exception.CloudException) CreateVMSnapshotAnswer(com.cloud.agent.api.CreateVMSnapshotAnswer) Storage(com.cloud.storage.Storage) CheckSshCommand(com.cloud.agent.api.check.CheckSshCommand) VolumeTO(com.cloud.agent.api.to.VolumeTO) PropertyMapDynamicBean(com.cloud.utils.mgmt.PropertyMapDynamicBean) NDC(org.apache.log4j.NDC) DeleteVMSnapshotAnswer(com.cloud.agent.api.DeleteVMSnapshotAnswer) GetVmStatsCommand(com.cloud.agent.api.GetVmStatsCommand) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) StopCommand(com.cloud.agent.api.StopCommand) VirtualPCNet32(com.vmware.vim25.VirtualPCNet32) EnumMap(java.util.EnumMap) DataTO(com.cloud.agent.api.to.DataTO) HostConfigInfo(com.vmware.vim25.HostConfigInfo) Set(java.util.Set) VirtualMachineFileInfo(com.vmware.vim25.VirtualMachineFileInfo) NfsSecondaryStorageResource(org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) Script(com.cloud.utils.script.Script) TaskMO(com.cloud.hypervisor.vmware.mo.TaskMO) VAppProductSpec(com.vmware.vim25.VAppProductSpec) StorageFilerTO(com.cloud.agent.api.to.StorageFilerTO) VirtualMachineDiskInfo(org.apache.cloudstack.utils.volume.VirtualMachineDiskInfo) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) RebootAnswer(com.cloud.agent.api.RebootAnswer) DVPortConfigInfo(com.vmware.vim25.DVPortConfigInfo) GetStoragePoolCapabilitiesAnswer(com.cloud.agent.api.GetStoragePoolCapabilitiesAnswer) CopyVolumeCommand(com.cloud.agent.api.storage.CopyVolumeCommand) DestroyCommand(com.cloud.agent.api.storage.DestroyCommand) NumbersUtil(com.cloud.utils.NumbersUtil) CheckOnHostCommand(com.cloud.agent.api.CheckOnHostCommand) PrimaryStorageDownloadAnswer(com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer) MaintainCommand(com.cloud.agent.api.MaintainCommand) VmwareStorageLayoutHelper(com.cloud.storage.resource.VmwareStorageLayoutHelper) ComputeResourceSummary(com.vmware.vim25.ComputeResourceSummary) NetworkElementCommand(com.cloud.agent.api.routing.NetworkElementCommand) VirtualEthernetCardType(com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType) VirtualEthernetCardDistributedVirtualPortBackingInfo(com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo) ExecutionResult(com.cloud.utils.ExecutionResult) ArrayList(java.util.ArrayList) VmStatsEntry(com.cloud.agent.api.VmStatsEntry) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) PerfMetricSeries(com.vmware.vim25.PerfMetricSeries) StartAnswer(com.cloud.agent.api.StartAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) VirtualMachineRuntimeInfo(com.vmware.vim25.VirtualMachineRuntimeInfo) VirtualMachineDiskInfoBuilder(com.cloud.hypervisor.vmware.mo.VirtualMachineDiskInfoBuilder) VmDiskStatsEntry(com.cloud.agent.api.VmDiskStatsEntry) DistributedVirtualPort(com.vmware.vim25.DistributedVirtualPort) VmwareManager(com.cloud.hypervisor.vmware.manager.VmwareManager) MigrateAnswer(com.cloud.agent.api.MigrateAnswer) HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) VirtualMachineGuestOsIdentifier(com.vmware.vim25.VirtualMachineGuestOsIdentifier) VAppOvfSectionSpec(com.vmware.vim25.VAppOvfSectionSpec) CreateVolumeFromSnapshotAnswer(com.cloud.agent.api.CreateVolumeFromSnapshotAnswer) ValidateVcenterDetailsCommand(com.cloud.agent.api.ValidateVcenterDetailsCommand) GetUnmanagedInstancesCommand(com.cloud.agent.api.GetUnmanagedInstancesCommand) CheckNetworkAnswer(com.cloud.agent.api.CheckNetworkAnswer) CreateVolumeFromSnapshotCommand(com.cloud.agent.api.CreateVolumeFromSnapshotCommand) ReplugNicAnswer(com.cloud.agent.api.ReplugNicAnswer) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) NfsTO(com.cloud.agent.api.to.NfsTO) HostStatsEntry(com.cloud.agent.api.HostStatsEntry) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) File(java.io.File) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) DeleteVMSnapshotCommand(com.cloud.agent.api.DeleteVMSnapshotCommand) VirtualMachineToolsStatus(com.vmware.vim25.VirtualMachineToolsStatus) VirtualDisk(com.vmware.vim25.VirtualDisk) JmxUtil(com.cloud.utils.mgmt.JmxUtil) ModifySshKeysCommand(com.cloud.agent.api.ModifySshKeysCommand) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) ScaleVmAnswer(com.cloud.agent.api.ScaleVmAnswer) MigrateWithStorageAnswer(com.cloud.agent.api.MigrateWithStorageAnswer) VAppPropertySpec(com.vmware.vim25.VAppPropertySpec) PrepareForMigrationCommand(com.cloud.agent.api.PrepareForMigrationCommand) VMwareGuru(com.cloud.hypervisor.guru.VMwareGuru) TemplateManager(com.cloud.template.TemplateManager) CustomFieldsManagerMO(com.cloud.hypervisor.vmware.mo.CustomFieldsManagerMO) VmwareHypervisorHostResourceSummary(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostResourceSummary) ResizeVolumeAnswer(com.cloud.agent.api.storage.ResizeVolumeAnswer) HostPortGroupSpec(com.vmware.vim25.HostPortGroupSpec) ToolsUnavailableFaultMsg(com.vmware.vim25.ToolsUnavailableFaultMsg) URL(java.net.URL) PerfMetricId(com.vmware.vim25.PerfMetricId) Networks(com.cloud.network.Networks) ServerResource(com.cloud.resource.ServerResource) NumberUtils(org.apache.commons.lang.math.NumberUtils) Logger(org.apache.log4j.Logger) SocketChannel(java.nio.channels.SocketChannel) PerfEntityMetric(com.vmware.vim25.PerfEntityMetric) DistributedVirtualSwitchMO(com.cloud.hypervisor.vmware.mo.DistributedVirtualSwitchMO) VAppPropertyInfo(com.vmware.vim25.VAppPropertyInfo) AttachIsoCommand(com.cloud.agent.api.AttachIsoCommand) TemplateProp(com.cloud.storage.template.TemplateProp) URI(java.net.URI) VmwareDistributedVirtualSwitchVlanIdSpec(com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec) RebootRouterCommand(com.cloud.agent.api.RebootRouterCommand) BackupSnapshotCommand(com.cloud.agent.api.BackupSnapshotCommand) IpAddressTO(com.cloud.agent.api.to.IpAddressTO) BackupSnapshotAnswer(com.cloud.agent.api.BackupSnapshotAnswer) VirtualMachinePowerState(com.vmware.vim25.VirtualMachinePowerState) ExceptionUtil(com.cloud.utils.exception.ExceptionUtil) InetSocketAddress(java.net.InetSocketAddress) CheckVirtualMachineCommand(com.cloud.agent.api.CheckVirtualMachineCommand) CreatePrivateTemplateFromSnapshotCommand(com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand) VirtualMachineFileLayoutExFileInfo(com.vmware.vim25.VirtualMachineFileLayoutExFileInfo) List(java.util.List) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) DatastoreInfo(com.vmware.vim25.DatastoreInfo) VirtualMachineRelocateSpec(com.vmware.vim25.VirtualMachineRelocateSpec) SetupCommand(com.cloud.agent.api.SetupCommand) DiskControllerType(com.cloud.hypervisor.vmware.mo.DiskControllerType) AboutInfo(com.vmware.vim25.AboutInfo) HostDatastoreSystemMO(com.cloud.hypervisor.vmware.mo.HostDatastoreSystemMO) UnsupportedEncodingException(java.io.UnsupportedEncodingException) GetVmIpAddressCommand(com.cloud.agent.api.GetVmIpAddressCommand) VmwareHostService(com.cloud.hypervisor.vmware.manager.VmwareHostService) RebootCommand(com.cloud.agent.api.RebootCommand) VirtualMachineName(com.cloud.vm.VirtualMachineName) HashMap(java.util.HashMap) ConfigurationException(javax.naming.ConfigurationException) GetUnmanagedInstancesAnswer(com.cloud.agent.api.GetUnmanagedInstancesAnswer) VirtualEthernetCardNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo) ValidateSnapshotAnswer(com.cloud.agent.api.ValidateSnapshotAnswer) VmDetailConstants(com.cloud.vm.VmDetailConstants) RevertToVMSnapshotCommand(com.cloud.agent.api.RevertToVMSnapshotCommand) DistributedVirtualSwitchPortCriteria(com.vmware.vim25.DistributedVirtualSwitchPortCriteria) ReadyAnswer(com.cloud.agent.api.ReadyAnswer) StoragePoolResource(com.cloud.storage.resource.StoragePoolResource) VRScripts(com.cloud.agent.resource.virtualnetwork.VRScripts) CollectionUtils(org.apache.commons.collections.CollectionUtils) PrepareUnmanageVMInstanceAnswer(com.cloud.agent.api.PrepareUnmanageVMInstanceAnswer) PrepareForMigrationAnswer(com.cloud.agent.api.PrepareForMigrationAnswer) VirtualIDEController(com.vmware.vim25.VirtualIDEController) Type(com.cloud.host.Host.Type) HostMO(com.cloud.hypervisor.vmware.mo.HostMO) GetVmDiskStatsCommand(com.cloud.agent.api.GetVmDiskStatsCommand) DateUtil(com.cloud.utils.DateUtil) GetVmDiskStatsAnswer(com.cloud.agent.api.GetVmDiskStatsAnswer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) BoolPolicy(com.vmware.vim25.BoolPolicy) SetNetworkACLCommand(com.cloud.agent.api.routing.SetNetworkACLCommand) Ternary(com.cloud.utils.Ternary) PerfMetricIntSeries(com.vmware.vim25.PerfMetricIntSeries) VirtualMachineDefinedProfileSpec(com.vmware.vim25.VirtualMachineDefinedProfileSpec) Volume(com.cloud.storage.Volume) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) CreatePrivateTemplateFromVolumeCommand(com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand) Collections(java.util.Collections) ArrayList(java.util.ArrayList) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) VirtualDisk(com.vmware.vim25.VirtualDisk) 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) DataTO(com.cloud.agent.api.to.DataTO) VirtualDiskFlatVer2BackingInfo(com.vmware.vim25.VirtualDiskFlatVer2BackingInfo) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) DiskTO(com.cloud.agent.api.to.DiskTO)

Example 48 with VirtualMachineMO

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

the class VmwareResource method execute.

private Answer execute(PrepareUnmanageVMInstanceCommand cmd) {
    VmwareContext context = getServiceContext();
    VmwareHypervisorHost hyperHost = getHyperHost(context);
    String instanceName = cmd.getInstanceName();
    try {
        s_logger.debug(String.format("Verify if VMware instance: [%s] is available before unmanaging VM.", cmd.getInstanceName()));
        ManagedObjectReference dcMor = hyperHost.getHyperHostDatacenter();
        DatacenterMO dataCenterMo = new DatacenterMO(getServiceContext(), dcMor);
        VirtualMachineMO vm = dataCenterMo.findVm(instanceName);
        if (vm == null) {
            return new PrepareUnmanageVMInstanceAnswer(cmd, false, String.format("Cannot find VM with name [%s] in datacenter [%s].", instanceName, dataCenterMo.getName()));
        }
    } catch (Exception e) {
        s_logger.error("Error trying to verify if VM to unmanage exists", e);
        return new PrepareUnmanageVMInstanceAnswer(cmd, false, "Error: " + e.getMessage());
    }
    return new PrepareUnmanageVMInstanceAnswer(cmd, true, "OK");
}
Also used : PrepareUnmanageVMInstanceAnswer(com.cloud.agent.api.PrepareUnmanageVMInstanceAnswer) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) 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) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) DatacenterMO(com.cloud.hypervisor.vmware.mo.DatacenterMO)

Example 49 with VirtualMachineMO

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

the class VmwareResource method execute.

protected Answer execute(UnregisterVMCommand cmd) {
    VmwareContext context = getServiceContext();
    VmwareHypervisorHost hyperHost = getHyperHost(context);
    try {
        DatacenterMO dataCenterMo = new DatacenterMO(getServiceContext(), hyperHost.getHyperHostDatacenter());
        VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
        if (vmMo != null) {
            try {
                VirtualMachineFileLayoutEx vmFileLayout = vmMo.getFileLayout();
                context.getService().unregisterVM(vmMo.getMor());
                if (cmd.getCleanupVmFiles()) {
                    deleteUnregisteredVmFiles(vmFileLayout, dataCenterMo, false, null);
                }
                return new Answer(cmd, true, "unregister succeeded");
            } catch (Exception e) {
                s_logger.warn("We are not able to unregister VM " + VmwareHelper.getExceptionMessage(e));
            }
            String msg = "Expunge failed in vSphere. vm: " + cmd.getVmName();
            s_logger.warn(msg);
            return new Answer(cmd, false, msg);
        } else {
            String msg = "Unable to find the VM in vSphere to unregister, assume it is already removed. VM: " + cmd.getVmName();
            s_logger.warn(msg);
            return new Answer(cmd, true, msg);
        }
    } catch (Exception e) {
        return new Answer(cmd, false, createLogMessageException(e, cmd));
    }
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) 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) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) VirtualMachineFileLayoutEx(com.vmware.vim25.VirtualMachineFileLayoutEx) 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) DatacenterMO(com.cloud.hypervisor.vmware.mo.DatacenterMO)

Example 50 with VirtualMachineMO

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

the class VmwareStorageManagerImpl method execute.

@Override
public RevertToVMSnapshotAnswer execute(VmwareHostService hostService, RevertToVMSnapshotCommand cmd) {
    String snapshotName = cmd.getTarget().getSnapshotName();
    String vmName = cmd.getVmName();
    Boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory;
    List<VolumeObjectTO> listVolumeTo = cmd.getVolumeTOs();
    VirtualMachine.PowerState vmState = VirtualMachine.PowerState.PowerOn;
    VirtualMachineMO vmMo = null;
    VmwareContext context = hostService.getServiceContext(cmd);
    try {
        VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);
        // wait if there are already VM revert task running
        ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
        List<ManagedObjectReference> tasks = context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
        for (ManagedObjectReference taskMor : tasks) {
            TaskInfo info = (TaskInfo) (context.getVimClient().getDynamicProperty(taskMor, "info"));
            if (info.getEntityName().equals(cmd.getVmName()) && org.apache.commons.lang3.StringUtils.isNotBlank(info.getName()) && info.getName().equalsIgnoreCase("RevertToSnapshot_Task")) {
                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) {
                Map<String, String> mapNewDisk = getNewDiskMap(vmMo);
                setVolumeToPathAndSize(listVolumeTo, mapNewDisk, context, hyperHost, cmd.getVmName());
                if (!snapshotMemory) {
                    vmState = VirtualMachine.PowerState.PowerOff;
                }
                return new RevertToVMSnapshotAnswer(cmd, listVolumeTo, vmState);
            } else {
                return new RevertToVMSnapshotAnswer(cmd, false, "Error while reverting to snapshot due to execute in ESXi");
            }
        }
    } catch (Exception e) {
        String msg = "revert vm " + vmName + " to snapshot " + snapshotName + " failed due to " + e.getMessage();
        s_logger.error(msg);
        return new RevertToVMSnapshotAnswer(cmd, false, msg);
    }
}
Also used : RevertToVMSnapshotAnswer(com.cloud.agent.api.RevertToVMSnapshotAnswer) HostMO(com.cloud.hypervisor.vmware.mo.HostMO) VirtualMachineMO(com.cloud.hypervisor.vmware.mo.VirtualMachineMO) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) TaskInfo(com.vmware.vim25.TaskInfo) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) VirtualMachine(com.cloud.vm.VirtualMachine) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)78 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)68 RemoteException (java.rmi.RemoteException)52 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)47 UnsupportedEncodingException (java.io.UnsupportedEncodingException)46 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)40 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)38 DatacenterMO (com.cloud.hypervisor.vmware.mo.DatacenterMO)28 CloudException (com.cloud.exception.CloudException)26 InternalErrorException (com.cloud.exception.InternalErrorException)26 IOException (java.io.IOException)26 ConnectException (java.net.ConnectException)26 ConfigurationException (javax.naming.ConfigurationException)26 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)24 VirtualDisk (com.vmware.vim25.VirtualDisk)20 DatastoreFile (com.cloud.hypervisor.vmware.mo.DatastoreFile)17 Script (com.cloud.utils.script.Script)17 HostMO (com.cloud.hypervisor.vmware.mo.HostMO)16 File (java.io.File)14 Pair (com.cloud.utils.Pair)13