Address review comments

This commit is contained in:
nvazquez 2026-06-22 14:37:02 -03:00
parent 2c9a000530
commit 31bd9ed45c
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
2 changed files with 20 additions and 14 deletions

View File

@ -21,6 +21,9 @@ package com.cloud.agent.api;
import com.cloud.agent.api.to.DataStoreTO;
/**
* This command is used to cleanup the converted instance disks from the storage pool: vmVolumesStore and the prefix: vmVolumesPrefix.
*/
public class CleanupConvertedInstanceDisksCommand extends Command {
private DataStoreTO vmVolumesStore;

View File

@ -2243,26 +2243,29 @@ public class UnmanagedVMsManagerImpl implements UnmanagedVMsManager {
throw new CloudRuntimeException(err);
} finally {
if (cleanupConvertedDisks) {
logger.debug("Cleaning up the converted disks for the VM {} through " +
"the conversion host {}", sourceVM, convertHost.getName());
CleanupConvertedInstanceDisksCommand cleanupCommand =
new CleanupConvertedInstanceDisksCommand(temporaryConvertLocation, convertedDisksPrefix);
try {
Answer cleanupAnswer = agentManager.send(convertHost.getId(), cleanupCommand);
if (!cleanupAnswer.getResult()) {
logger.warn("Failed to cleanup the converted disks for the VM {} through " +
"the conversion host {}: {}", sourceVM, convertHost.getName(), cleanupAnswer.getDetails());
}
} catch (AgentUnavailableException | OperationTimedoutException e) {
logger.error("Error cleaning up converted disks for VM {} through the conversion host {}",
sourceVM, convertHost.getName(), e);
}
cleanupConvertedDisks(sourceVM, convertHost, temporaryConvertLocation, convertedDisksPrefix);
}
}
return ((ImportConvertedInstanceAnswer) importAnswer).getConvertedInstance();
}
private void cleanupConvertedDisks(String sourceVM, HostVO convertHost, DataStoreTO temporaryConvertLocation, String convertedDisksPrefix) {
logger.debug("Cleaning up the converted disks for the VM {} through the conversion host {}", sourceVM, convertHost.getName());
CleanupConvertedInstanceDisksCommand cleanupCommand =
new CleanupConvertedInstanceDisksCommand(temporaryConvertLocation, convertedDisksPrefix);
try {
Answer cleanupAnswer = agentManager.send(convertHost.getId(), cleanupCommand);
if (!cleanupAnswer.getResult()) {
logger.warn("Failed to cleanup the converted disks for the VM {} through " +
"the conversion host {}: {}", sourceVM, convertHost.getName(), cleanupAnswer.getDetails());
}
} catch (AgentUnavailableException | OperationTimedoutException e) {
logger.error("Error cleaning up converted disks for VM {} through the conversion host {}",
sourceVM, convertHost.getName(), e);
}
}
private List<StoragePoolVO> findInstanceConversionDestinationStoragePoolsInCluster(
Cluster destinationCluster, ServiceOfferingVO serviceOffering,
Map<String, Long> dataDiskOfferingMap,