Skip to content
Browse files

clarify volume detachment error message

fix ex propagation
add missing call to commit
chain exception to preserve cause information
  • Loading branch information...
2 parents 0440deb + 6a50f8d commit 555c91ba3cf774fe2d087379b62201a05e3aa230 @grze grze committed
View
2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/VolumeManager.java
@@ -168,7 +168,7 @@ public Volume apply( Long size ) {
try {
return Volumes.createStorageVolume( sc, owner, snapId, Ints.checkedCast( size ), request );
} catch ( ExecutionException ex ) {
- throw new RuntimeException( ex );
+ throw Exceptions.toUndeclared( ex );
}
}};
Volume newVol = RestrictedTypes.allocateMeasurableResource( newSize.longValue( ), allocator );
View
8 ...s/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/VolumeDetachCallback.java
@@ -91,7 +91,13 @@ public VmInstance apply( final String input ) {
VmInstance vm = VmInstances.lookup( input );
VmVolumeAttachment volumeAttachment = vm.lookupVolumeAttachment( volumeId );
if ( !VmVolumeAttachment.AttachmentState.attached.equals( volumeAttachment.getAttachmentState( ) ) ) {
- throw Exceptions.toUndeclared( "Failed to detach volume which is already detaching: " + volumeId );
+ if ( VmVolumeAttachment.AttachmentState.detaching.equals( volumeAttachment.getAttachmentState( ) ) ) {
+ throw Exceptions.toUndeclared( "Failed to detach volume which is already detaching: " + volumeId );
+ } else if ( VmVolumeAttachment.AttachmentState.attaching.equals( volumeAttachment.getAttachmentState( ) ) ) {
+ throw Exceptions.toUndeclared( "Failed to detach volume which is currently attaching: " + volumeId );
+ } else {
+ throw Exceptions.toUndeclared( "Failed to detach volume which is not currently attached: " + volumeId );
+ }
}
vm.updateVolumeAttachment( volumeId, AttachmentState.detaching );
return vm;
View
1 clc/modules/msgs/src/main/java/com/eucalyptus/entities/Transactions.java
@@ -226,6 +226,7 @@ public void fire( T t ) {}
} catch ( Exception ex ) {
throw new TransactionCallbackException( ex );
}
+ db.commit( );
return entity;
} catch ( TransactionCallbackException e ) {
db.rollback( );

0 comments on commit 555c91b

Please sign in to comment.
Something went wrong with that request. Please try again.