Skip to content

Commit 0c52c28

Browse files
Updated import log, with time taken and vm details
1 parent 089f743 commit 0c52c28

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,16 @@ public void setDatastorePort(int datastorePort) {
317317
public int getDatastorePort() {
318318
return datastorePort;
319319
}
320+
321+
@Override
322+
public String toString() {
323+
return "Disk {" +
324+
"diskId='" + diskId + '\'' +
325+
", capacity=" + capacity +
326+
", controller='" + controller + '\'' +
327+
", controllerUnit=" + controllerUnit +
328+
"}";
329+
}
320330
}
321331

322332
public static class Nic {
@@ -409,5 +419,14 @@ public String getPciSlot() {
409419
public void setPciSlot(String pciSlot) {
410420
this.pciSlot = pciSlot;
411421
}
422+
423+
@Override
424+
public String toString() {
425+
return "Nic{" +
426+
"nicId='" + nicId + '\'' +
427+
", adapterType='" + adapterType + '\'' +
428+
", macAddress='" + macAddress + '\'' +
429+
"}";
430+
}
412431
}
413432
}

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,7 @@ protected UserVm importUnmanagedInstanceFromVmwareToKvm(DataCenter zone, Cluster
16031603

16041604
temporaryConvertLocation = selectInstanceConversionTemporaryLocation(destinationCluster, convertStoragePoolId);
16051605
List<StoragePoolVO> convertStoragePools = findInstanceConversionStoragePoolsInCluster(destinationCluster);
1606+
long importStartTime = System.currentTimeMillis();
16061607
clonedInstance = cloneSourceVmwareUnmanagedInstance(vcenter, datacenterName, username, password, clusterName, sourceHostName, sourceVM);
16071608
boolean isWindowsVm = clonedInstance.getOperatingSystem().toLowerCase().contains("windows");
16081609
if (isWindowsVm) {
@@ -1630,7 +1631,9 @@ protected UserVm importUnmanagedInstanceFromVmwareToKvm(DataCenter zone, Cluster
16301631
serviceOffering, dataDiskOfferingMap,
16311632
nicNetworkMap, nicIpAddressMap,
16321633
details, false, forced, false);
1633-
LOGGER.debug(String.format("VM %s imported successfully", sourceVM));
1634+
long timeElapsedInSecs = (System.currentTimeMillis() - importStartTime) / 1000;
1635+
LOGGER.debug(String.format("VMware VM %s imported successfully to CloudStack instance %s, Time taken: %d secs, Source VMware VM details - OS: %s, Disks: %s, NICs: %s",
1636+
sourceVM, instanceName, timeElapsedInSecs, clonedInstance.getOperatingSystem(), clonedInstance.getDisks(), clonedInstance.getNics()));
16341637
return userVm;
16351638
} catch (CloudRuntimeException e) {
16361639
LOGGER.error(String.format("Error importing VM: %s", e.getMessage()), e);

0 commit comments

Comments
 (0)