mirror of https://github.com/apache/cloudstack.git
Address review comments
This commit is contained in:
parent
2c9a000530
commit
31bd9ed45c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue