mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
CLOUDSTACK-4324: need to clean up snapshot_store_ref, if creating snapshot failed.
This commit is contained in:
parent
0f60b5d41c
commit
374de76dae
@ -214,7 +214,8 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||||||
try {
|
try {
|
||||||
result = future.get();
|
result = future.get();
|
||||||
if (result.isFailed()) {
|
if (result.isFailed()) {
|
||||||
s_logger.debug("Failed to create snapshot:" + result.getResult());
|
snapshot.processEvent(Snapshot.Event.OperationFailed);
|
||||||
|
snapshot.processEvent(Event.OperationFailed);
|
||||||
throw new CloudRuntimeException(result.getResult());
|
throw new CloudRuntimeException(result.getResult());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -224,8 +225,10 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
s_logger.debug("Failed to create snapshot", e);
|
s_logger.debug("Failed to create snapshot", e);
|
||||||
throw new CloudRuntimeException("Failed to create snapshot", e);
|
throw new CloudRuntimeException("Failed to create snapshot", e);
|
||||||
|
} catch (NoTransitionException e) {
|
||||||
|
s_logger.debug("Failed to create snapshot", e);
|
||||||
|
throw new CloudRuntimeException("Failed to create snapshot", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a snapshot has parent snapshot, the new snapshot should be stored in
|
// if a snapshot has parent snapshot, the new snapshot should be stored in
|
||||||
|
|||||||
@ -352,8 +352,11 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||||||
secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(
|
secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(
|
||||||
secondaryStorageUrl + File.separator + volumeDir
|
secondaryStorageUrl + File.separator + volumeDir
|
||||||
);
|
);
|
||||||
|
if (!srcVolumeName.endsWith(".qcow2")) {
|
||||||
|
srcVolumeName = srcVolumeName + ".qcow2";
|
||||||
|
}
|
||||||
KVMPhysicalDisk volume = secondaryStoragePool
|
KVMPhysicalDisk volume = secondaryStoragePool
|
||||||
.getPhysicalDisk(srcVolumeName + ".qcow2");
|
.getPhysicalDisk(srcVolumeName);
|
||||||
storagePoolMgr.copyPhysicalDisk(volume, volumeName,
|
storagePoolMgr.copyPhysicalDisk(volume, volumeName,
|
||||||
primaryPool);
|
primaryPool);
|
||||||
VolumeObjectTO newVol = new VolumeObjectTO();
|
VolumeObjectTO newVol = new VolumeObjectTO();
|
||||||
@ -414,7 +417,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||||||
storagePoolMgr.copyPhysicalDisk(volume,
|
storagePoolMgr.copyPhysicalDisk(volume,
|
||||||
destVolumeName,secondaryStoragePool);
|
destVolumeName,secondaryStoragePool);
|
||||||
VolumeObjectTO newVol = new VolumeObjectTO();
|
VolumeObjectTO newVol = new VolumeObjectTO();
|
||||||
newVol.setPath(destVolumePath + File.separator + volumeName);
|
newVol.setPath(destVolumePath + File.separator + destVolumeName);
|
||||||
return new CopyCmdAnswer(newVol);
|
return new CopyCmdAnswer(newVol);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
return new CopyCmdAnswer(e.toString());
|
return new CopyCmdAnswer(e.toString());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user