disable attach volume to a vm if volume state is not in allocated or ready state

This commit is contained in:
Edison Su 2011-08-19 14:26:47 -07:00
parent 301a5f7bcc
commit 5696543359
1 changed files with 5 additions and 1 deletions

View File

@ -486,9 +486,13 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
// Check that the volume is stored on shared storage
if (!Volume.State.Allocated.equals(volume.getState()) && !_storageMgr.volumeOnSharedStoragePool(volume)) {
if (!_storageMgr.volumeOnSharedStoragePool(volume)) {
throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool.");
}
if (!(Volume.State.Allocated.equals(volume.getState()) || Volume.State.Ready.equals(volume.getState()))) {
throw new InvalidParameterValueException("Volume state must be in Allocated or Ready state");
}
// Check that the volume is not currently attached to any VM
if (volume.getInstanceId() != null) {