Search in sources :

Example 1 with VmDeviceCommonUtils

use of org.ovirt.engine.core.common.utils.VmDeviceCommonUtils in project ovirt-engine by oVirt.

the class UpdateVmCommand method logNoDeviceToHotUnplug.

private void logNoDeviceToHotUnplug(List<VmDevice> vmMemoryDevices) {
    final AuditLogType message = vmMemoryDevices.isEmpty() ? AuditLogType.NO_MEMORY_DEVICE_TO_HOT_UNPLUG : AuditLogType.NO_SUITABLE_MEMORY_DEVICE_TO_HOT_UNPLUG;
    if (!vmMemoryDevices.isEmpty()) {
        final int originalMemoryMb = oldVm.getMemSizeMb();
        addCustomValue(AUDIT_LOG_OLD_MEMORY_MB, String.valueOf(originalMemoryMb));
        addCustomValue(AUDIT_LOG_NEW_MEMORY_MB, String.valueOf(getParameters().getVm().getMemSizeMb()));
        final String unplugOptions = vmMemoryDevices.stream().filter(VmDeviceCommonUtils::isMemoryDeviceHotUnpluggable).map(device -> VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(device).get()).map(deviceSize -> String.format("%dMB (%dMB)", deviceSize, memoryAfterHotUnplug(originalMemoryMb, deviceSize))).collect(Collectors.joining(", "));
        addCustomValue(AUDIT_LOG_MEMORY_HOT_UNPLUG_OPTIONS, unplugOptions);
    }
    auditLogDirector.log(this, message);
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) EngineException(org.ovirt.engine.core.common.errors.EngineException) Provider(org.ovirt.engine.core.common.businessentities.Provider) RngDeviceParameters(org.ovirt.engine.core.common.action.RngDeviceParameters) VmTemplateDao(org.ovirt.engine.core.dao.VmTemplateDao) VmNicDao(org.ovirt.engine.core.dao.network.VmNicDao) Base64(org.apache.commons.codec.binary.Base64) VmStaticDao(org.ovirt.engine.core.dao.VmStaticDao) CommandContext(org.ovirt.engine.core.bll.context.CommandContext) ActionType(org.ovirt.engine.core.common.action.ActionType) VmDeviceCommonUtils(org.ovirt.engine.core.common.utils.VmDeviceCommonUtils) Map(java.util.Map) VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) VmWatchdogValidator(org.ovirt.engine.core.bll.validator.VmWatchdogValidator) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) HotSetNumberOfCpusParameters(org.ovirt.engine.core.common.action.HotSetNumberOfCpusParameters) VmPayload(org.ovirt.engine.core.common.businessentities.VmPayload) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) NetworkDao(org.ovirt.engine.core.dao.network.NetworkDao) StandardCharsets(java.nio.charset.StandardCharsets) Label(org.ovirt.engine.core.common.businessentities.Label) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) LabelDao(org.ovirt.engine.core.dao.LabelDao) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) QuotaConsumptionParameter(org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter) QuotaSanityParameter(org.ovirt.engine.core.bll.quota.QuotaSanityParameter) QueryType(org.ovirt.engine.core.common.queries.QueryType) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) ResourceManager(org.ovirt.engine.core.vdsbroker.ResourceManager) Guid(org.ovirt.engine.core.compat.Guid) ReplacementUtils(org.ovirt.engine.core.utils.ReplacementUtils) ArrayList(java.util.ArrayList) VmNumaNodeOperationParameters(org.ovirt.engine.core.common.action.VmNumaNodeOperationParameters) VmDeviceGeneralType(org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType) VmPropertiesUtils(org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils) UpdateVm(org.ovirt.engine.core.common.validation.group.UpdateVm) CpuPinningValidator.isCpuPinningValid(org.ovirt.engine.core.bll.validator.CpuPinningValidator.isCpuPinningValid) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Pair(org.ovirt.engine.core.common.utils.Pair) LockingGroup(org.ovirt.engine.core.common.locks.LockingGroup) Scope(org.ovirt.engine.core.common.action.LockProperties.Scope) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) EngineError(org.ovirt.engine.core.common.errors.EngineError) VmCommonUtils(org.ovirt.engine.core.common.utils.VmCommonUtils) VM(org.ovirt.engine.core.common.businessentities.VM) InClusterUpgradeValidator(org.ovirt.engine.core.bll.validator.InClusterUpgradeValidator) VDSCommandType(org.ovirt.engine.core.common.vdscommands.VDSCommandType) MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport) IconValidator(org.ovirt.engine.core.bll.validator.IconValidator) HotUnplugMemoryWithoutVmUpdateParameters(org.ovirt.engine.core.common.action.HotUnplugMemoryWithoutVmUpdateParameters) UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) WatchdogParameters(org.ovirt.engine.core.common.action.WatchdogParameters) VmType(org.ovirt.engine.core.common.businessentities.VmType) Date(java.util.Date) VmDynamicDao(org.ovirt.engine.core.dao.VmDynamicDao) ProviderDao(org.ovirt.engine.core.dao.provider.ProviderDao) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VmCpuCountHelper(org.ovirt.engine.core.common.utils.VmCpuCountHelper) HugePageUtils(org.ovirt.engine.core.common.utils.HugePageUtils) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VmDeviceDao(org.ovirt.engine.core.dao.VmDeviceDao) QuotaClusterConsumptionParameter(org.ovirt.engine.core.bll.quota.QuotaClusterConsumptionParameter) Version(org.ovirt.engine.core.compat.Version) VmDevicesMonitoring(org.ovirt.engine.core.vdsbroker.monitoring.VmDevicesMonitoring) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) IconUtils(org.ovirt.engine.core.bll.utils.IconUtils) DiskVmElementDao(org.ovirt.engine.core.dao.DiskVmElementDao) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) VmValidator(org.ovirt.engine.core.bll.validator.VmValidator) AuditLogType(org.ovirt.engine.core.common.AuditLogType) FeatureSupported(org.ovirt.engine.core.common.FeatureSupported) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) VmDeviceType(org.ovirt.engine.core.common.utils.VmDeviceType) QuotaVdsDependent(org.ovirt.engine.core.bll.quota.QuotaVdsDependent) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) LockProperties(org.ovirt.engine.core.common.action.LockProperties) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) UpdateVmVersionParameters(org.ovirt.engine.core.common.action.UpdateVmVersionParameters) Inject(javax.inject.Inject) MemoryUtils(org.ovirt.engine.core.bll.memory.MemoryUtils) NetworkHelper(org.ovirt.engine.core.bll.network.cluster.NetworkHelper) CollectionUtils(org.apache.commons.collections.CollectionUtils) Network(org.ovirt.engine.core.common.businessentities.network.Network) Config(org.ovirt.engine.core.common.config.Config) VmInitToOpenStackMetadataAdapter(org.ovirt.engine.core.common.utils.VmInitToOpenStackMetadataAdapter) AuditLogDirector(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector) HotSetAmountOfMemoryParameters(org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters) LeaseVDSParameters(org.ovirt.engine.core.common.vdscommands.LeaseVDSParameters) DateTime(org.ovirt.engine.core.compat.DateTime) GraphicsParameters(org.ovirt.engine.core.common.action.GraphicsParameters) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) VmNumaNodeDao(org.ovirt.engine.core.dao.VmNumaNodeDao) PlugAction(org.ovirt.engine.core.common.action.PlugAction) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) Collections(java.util.Collections) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) AuditLogType(org.ovirt.engine.core.common.AuditLogType)

Aggregations

StandardCharsets (java.nio.charset.StandardCharsets)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Base64 (org.apache.commons.codec.binary.Base64)1 CollectionUtils (org.apache.commons.collections.CollectionUtils)1 StringUtils (org.apache.commons.lang.StringUtils)1 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)1 MemoryUtils (org.ovirt.engine.core.bll.memory.MemoryUtils)1 NetworkHelper (org.ovirt.engine.core.bll.network.cluster.NetworkHelper)1 QuotaClusterConsumptionParameter (org.ovirt.engine.core.bll.quota.QuotaClusterConsumptionParameter)1 QuotaConsumptionParameter (org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter)1 QuotaSanityParameter (org.ovirt.engine.core.bll.quota.QuotaSanityParameter)1 QuotaVdsDependent (org.ovirt.engine.core.bll.quota.QuotaVdsDependent)1