fix build error after merge-forward

This commit is contained in:
Wei Zhou 2024-02-13 10:40:15 +01:00
parent 93406f5582
commit 90526419a3
3 changed files with 17 additions and 18 deletions

View File

@ -789,7 +789,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
Double imbalance = ClusterDrsAlgorithm.getClusterImbalance(clusterId, cpuList, memoryList, null);
metricsResponse.setDrsImbalance(imbalance.isNaN() ? null : 100.0 * imbalance);
} catch (ConfigurationException e) {
LOGGER.warn("Failed to get cluster imbalance for cluster " + clusterId, e);
logger.warn("Failed to get cluster imbalance for cluster " + clusterId, e);
}
metricsResponse.setState(clusterResponse.getAllocationState(), clusterResponse.getManagedState());

View File

@ -34,11 +34,12 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import org.apache.cloudstack.utils.qemu.QemuImg;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.Duration;
public class LinstorStoragePool implements KVMStoragePool {
private static final Logger s_logger = Logger.getLogger(LinstorStoragePool.class);
private static final Logger LOGGER = LogManager.getLogger(LinstorStoragePool.class);
private final String _uuid;
private final String _sourceHost;
private final int _sourcePort;
@ -226,12 +227,12 @@ public class LinstorStoragePool implements KVMStoragePool {
@Override
public String createHeartBeatCommand(HAStoragePool pool, String hostPrivateIp,
boolean hostValidation) {
s_logger.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation));
LOGGER.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation));
boolean isStorageNodeUp = checkingHeartBeat(pool, null);
if (!isStorageNodeUp && !hostValidation) {
//restart the host
s_logger.debug(String.format("The host [%s] will be restarted because the health check failed for the storage pool [%s]", hostPrivateIp, pool.getPool().getType()));
Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), s_logger);
LOGGER.debug(String.format("The host [%s] will be restarted because the health check failed for the storage pool [%s]", hostPrivateIp, pool.getPool().getType()));
Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), LOGGER);
cmd.add("-c");
cmd.execute();
return "Down";
@ -247,7 +248,7 @@ public class LinstorStoragePool implements KVMStoragePool {
static String getHostname() {
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
Script sc = new Script("hostname", Duration.millis(10000L), s_logger);
Script sc = new Script("hostname", Duration.millis(10000L), LOGGER);
String res = sc.execute(parser);
if (res != null) {
throw new CloudRuntimeException(String.format("Unable to run 'hostname' command: %s", res));
@ -264,7 +265,7 @@ public class LinstorStoragePool implements KVMStoragePool {
} else {
hostName = host.getParent();
if (hostName == null) {
s_logger.error("No hostname set in host.getParent()");
LOGGER.error("No hostname set in host.getParent()");
return false;
}
}
@ -273,7 +274,7 @@ public class LinstorStoragePool implements KVMStoragePool {
}
private String executeDrbdSetupStatus(OutputInterpreter.AllLinesParser parser) {
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger);
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER);
sc.add("status");
sc.add("--json");
return sc.execute(parser);
@ -293,12 +294,12 @@ public class LinstorStoragePool implements KVMStoragePool {
}
}
}
s_logger.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName));
LOGGER.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName));
return false;
}
private String executeDrbdEventsNow(OutputInterpreter.AllLinesParser parser) {
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger);
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER);
sc.add("events2");
sc.add("--now");
return sc.execute(parser);
@ -307,13 +308,13 @@ public class LinstorStoragePool implements KVMStoragePool {
private boolean checkDrbdEventsNowOutput(String output) {
boolean healthy = output.lines().noneMatch(line -> line.matches(".*role:Primary .* promotion_score:0.*"));
if (!healthy) {
s_logger.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false");
LOGGER.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false");
}
return healthy;
}
private boolean checkHostUpToDateAndConnected(String hostName) {
s_logger.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName));
LOGGER.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName));
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
if (localNodeName.equalsIgnoreCase(hostName)) {
@ -331,7 +332,7 @@ public class LinstorStoragePool implements KVMStoragePool {
try {
return checkDrbdSetupStatusOutput(parser.getLines(), hostName);
} catch (JsonIOException | JsonSyntaxException e) {
s_logger.error("Error parsing drbdsetup status --json", e);
LOGGER.error("Error parsing drbdsetup status --json", e);
}
}
return false;
@ -339,7 +340,7 @@ public class LinstorStoragePool implements KVMStoragePool {
@Override
public Boolean vmActivityCheck(HAStoragePool pool, HostTO host, Duration activityScriptTimeout, String volumeUUIDListString, String vmActivityCheckPath, long duration) {
s_logger.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp()));
LOGGER.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp()));
return checkingHeartBeat(pool, host);
}
}

View File

@ -305,9 +305,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
List<IPAddressVO> vpcIps = _ipAddressDao.listByAssociatedVpc(router.getVpcId(), true);
if (CollectionUtils.isNotEmpty(vpcIps)) {
buf.append(String.format(" source_nat_ip=%s", vpcIps.get(0).getAddress().toString()));
if (s_logger.isDebugEnabled()) {
s_logger.debug("The final Boot Args for " + profile + ": " + buf);
}
logger.debug("The final Boot Args for " + profile + ": " + buf);
}
}
}