Skip to content

Commit 89efed2

Browse files
committed
Add some logging for drs
1 parent c9eb8ce commit 89efed2

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

plugins/drs/cluster/balanced/src/main/java/org/apache/cloudstack/cluster/Balanced.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public Ternary<Double, Double, Double> getMetrics(long clusterId, VirtualMachine
7373
Double preImbalance = ClusterDrsAlgorithm.getClusterImbalance(clusterId, new ArrayList<>(hostCpuMap.values()), new ArrayList<>(hostMemoryMap.values()), null);
7474
Double postImbalance = getImbalancePostMigration(serviceOffering, vm, destHost, hostCpuMap, hostMemoryMap);
7575

76-
logger.debug(String.format("Cluster %d pre-imbalance: %s post-imbalance: %s Algorithm: %s VM: %s dest Host: %s",
77-
clusterId, preImbalance, postImbalance, getName(), vm.getUuid(), destHost.getUuid()));
76+
logger.debug(String.format("Cluster %d pre-imbalance: %s post-imbalance: %s Algorithm: %s VM: %s srcHost: %d destHost: %s",
77+
clusterId, preImbalance, postImbalance, getName(), vm.getUuid(), vm.getHostId(), destHost.getUuid()));
7878

7979
// This needs more research to determine the cost and benefit of a migration
8080
// TODO: Cost should be a factor of the VM size and the host capacity

plugins/drs/cluster/condensed/src/main/java/org/apache/cloudstack/cluster/Condensed.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public Ternary<Double, Double, Double> getMetrics(long clusterId, VirtualMachine
7777
new ArrayList<>(hostMemoryMap.values()), null);
7878
Double postImbalance = getImbalancePostMigration(serviceOffering, vm, destHost, hostCpuMap, hostMemoryMap);
7979

80-
logger.debug(String.format("Cluster %d pre-imbalance: %s post-imbalance: %s Algorithm: %s VM: %s destHost: %s",
81-
clusterId, preImbalance, postImbalance, getName(), vm.getUuid(), destHost.getUuid()));
80+
logger.debug(String.format("Cluster %d pre-imbalance: %s post-imbalance: %s Algorithm: %s VM: %s srcHost: %d destHost: %s",
81+
clusterId, preImbalance, postImbalance, getName(), vm.getUuid(), vm.getHostId(), destHost.getUuid()));
8282

8383
// This needs more research to determine the cost and benefit of a migration
8484
// TODO: Cost should be a factor of the VM size and the host capacity

server/src/main/java/org/apache/cloudstack/cluster/ClusterDrsServiceImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ List<Ternary<VirtualMachine, Host, Host>> getDrsPlan(Cluster cluster,
375375
logger.debug("VM migrating to it's original host or no host found for migration");
376376
break;
377377
}
378+
logger.debug(String.format("Plan for VM %s to migrate from host %s to host %s", vm.getUuid(),
379+
hostMap.get(vm.getHostId()).getUuid(), destHost.getUuid()));
378380

379381
ServiceOffering serviceOffering = vmIdServiceOfferingMap.get(vm.getId());
380382
migrationPlan.add(new Ternary<>(vm, hostMap.get(vm.getHostId()), hostMap.get(destHost.getId())));

0 commit comments

Comments
 (0)