Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

destroy service, RT: #4537, #5274

  • Loading branch information...
commit f1283317eea8d1dbf1bac37214b85bd0752518a7 1 parent 130aa1e
@grze grze authored
View
20 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/Cluster.java
@@ -419,7 +419,7 @@ private static void fireCallback( final Cluster parent,
} finally {
if ( !transitionCallback.isDone( ) ) {
LOG.debug( parent.getFullName( ) + " transition fell through w/o completing: " + messageCallback );
- Logs.exhaust( ).debug( Exceptions.toUndeclared( parent.getFullName( ) + " transition fell through w/o completing: " + messageCallback ) );
+ Logs.extreme( ).debug( Exceptions.toUndeclared( parent.getFullName( ) + " transition fell through w/o completing: " + messageCallback ) );
transitionCallback.fire( );
}
}
@@ -535,7 +535,7 @@ public void fire( final Cluster t ) {
@Override
public void fire( final Cluster t ) {
if ( !t.pendingErrors.isEmpty( ) ) {
- Logs.exhaust( ).error( t.pendingErrors );
+ Logs.extreme( ).error( t.pendingErrors );
}
LOG.debug( "Clearing error logs for: " + t );
t.clearExceptions( );
@@ -840,19 +840,19 @@ public void start( ) throws ServiceRegistrationException {
Thread.currentThread( ).interrupt( );
} catch ( final ServiceRegistrationException ex ) {
lastEx = ex;
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
} catch ( final Exception ex ) {
lastEx = ex;
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
}
}
Listeners.register( Hertz.class, this );
}
} catch ( final NoSuchElementException ex ) {
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
throw ex;
} catch ( final Exception ex ) {
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
throw new ServiceRegistrationException( "Failed to call start() on cluster " + this.configuration
+ " because of: "
+ ex.getMessage( ), ex );
@@ -882,7 +882,7 @@ public void enable( ) throws ServiceRegistrationException {
throw fail;
}
} catch ( final Exception ex ) {
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
throw new ServiceRegistrationException( "Failed to call enable() on cluster " + this.configuration
+ " because of: "
+ ex.getMessage( ), ex );
@@ -900,7 +900,7 @@ public void disable( ) throws ServiceRegistrationException {
} catch ( final InterruptedException ex ) {
Thread.currentThread( ).interrupt( );
} catch ( final Exception ex ) {
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
// throw new ServiceRegistrationException( "Failed to call disable() on cluster " + this.configuration
// + " because of: "
// + ex.getMessage( ), ex );
@@ -917,7 +917,7 @@ public void stop( ) throws ServiceRegistrationException {
} catch ( final InterruptedException ex ) {
Thread.currentThread( ).interrupt( );
} catch ( final Exception ex ) {
- Logs.exhaust( ).debug( ex, ex );
+ Logs.extreme( ).debug( ex, ex );
throw new ServiceRegistrationException( "Failed to call stop() on cluster " + this.configuration
+ " because of: "
+ ex.getMessage( ), ex );
@@ -1195,7 +1195,7 @@ public T newInstance( ) {
throw ex;
} catch ( final Exception ex ) {
LOG.error( ex );
- Logs.exhaust( ).error( ex, ex );
+ Logs.extreme( ).error( ex, ex );
throw Exceptions.toUndeclared( ex );
}
}
View
45 clc/modules/configuration/src/main/java/com/eucalyptus/config/Properties.java
@@ -9,43 +9,42 @@
import com.eucalyptus.scripting.Groovyness;
import com.eucalyptus.util.EucalyptusCloudException;
import com.eucalyptus.util.Exceptions;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
public class Properties {
private static Logger LOG = Logger.getLogger( Properties.class );
- public DescribePropertiesResponseType describeProperties( DescribePropertiesType request ) throws EucalyptusCloudException {
+
+ public DescribePropertiesResponseType describeProperties( final DescribePropertiesType request ) throws EucalyptusCloudException {
if ( !Contexts.lookup( ).hasAdministrativePrivileges( ) ) {
throw new EucalyptusCloudException( "You are not authorized to interact with this service." );
}
DescribePropertiesResponseType reply = request.getReply( );
List<Property> props = reply.getProperties( );
- if ( request.getProperties( ).isEmpty( ) ) {
- for ( ConfigurableProperty entry : PropertyDirectory.getPropertyEntrySet( ) ) {
+ final Predicate<ConfigurableProperty> filter = new Predicate<ConfigurableProperty>( ) {
+ public boolean apply( final ConfigurableProperty input ) {
+ if ( request.getProperties( ).isEmpty( ) ) {
+ return true;
+ } else if ( request.getProperties( ).contains( input.getQualifiedName( ) ) ) {
+ return true;
+ } else {
+ for ( String propRequest : request.getProperties( ) ) {
+ if ( input.getQualifiedName( ).startsWith( propRequest ) ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ };
+ for ( ConfigurableProperty entry : Iterables.filter( PropertyDirectory.getPropertyEntrySet( ), filter ) ) {
+ if ( filter.apply( entry ) ) {
String value = "********";
if ( !entry.getWidgetType( ).equals( ConfigurableFieldType.KEYVALUEHIDDEN ) )
value = entry.getValue( );
props.add( new Property( entry.getQualifiedName( ), value, entry.getDescription( ) ) );
}
- } else {
- for ( ConfigurableProperty entry : PropertyDirectory.getPropertyEntrySet( ) ) {
- if ( request.getProperties( ).contains( entry.getQualifiedName( ) ) ) {
- String value = "********";
- if ( !entry.getWidgetType( ).equals( ConfigurableFieldType.KEYVALUEHIDDEN ) )
- value = entry.getValue( );
- props.add( new Property( entry.getQualifiedName( ), value, entry.getDescription( ) ) );
- }
- }
- for ( String entrySetName : PropertyDirectory.getPropertyEntrySetNames( ) ) {
- if ( request.getProperties( ).contains( entrySetName ) ) {
- String value = "********";
- for ( ConfigurableProperty entry : PropertyDirectory.getPropertyEntrySet( entrySetName ) ) {
- if ( !entry.getWidgetType( ).equals( ConfigurableFieldType.KEYVALUEHIDDEN ) ) {
- value = entry.getValue( );
- }
- props.add( new Property( entry.getQualifiedName( ), value, entry.getDescription( ) ) );
- }
- }
- }
}
return reply;
}
View
28 clc/modules/msgs/src/main/java/com/eucalyptus/component/AbstractServiceBuilder.java
@@ -63,7 +63,7 @@
* @author chris grzegorczyk <grze@eucalyptus.com>
*/
-import java.util.List;
+import java.util.NoSuchElementException;
import javax.persistence.PersistenceException;
import org.apache.log4j.Logger;
import com.eucalyptus.component.ComponentId.Partition;
@@ -88,6 +88,8 @@ public Boolean checkAdd( String partition, String name, String host, Integer por
ServiceConfiguration existingName = null;
try {
existingName = ServiceConfigurations.lookupByName( this.getComponentId( ).getClass( ), name );
+ } catch ( NoSuchElementException ex1 ) {
+ LOG.trace( "Failed to find existing component registration for name: " + name );
} catch ( PersistenceException ex1 ) {
LOG.trace( "Failed to find existing component registration for name: " + name );
}
@@ -97,15 +99,19 @@ public Boolean checkAdd( String partition, String name, String host, Integer por
if ( !manyToOne ) {
if ( this.getComponentId( ).isPartitioned( ) ) {
if ( ServiceConfigurations.listPartition( this.getComponentId( ).getClass( ), partition ).size( ) >= 2 ) {
- throw new ServiceRegistrationException( "Unable to register more than two services in a partition for component type: " + this.getComponentId( ).getName( ) );
+ throw new ServiceRegistrationException( "Unable to register more than two services in a partition for component type: "
+ + this.getComponentId( ).getName( ) );
}
} else {
if ( ServiceConfigurations.list( this.getComponentId( ).getClass( ) ).size( ) >= 2 ) {
- throw new ServiceRegistrationException( "Unable to register more than two services in a partition for component type: " + this.getComponentId( ).getName( ) );
+ throw new ServiceRegistrationException( "Unable to register more than two services in a partition for component type: "
+ + this.getComponentId( ).getName( ) );
}
}
try {
existingHost = ServiceConfigurations.lookupByHost( this.getComponentId( ).getClass( ), host );
+ } catch ( NoSuchElementException ex1 ) {
+ LOG.trace( "Failed to find existing component registration for host: " + name );
} catch ( PersistenceException ex1 ) {
LOG.trace( "Failed to find existing component registration for host: " + host );
}
@@ -115,9 +121,21 @@ public Boolean checkAdd( String partition, String name, String host, Integer por
+ this.getComponentId( ).getName( ) );
}
}
+ /**
+ * @grze check here if we have an existing identical registration and return false in this case
+ * -- caller should handle it differently than an exception
+ */
if ( existingName != null && existingHost != null ) {
- return false;
- } else if ( existingName == null && existingHost == null ) {
+ ServiceConfiguration maybeIdenticalConfig = existingName;
+ if ( existingName.equals( existingHost )
+ && maybeIdenticalConfig.getName( ).equals( name )
+ && maybeIdenticalConfig.getPartition( ).equals( partition )
+ && maybeIdenticalConfig.getHostName( ).equals( host )
+ && maybeIdenticalConfig.getPort( ).equals( port ) ) {
+ return false;
+ }
+ }
+ if ( existingName == null && existingHost == null ) {
return true;
} else if ( existingName != null ) {
throw new ServiceRegistrationException( "Component with name=" + name + " already exists with host=" + existingName.getHostName( ) );
View
49 clc/modules/msgs/src/main/java/com/eucalyptus/component/ComponentRegistrationHandler.java
@@ -65,6 +65,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.NoSuchElementException;
import java.util.concurrent.Future;
import javax.persistence.PersistenceException;
import org.apache.log4j.Logger;
@@ -116,7 +117,7 @@ public static boolean register( final ComponentId compId, String partitionName,
+ ":"
+ port );
if ( !builder.checkAdd( partition, name, hostName, port ) ) {
- LOG.info( "Returning existing registration information for: "
+ LOG.info( "Returning existing registration information for: "
+ partition
+ "."
+ name
@@ -133,8 +134,8 @@ public static boolean register( final ComponentId compId, String partitionName,
Partition part = Partitions.lookup( newComponent );
part.syncKeysToDisk( );
Partition p = Partitions.lookup( newComponent );
- Logs.exhaust( ).info( p.getCertificate( ) );
- Logs.exhaust( ).info( p.getNodeCertificate( ) );
+ Logs.extreme( ).info( p.getCertificate( ) );
+ Logs.extreme( ).info( p.getNodeCertificate( ) );
}
ServiceConfigurations.store( newComponent );
try {
@@ -170,6 +171,7 @@ public void run( ) {
public static boolean deregister( final ComponentId compId, String name ) throws ServiceRegistrationException, EucalyptusCloudException {
final ServiceBuilder<?> builder = ServiceBuilders.lookup( compId );
LOG.info( "Using builder: " + builder.getClass( ).getSimpleName( ) );
+ boolean proceedOnError = false;
try {
if ( !checkRemove( builder, name ) ) {
LOG.info( builder.getClass( ).getSimpleName( ) + ": checkRemove failed." );
@@ -177,18 +179,41 @@ public static boolean deregister( final ComponentId compId, String name ) throws
+
"It is unsafe to currently deregister, please check the logs for additional information." );
}
+ } catch ( final NoSuchElementException ex ) {
+ LOG.info( "Silently proceeding with deregister for non-existant configuration" );
+ proceedOnError = true;
} catch ( Exception e ) {
LOG.info( builder.getClass( ).getSimpleName( ) + ": checkRemove failed." );
throw new ServiceRegistrationException( builder.getClass( ).getSimpleName( ) + ": checkRemove failed with message: "
- + e.getMessage( ), e );
+ + e.getMessage( ), e );
}
- try{
- final ServiceConfiguration conf = ServiceConfigurations.lookupByName( compId.getClass( ), name );
- Topology.destroy( conf );
- ServiceConfigurations.remove( conf );
- }catch(Exception e){
- LOG.info(builder.getClass().getSimpleName() + ": deregistration failed because of" + e.getMessage());
- throw new ServiceRegistrationException(builder.getClass().getSimpleName() + ": deregistration failed because of" + e.getMessage(), e);
+ try {
+ ServiceConfiguration conf;
+ try {
+ conf = ServiceConfigurations.lookupByName( compId.getClass( ), name );
+ } catch ( NoSuchElementException ex1 ) {
+ conf = Components.lookup( compId.getClass( ) ).lookup( name );
+ }
+ try {
+ Topology.destroy( conf );
+ } catch ( Exception ex ) {
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ try {
+ ServiceConfigurations.remove( conf );
+ } catch ( Exception ex ) {
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ } catch ( Exception e ) {
+ if ( proceedOnError ) {
+ LOG.info( builder.getClass( ).getSimpleName( ) + ": deregistration error, but proceeding since config has been removed: " + e.getMessage( ) );
+ return true;
+ } else {
+ LOG.info( builder.getClass( ).getSimpleName( ) + ": deregistration failed because of" + e.getMessage( ) );
+ throw new ServiceRegistrationException( builder.getClass( ).getSimpleName( ) + ": deregistration failed because of: " + e.getMessage( ), e );
+ }
}
return true;
}
@@ -206,6 +231,8 @@ private static boolean checkRemove( ServiceBuilder builder, String name ) {
conf.setName( name );
ServiceConfigurations.lookup( conf );
return true;
+ } catch ( final NoSuchElementException ex ) {
+ throw ex;
} catch ( PersistenceException e ) {
throw Exceptions.toUndeclared( e );
} catch ( Exception e ) {
View
35 clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceConfigurations.java
@@ -51,18 +51,18 @@
INSTANCE;
public <T extends ServiceConfiguration> List<T> list( final T example ) {
- final EntityWrapper<T> db = EntityWrapper.get( example );
+ final EntityTransaction db = Entities.get( example.getClass( ) );
List<T> componentList;
try {
- componentList = db.query( example );
+ componentList = Entities.query( example );
db.commit( );
return componentList;
} catch ( final PersistenceException ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
db.rollback( );
throw ex;
} catch ( final Throwable ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
db.rollback( );
throw new PersistenceException( "Service configuration lookup failed for: " + LogUtil.dumpObject( example ), ex );
}
@@ -75,30 +75,33 @@
existingName = Entities.uniqueResult( example );
db.commit( );
return existingName;
+ } catch ( final NoSuchElementException ex ) {
+ db.rollback( );
+ throw ex;
} catch ( final PersistenceException ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
db.rollback( );
throw ex;
} catch ( final Throwable ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
db.rollback( );
throw new PersistenceException( "Service configuration lookup failed for: " + LogUtil.dumpObject( example ), ex );
}
}
public <T extends ServiceConfiguration> T store( T config ) {
- final EntityWrapper<T> db = EntityWrapper.get( config );
+ final EntityTransaction db = Entities.get( config.getClass( ) );
try {
- config = db.persist( config );
+ config = Entities.persist( config );
db.commit( );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_REGISTERED, config.toString( ) ).info( );
} catch ( final PersistenceException ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_REGISTERED, "FAILED", config.toString( ) ).error( );
db.rollback( );
throw ex;
} catch ( final Throwable ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_REGISTERED, "FAILED", config.toString( ) ).error( );
db.rollback( );
throw new PersistenceException( "Service configuration storing failed for: " + LogUtil.dumpObject( config ), ex );
@@ -107,21 +110,23 @@
}
public <T extends ServiceConfiguration> T remove( final T config ) {
- final EntityWrapper<T> db = EntityWrapper.get( config );
+ final EntityTransaction db = Entities.get( config.getClass( ) );
try {
final T searchConfig = ( T ) config.getClass( ).newInstance( );
searchConfig.setName( config.getName( ) );
- final T exists = db.getUnique( searchConfig );
- db.delete( exists );
+ final T exists = Entities.uniqueResult( searchConfig );
+ Entities.delete( exists );
db.commit( );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_DEREGISTERED, config.toString( ) ).info( );
+ } catch ( final NoSuchElementException ex ) {
+ db.rollback( );
} catch ( final PersistenceException ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_DEREGISTERED, "FAILED", config.toString( ) ).error( );
db.rollback( );
throw ex;
} catch ( final Throwable ex ) {
- LOG.trace( ex );
+ LOG.debug( ex );
EventRecord.here( ServiceConfigurations.class, EventClass.COMPONENT, EventType.COMPONENT_DEREGISTERED, "FAILED", config.toString( ) ).error( );
db.rollback( );
throw new PersistenceException( "Service configuration removal failed for: " + LogUtil.dumpObject( config ), ex );
View
3  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java
@@ -849,7 +849,8 @@ public void fire( final ServiceConfiguration config ) {
@Override
public void fire( final ServiceConfiguration config ) {
try {
- List<ConfigurableProperty> props = PropertyDirectory.getPropertyEntrySet( config.getComponentId( ).name( ) );
+ String prefix = config.getPartition( ) + "." + config.getComponentId( ).name( );
+ List<ConfigurableProperty> props = PropertyDirectory.getPropertyEntrySet( prefix );
for ( ConfigurableProperty prop : props ) {
if ( prop instanceof SingletonDatabasePropertyEntry ) {
//GRZE:REVIEW do nothing?
View
72 clc/modules/msgs/src/main/java/com/eucalyptus/component/Topology.java
@@ -75,15 +75,16 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.log4j.Logger;
import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.BootstrapArgs;
import com.eucalyptus.bootstrap.Databases;
+import com.eucalyptus.bootstrap.Host;
import com.eucalyptus.bootstrap.Hosts;
import com.eucalyptus.component.Component.State;
+import com.eucalyptus.empyrean.DestroyServiceType;
import com.eucalyptus.empyrean.Empyrean;
import com.eucalyptus.empyrean.ServiceId;
import com.eucalyptus.empyrean.ServiceTransitionType;
@@ -97,6 +98,7 @@
import com.eucalyptus.util.Exceptions;
import com.eucalyptus.util.Internets;
import com.eucalyptus.util.TypeMappers;
+import com.eucalyptus.util.async.AsyncRequests;
import com.eucalyptus.util.async.Futures;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -331,7 +333,7 @@ public static int epoch( ) {
public static Function<ServiceConfiguration, Future<ServiceConfiguration>> transition( final Component.State toState ) {
final Function<ServiceConfiguration, Future<ServiceConfiguration>> transition = new Function<ServiceConfiguration, Future<ServiceConfiguration>>( ) {
- private final List<Component.State> serializedStates = Lists.newArrayList( Component.State.ENABLED );
+ private final List<Component.State> serializedStates = Lists.newArrayList( Component.State.ENABLED, Component.State.STOPPED );
@Override
public Future<ServiceConfiguration> apply( final ServiceConfiguration input ) {
@@ -362,7 +364,62 @@ public static int epoch( ) {
}
public static Future<ServiceConfiguration> destroy( final ServiceConfiguration config ) {
- return transition( State.PRIMORDIAL ).apply( config );
+ try {
+ ServiceConfigurations.remove( config );
+ } catch ( Exception ex ) {
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ try {
+ Topology.disable( config ).get( );
+ } catch ( Exception ex ) {
+ Exceptions.maybeInterrupted( ex );
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ try {
+ Topology.stop( config ).get( );
+ } catch ( Exception ex ) {
+ Exceptions.maybeInterrupted( ex );
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ try {
+ Component comp = Components.lookup( config.getComponentId( ) );
+ comp.destroy( config );
+ } catch ( Exception ex ) {
+ Exceptions.maybeInterrupted( ex );
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ if ( Hosts.isCoordinator( ) ) {
+ DestroyServiceType msg = new DestroyServiceType( );
+ try {
+ msg.getServices( ).add( TypeMappers.transform( config, ServiceId.class ) );
+ for ( Host h : Hosts.list( ) ) {
+ if ( !h.isLocalHost( ) && h.hasBootstrapped( ) ) {
+ try {
+ AsyncRequests.sendSync( ServiceConfigurations.createEphemeral( Empyrean.INSTANCE, h.getBindAddress( ) ), msg );
+ } catch ( Exception ex ) {
+ Exceptions.maybeInterrupted( ex );
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ }
+ }
+ } catch ( Exception ex ) {
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ }
+ try {
+ ServiceTransitions.StateCallbacks.PROPERTIES_REMOVE.fire( config );
+ } catch ( Exception ex ) {
+ Exceptions.maybeInterrupted( ex );
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ return Futures.predestinedFuture( config );
}
public static Future<ServiceConfiguration> load( final ServiceConfiguration config ) {
@@ -923,7 +980,14 @@ public String toString( ) {
public enum Transitions implements Function<ServiceConfiguration, ServiceConfiguration>, Supplier<Component.State> {
START( Component.State.DISABLED ),
- STOP( Component.State.STOPPED ),
+ STOP( Component.State.STOPPED ) {
+
+ @Override
+ public ServiceConfiguration apply( ServiceConfiguration input ) {
+ return super.tc.apply( input );
+ }
+
+ },
INITIALIZE( Component.State.INITIALIZED ),
LOAD( Component.State.LOADED ),
DESTROY( Component.State.PRIMORDIAL ),
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/empyrean/EmpyreanMessages.groovy
@@ -92,6 +92,10 @@ public class StopServiceType extends ServiceTransitionType {
}
public class StopServiceResponseType extends ServiceTransitionType {
}
+public class DestroyServiceType extends ServiceTransitionType {
+}
+public class DestroyServiceResponseType extends ServiceTransitionType {
+}
public class EnableServiceType extends ServiceTransitionType {
}
public class EnableServiceResponseType extends ServiceTransitionType implements HasSideEffect {
View
14 clc/modules/msgs/src/main/java/com/eucalyptus/entities/Entities.java
@@ -265,7 +265,7 @@ public static EntityTransaction get( final Object obj ) {
} catch ( final NoSuchElementException ex ) {
throw ex;
} catch ( final RuntimeException ex ) {
- Logs.exhaust( ).trace( ex, ex );
+ Logs.extreme( ).trace( ex, ex );
final Exception newEx = PersistenceExceptions.throwFiltered( ex );
throw new TransactionInternalException( newEx.getMessage( ), newEx );
}
@@ -548,7 +548,7 @@ private boolean clearStale( final PersistenceContext persistenceContext ) {
try {
this.txState = new TxState( ctx );
} catch ( final RuntimeException ex ) {
- Logs.exhaust( ).error( ex, ex );
+ Logs.extreme( ).error( ex, ex );
this.rollback( );
throw PersistenceExceptions.throwFiltered( ex );
}
@@ -658,7 +658,7 @@ public void setRollbackOnly( ) {}
@Override
public void rollback( ) {
-// Logs.exhaust( ).trace( "Child call to rollback() is ignored: " + Threads.currentStackRange( 2, 8 ) );
+// Logs.extreme( ).trace( "Child call to rollback() is ignored: " + Threads.currentStackRange( 2, 8 ) );
}
@Override
@@ -675,7 +675,7 @@ public boolean getRollbackOnly( ) {
public void commit( ) {
try {
// CascadingTx.this.getTxState( ).getEntityManager( ).flush( );
-// Logs.exhaust( ).trace( "Child call to commit() is ignored: " + Threads.currentStackRange( 2, 8 ) );
+// Logs.extreme( ).trace( "Child call to commit() is ignored: " + Threads.currentStackRange( 2, 8 ) );
} catch ( final HibernateException ex ) {
LOG.error( ex, ex );
}
@@ -766,7 +766,7 @@ public void begin( ) {
this.transaction.begin( );
} catch ( final RuntimeException ex ) {
LOG.warn( ex );
- Logs.exhaust( ).warn( ex, ex );
+ Logs.extreme( ).warn( ex, ex );
throw ex;
}
}
@@ -781,7 +781,7 @@ public void commit( ) {
this.transaction.commit( );
} catch ( final RuntimeException ex ) {
LOG.trace( ex, ex );
- Logs.exhaust( ).warn( ex, ex );
+ Logs.extreme( ).warn( ex, ex );
throw ex;
}
}
@@ -816,7 +816,7 @@ public void rollback( ) {
this.transaction.rollback( );
} catch ( final RuntimeException ex ) {
LOG.warn( ex );
- Logs.exhaust( ).warn( ex, ex );
+ Logs.extreme( ).warn( ex, ex );
throw ex;
}
}
View
31 clc/modules/msgs/src/main/java/com/eucalyptus/ws/EmpyreanService.java
@@ -75,9 +75,12 @@
import com.eucalyptus.component.Partitions;
import com.eucalyptus.component.ServiceConfiguration;
import com.eucalyptus.component.ServiceConfigurations;
+import com.eucalyptus.component.ServiceTransitions;
import com.eucalyptus.component.Topology;
import com.eucalyptus.empyrean.DescribeServicesResponseType;
import com.eucalyptus.empyrean.DescribeServicesType;
+import com.eucalyptus.empyrean.DestroyServiceResponseType;
+import com.eucalyptus.empyrean.DestroyServiceType;
import com.eucalyptus.empyrean.DisableServiceResponseType;
import com.eucalyptus.empyrean.DisableServiceType;
import com.eucalyptus.empyrean.Empyrean;
@@ -286,6 +289,27 @@ public static StartServiceResponseType startService( final StartServiceType requ
return reply;
}
+ public static DestroyServiceResponseType destroyService( final DestroyServiceType request ) throws Exception {
+ DestroyServiceResponseType reply = request.getReply( );
+ for ( final ServiceId serviceInfo : request.getServices( ) ) {
+ try {
+ final ServiceConfiguration service = TypeMappers.transform( serviceInfo, ServiceConfiguration.class );
+ if ( service.isVmLocal( ) ) {
+ try {
+ Topology.destroy( service ).get( );
+ } catch ( final IllegalStateException ex ) {
+ LOG.error( ex, ex );
+ }
+ }
+ reply.getServices( ).add( serviceInfo );
+ } catch ( final Exception ex ) {
+ LOG.error( ex );
+ Logs.extreme( ).debug( ex, ex );
+ }
+ }
+ return reply;
+ }
+
public static StopServiceResponseType stopService( final StopServiceType request ) throws Exception {
final StopServiceResponseType reply = request.getReply( );
for ( final ServiceId serviceInfo : request.getServices( ) ) {
@@ -299,13 +323,6 @@ public static StopServiceResponseType stopService( final StopServiceType request
} catch ( final IllegalStateException ex ) {
LOG.error( ex, ex );
throw ex;
-// } catch ( ExecutionException ex ) {
-// LOG.error( ex, ex );
-// throw Exceptions.toCatchable( ex.getCause( ) );
-// } catch ( InterruptedException ex ) {
-// LOG.error( ex, ex );
-// Thread.currentThread( ).interrupt( );
-// throw ex;
}
}
} catch ( final Exception ex ) {
Please sign in to comment.
Something went wrong with that request. Please try again.