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);
}
Aggregations