GutoVeronezi commented on a change in pull request #5170:
URL: https://github.com/apache/cloudstack/pull/5170#discussion_r663893353
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -7445,7 +7443,7 @@ private Answer execute(PrepareUnmanageVMInstanceCommand
cmd) {
mgr.prepareSecondaryStorageStore(secStoreUrl, secStoreId);
ManagedObjectReference morSecDs =
prepareSecondaryDatastoreOnSpecificHost(secStoreUrl, targetHyperHost);
if (morSecDs == null) {
- String msg = "Failed to prepare secondary storage on host,
secondary store url: " + secStoreUrl;
+ String msg = String.format("Failed to prepare secondary
storage on host, secondary store url: %s", secStoreUrl);
Review comment:
As the var is used only once, we could implement this message directly
in the `throw new ...`.
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -7475,9 +7473,11 @@ private Answer execute(PrepareUnmanageVMInstanceCommand
cmd) {
if (!vmMo.changeDatastore(relocateSpec)) {
throw new Exception("Change datastore operation failed
during storage migration");
} else {
- s_logger.debug("Successfully migrated VM " + vmName +
- (hostInTargetCluster != null ? " from " +
sourceHyperHost.getHyperHostName() + " to " +
targetHyperHost.getHyperHostName() + " and " : " with ") +
- "its storage to target datastore(s)");
+ String msg = String.format("Successfully migrated VM: %s
with its storage to target datastore(s)", vmName);
+ if (targetHyperHost != null) {
+ msg += String.format(" from host %s to %s",
sourceHyperHost.getHyperHostName(), targetHyperHost.getHyperHostName());
Review comment:
```suggestion
msg = String.format("% from host %s to %s", msg,
sourceHyperHost.getHyperHostName(), targetHyperHost.getHyperHostName());
```
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -7337,20 +7337,20 @@ private Answer execute(PrepareUnmanageVMInstanceCommand
cmd) {
if (targetHyperHost != null) {
ManagedObjectReference morTargetHostDc =
targetHyperHost.getHyperHostDatacenter();
if
(!morSourceHostDc.getValue().equalsIgnoreCase(morTargetHostDc.getValue())) {
- String msg = "VM " + vmName + " cannot be migrated between
different datacenter";
+ String msg = String.format("VM: %s cannot be migrated
between different datacenter", vmName);
Review comment:
`VirtualMachineTO` has a `toString` that prints id, name, uuid and type.
We could use the `vmTO.toString()` here and wherever we print `vmName`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]