From 38ca11f99ac1ec804694f2383607bcaf4c467ccd Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 17 Apr 2024 16:40:31 +0200 Subject: [PATCH] build: fix build failure after merge-forward --- .../kvm/resource/LibvirtDomainListener.java | 5 +++-- .../LibvirtCheckAndRepairVolumeCommandWrapper.java | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainListener.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainListener.java index 281de01c5da5..5adb383c6cd6 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainListener.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainListener.java @@ -15,7 +15,8 @@ package com.cloud.hypervisor.kvm.resource; import com.cloud.resource.AgentStatusUpdater; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.libvirt.Domain; import org.libvirt.LibvirtException; import org.libvirt.event.DomainEvent; @@ -24,7 +25,7 @@ import org.libvirt.event.StoppedDetail; public class LibvirtDomainListener implements LifecycleListener { - private static final Logger LOGGER = Logger.getLogger(LibvirtDomainListener.class); + private static final Logger LOGGER = LogManager.getLogger(LibvirtDomainListener.class); private final AgentStatusUpdater agentStatusUpdater; diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckAndRepairVolumeCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckAndRepairVolumeCommandWrapper.java index cd81a2fbc232..8dcdd09beb2a 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckAndRepairVolumeCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckAndRepairVolumeCommandWrapper.java @@ -42,7 +42,6 @@ import org.apache.cloudstack.utils.qemu.QemuObject.EncryptFormat; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; import org.libvirt.LibvirtException; import java.io.IOException; @@ -53,8 +52,6 @@ @ResourceWrapper(handles = CheckAndRepairVolumeCommand.class) public class LibvirtCheckAndRepairVolumeCommandWrapper extends CommandWrapper { - private static final Logger s_logger = Logger.getLogger(LibvirtCheckAndRepairVolumeCommandWrapper.class); - @Override public Answer execute(CheckAndRepairVolumeCommand command, LibvirtComputingResource serverResource) { final String volumeId = command.getPath(); @@ -105,7 +102,7 @@ private CheckAndRepairVolumeAnswer checkVolume(KVMPhysicalDisk vol, CheckAndRepa EncryptFormat encryptFormat = EncryptFormat.enumValue(command.getEncryptFormat()); byte[] passphrase = command.getPassphrase(); String checkVolumeResult = checkAndRepairVolume(vol, null, encryptFormat, passphrase, serverResource); - s_logger.info(String.format("Check Volume result for the volume %s is %s", vol.getName(), checkVolumeResult)); + logger.info(String.format("Check Volume result for the volume %s is %s", vol.getName(), checkVolumeResult)); CheckAndRepairVolumeAnswer answer = new CheckAndRepairVolumeAnswer(command, true, checkVolumeResult); answer.setVolumeCheckExecutionResult(checkVolumeResult); @@ -119,7 +116,7 @@ private CheckAndRepairVolumeAnswer repairVolume(KVMPhysicalDisk vol, CheckAndRep String repairVolumeResult = checkAndRepairVolume(vol, repair, encryptFormat, passphrase, serverResource); String finalResult = (checkVolumeResult != null ? checkVolumeResult.concat(",") : "") + repairVolumeResult; - s_logger.info(String.format("Repair Volume result for the volume %s is %s", vol.getName(), repairVolumeResult)); + logger.info(String.format("Repair Volume result for the volume %s is %s", vol.getName(), repairVolumeResult)); CheckAndRepairVolumeAnswer answer = new CheckAndRepairVolumeAnswer(command, true, finalResult); answer.setVolumeRepairExecutionResult(repairVolumeResult); @@ -138,7 +135,7 @@ private CheckAndRepairVolumeAnswer checkIfRepairLeaksIsRequired(CheckAndRepairVo jsonNode = objectMapper.readTree(checkVolumeResult); } catch (JsonProcessingException e) { String msg = String.format("Error processing response %s during check volume %s", checkVolumeResult, e.getMessage()); - s_logger.info(msg); + logger.info(msg); return skipRepairVolumeCommand(command, checkVolumeResult, msg); } @@ -157,7 +154,7 @@ private CheckAndRepairVolumeAnswer checkIfRepairLeaksIsRequired(CheckAndRepairVo } private CheckAndRepairVolumeAnswer skipRepairVolumeCommand(CheckAndRepairVolumeCommand command, String checkVolumeResult, String msg) { - s_logger.info(msg); + logger.info(msg); String jsonStringFormat = String.format("{ \"message\": \"%s\" }", msg); String finalResult = (checkVolumeResult != null ? checkVolumeResult.concat(",") : "") + jsonStringFormat; CheckAndRepairVolumeAnswer answer = new CheckAndRepairVolumeAnswer(command, true, finalResult);