mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-4471. If an instance fails to start then mark the volumes allocated as part of VM creation as removed and set the volume state as destroyed.
This commit is contained in:
parent
81938c68ac
commit
358c6e371d
@ -1103,8 +1103,14 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
@Override
|
||||
public void destroyVolume(Volume volume) {
|
||||
try {
|
||||
volService.destroyVolume(volume.getId());
|
||||
} catch (ConcurrentOperationException e) {
|
||||
// Mark volume as removed if volume has not been created on primary
|
||||
if (volume.getState() == Volume.State.Allocated) {
|
||||
_volsDao.remove(volume.getId());
|
||||
stateTransitTo(volume, Volume.Event.DestroyRequested);
|
||||
} else {
|
||||
volService.destroyVolume(volume.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to destroy volume" + volume.getId(), e);
|
||||
throw new CloudRuntimeException("Failed to destroy volume" + volume.getId(), e);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user