Skip to content

Commit 9052641

Browse files
committed
fix build error after merge-forward
1 parent 93406f5 commit 9052641

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ public List<ClusterMetricsResponse> listClusterMetrics(Pair<List<ClusterResponse
789789
Double imbalance = ClusterDrsAlgorithm.getClusterImbalance(clusterId, cpuList, memoryList, null);
790790
metricsResponse.setDrsImbalance(imbalance.isNaN() ? null : 100.0 * imbalance);
791791
} catch (ConfigurationException e) {
792-
LOGGER.warn("Failed to get cluster imbalance for cluster " + clusterId, e);
792+
logger.warn("Failed to get cluster imbalance for cluster " + clusterId, e);
793793
}
794794

795795
metricsResponse.setState(clusterResponse.getAllocationState(), clusterResponse.getManagedState());

plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStoragePool.java

+15-14
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@
3434
import com.google.gson.JsonParser;
3535
import com.google.gson.JsonSyntaxException;
3636
import org.apache.cloudstack.utils.qemu.QemuImg;
37-
import org.apache.log4j.Logger;
37+
import org.apache.logging.log4j.LogManager;
38+
import org.apache.logging.log4j.Logger;
3839
import org.joda.time.Duration;
3940

4041
public class LinstorStoragePool implements KVMStoragePool {
41-
private static final Logger s_logger = Logger.getLogger(LinstorStoragePool.class);
42+
private static final Logger LOGGER = LogManager.getLogger(LinstorStoragePool.class);
4243
private final String _uuid;
4344
private final String _sourceHost;
4445
private final int _sourcePort;
@@ -226,12 +227,12 @@ public String getHearthBeatPath() {
226227
@Override
227228
public String createHeartBeatCommand(HAStoragePool pool, String hostPrivateIp,
228229
boolean hostValidation) {
229-
s_logger.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation));
230+
LOGGER.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation));
230231
boolean isStorageNodeUp = checkingHeartBeat(pool, null);
231232
if (!isStorageNodeUp && !hostValidation) {
232233
//restart the host
233-
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()));
234-
Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), s_logger);
234+
LOGGER.debug(String.format("The host [%s] will be restarted because the health check failed for the storage pool [%s]", hostPrivateIp, pool.getPool().getType()));
235+
Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), LOGGER);
235236
cmd.add("-c");
236237
cmd.execute();
237238
return "Down";
@@ -247,7 +248,7 @@ public String getStorageNodeId() {
247248

248249
static String getHostname() {
249250
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
250-
Script sc = new Script("hostname", Duration.millis(10000L), s_logger);
251+
Script sc = new Script("hostname", Duration.millis(10000L), LOGGER);
251252
String res = sc.execute(parser);
252253
if (res != null) {
253254
throw new CloudRuntimeException(String.format("Unable to run 'hostname' command: %s", res));
@@ -264,7 +265,7 @@ public Boolean checkingHeartBeat(HAStoragePool pool, HostTO host) {
264265
} else {
265266
hostName = host.getParent();
266267
if (hostName == null) {
267-
s_logger.error("No hostname set in host.getParent()");
268+
LOGGER.error("No hostname set in host.getParent()");
268269
return false;
269270
}
270271
}
@@ -273,7 +274,7 @@ public Boolean checkingHeartBeat(HAStoragePool pool, HostTO host) {
273274
}
274275

275276
private String executeDrbdSetupStatus(OutputInterpreter.AllLinesParser parser) {
276-
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger);
277+
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER);
277278
sc.add("status");
278279
sc.add("--json");
279280
return sc.execute(parser);
@@ -293,12 +294,12 @@ private boolean checkDrbdSetupStatusOutput(String output, String otherNodeName)
293294
}
294295
}
295296
}
296-
s_logger.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName));
297+
LOGGER.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName));
297298
return false;
298299
}
299300

300301
private String executeDrbdEventsNow(OutputInterpreter.AllLinesParser parser) {
301-
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger);
302+
Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER);
302303
sc.add("events2");
303304
sc.add("--now");
304305
return sc.execute(parser);
@@ -307,13 +308,13 @@ private String executeDrbdEventsNow(OutputInterpreter.AllLinesParser parser) {
307308
private boolean checkDrbdEventsNowOutput(String output) {
308309
boolean healthy = output.lines().noneMatch(line -> line.matches(".*role:Primary .* promotion_score:0.*"));
309310
if (!healthy) {
310-
s_logger.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false");
311+
LOGGER.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false");
311312
}
312313
return healthy;
313314
}
314315

315316
private boolean checkHostUpToDateAndConnected(String hostName) {
316-
s_logger.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName));
317+
LOGGER.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName));
317318
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
318319

319320
if (localNodeName.equalsIgnoreCase(hostName)) {
@@ -331,15 +332,15 @@ private boolean checkHostUpToDateAndConnected(String hostName) {
331332
try {
332333
return checkDrbdSetupStatusOutput(parser.getLines(), hostName);
333334
} catch (JsonIOException | JsonSyntaxException e) {
334-
s_logger.error("Error parsing drbdsetup status --json", e);
335+
LOGGER.error("Error parsing drbdsetup status --json", e);
335336
}
336337
}
337338
return false;
338339
}
339340

340341
@Override
341342
public Boolean vmActivityCheck(HAStoragePool pool, HostTO host, Duration activityScriptTimeout, String volumeUUIDListString, String vmActivityCheckPath, long duration) {
342-
s_logger.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp()));
343+
LOGGER.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp()));
343344
return checkingHeartBeat(pool, host);
344345
}
345346
}

server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ private void appendSourceNatIpToBootArgs(final VirtualMachineProfile profile) {
305305
List<IPAddressVO> vpcIps = _ipAddressDao.listByAssociatedVpc(router.getVpcId(), true);
306306
if (CollectionUtils.isNotEmpty(vpcIps)) {
307307
buf.append(String.format(" source_nat_ip=%s", vpcIps.get(0).getAddress().toString()));
308-
if (s_logger.isDebugEnabled()) {
309-
s_logger.debug("The final Boot Args for " + profile + ": " + buf);
310-
}
308+
logger.debug("The final Boot Args for " + profile + ": " + buf);
311309
}
312310
}
313311
}

0 commit comments

Comments
 (0)