Skip to content

Commit

Permalink
fix build error after merge-forward
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Feb 13, 2024
1 parent 93406f5 commit 9052641
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public List<ClusterMetricsResponse> listClusterMetrics(Pair<List<ClusterResponse
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
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;
Expand Down Expand Up @@ -226,12 +227,12 @@ public String getHearthBeatPath() {
@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";
Expand All @@ -247,7 +248,7 @@ public String getStorageNodeId() {

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));
Expand All @@ -264,7 +265,7 @@ public Boolean checkingHeartBeat(HAStoragePool pool, HostTO host) {
} 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;
}
}
Expand All @@ -273,7 +274,7 @@ public Boolean checkingHeartBeat(HAStoragePool pool, HostTO host) {
}

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);
Expand All @@ -293,12 +294,12 @@ private boolean checkDrbdSetupStatusOutput(String output, String otherNodeName)
}
}
}
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);
Expand All @@ -307,13 +308,13 @@ private String executeDrbdEventsNow(OutputInterpreter.AllLinesParser parser) {
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)) {
Expand All @@ -331,15 +332,15 @@ private boolean checkHostUpToDateAndConnected(String hostName) {
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;
}

@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ private void appendSourceNatIpToBootArgs(final VirtualMachineProfile profile) {
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);
}
}
}
Expand Down

0 comments on commit 9052641

Please sign in to comment.