Skip to content

Commit

Permalink
merged from twerges
Browse files Browse the repository at this point in the history
  • Loading branch information
twerges committed Mar 18, 2011
2 parents 1f5066d + e8ba481 commit b8c3654
Show file tree
Hide file tree
Showing 32 changed files with 547 additions and 346 deletions.
353 changes: 165 additions & 188 deletions clc/.classpath

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion clc/Makefile
Expand Up @@ -9,6 +9,7 @@ web_prop_dir = ${TOP}/clc/modules/www/conf
.PHONY: all build update_properties update_theme deps extras install

all: deps build
test: deps build-test

deps:
@$(ANT) deps
Expand Down Expand Up @@ -71,6 +72,20 @@ build-test: deps extras
@make -C modules/storage-san/native
@make -C modules/bootstrap

build-test: deps extras
@# we need JAVA_HOME
@if test -z "${JAVA_HOME}" ; then \
echo "You need to define JAVA_HOME!"; exit 1; fi
# this causes problems for pbuilder, should be handled by configure and build.xml already
# @if test ! -e deps/cloud-lib.tar.gz; then \
# echo "Cannot find java deps, please run 'make deps' in the 'clc/' subdirectory."; exit 1; fi
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) build-test-all
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) generate-bind
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) compile-bind
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) jar
@make -C modules/storage-controller/native
@make -C modules/bootstrap

clean:
$(ANT) clean
make -C modules/bootstrap clean
Expand All @@ -83,8 +98,13 @@ distclean: clean
make -C modules/storage-controller/native distclean
make -C modules/storage-san/native distclean

install-test: build-test
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) install
@make -C modules/storage-controller/native install
@make -C modules/bootstrap install

install: build
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=256m" $(ANT) install
@ANT_OPTS="-Xmx1g -XX:MaxPermSize=512m" $(ANT) install
@make -C modules/storage-controller/native install
@make -C modules/storage-san/native install
@make -C modules/bootstrap install
Expand Down
98 changes: 50 additions & 48 deletions clc/build.xml
Expand Up @@ -94,56 +94,58 @@
<ant dir="." inheritall="false" target="build-nowww" />
<ant dir="." inheritall="false" target="build-www" />
</target>
<target name="build-nowww">
<ant dir="modules/msgs" inheritall="false" target="builder" />
<ant dir="modules/euare-common" inheritall="false" target="builder" />
<ant dir="modules/mysql" inheritall="false" target="builder" />
<ant dir="modules/authentication" inheritall="false" target="builder" />
<ant dir="modules/configuration" inheritall="false" target="builder" />
<ant dir="modules/core" inheritall="false" target="builder" />
<ant dir="modules/wsstack" inheritall="false" target="builder" />
<ant dir="modules/euare" inheritall="false" target="builder" />
<ant dir="modules/component" inheritall="false" target="builder" />
<ant dir="modules/cloud" inheritall="false" target="builder" />
<ant dir="modules/cluster-manager" inheritall="false" target="builder" />
<ant dir="modules/notifications" inheritall="false" target="builder" />
<ant dir="modules/storage-common" inheritall="false" target="builder" />
<ant dir="modules/walrus" inheritall="false" target="builder" />
<ant dir="modules/storage-controller" inheritall="false" target="builder" />
<ant dir="modules/storage-san" inheritall="false" target="builder" />
<ant dir="modules/dns" inheritall="false" target="builder" />
<ant dir="modules/vmware-broker" inheritall="false" target="builder" />
<ant dir="modules/reporting" inheritall="false" target="builder" />
</target>
<target name="build-www">
<ant dir="modules/www" inheritall="false" target="builder" />
</target>
<target name="build-nowww">
<ant dir="modules/msgs" inheritall="false" target="builder" />
<ant dir="modules/euare-common" inheritall="false" target="builder" />
<ant dir="modules/mysql" inheritall="false" target="builder" />
<ant dir="modules/authentication" inheritall="false" target="builder" />
<ant dir="modules/configuration" inheritall="false" target="builder" />
<ant dir="modules/core" inheritall="false" target="builder" />
<ant dir="modules/wsstack" inheritall="false" target="builder" />
<ant dir="modules/euare" inheritall="false" target="builder" />
<ant dir="modules/component" inheritall="false" target="builder" />
<ant dir="modules/cloud" inheritall="false" target="builder" />
<ant dir="modules/cluster-manager" inheritall="false" target="builder" />
<ant dir="modules/notifications" inheritall="false" target="builder" />
<ant dir="modules/storage-common" inheritall="false" target="builder" />
<ant dir="modules/walrus" inheritall="false" target="builder" />
<ant dir="modules/storage-controller" inheritall="false" target="builder" />
<ant dir="modules/dns" inheritall="false" target="builder" />
<ant dir="modules/vmware-broker" inheritall="false" target="builder" />
<ant dir="modules/reporting" inheritall="false" target="builder" />
</target>
<target name="build-www">
<ant dir="modules/www" inheritall="false" target="builder" />
</target>
<target name="build-test">
<ant dir="." inheritall="false" target="build-test-nowww" />
<ant dir="." inheritall="false" target="build-test-www" />
<ant dir="." inheritall="false" target="build-test-all" />
<ant dir="." inheritall="false" target="jar" />
</target>
<target name="build-test-all">
<ant dir="." inheritall="false" target="build-test-nogwt" />
<ant dir="." inheritall="false" target="build-test-gwt" />
</target>
<target name="build-test-nowww">
<ant dir="modules/msgs" inheritall="false" target="builder-test" />
<ant dir="modules/euare-common" inheritall="false" target="builder-test" />
<ant dir="modules/mysql" inheritall="false" target="builder-test" />
<ant dir="modules/authentication" inheritall="false" target="builder-test" />
<ant dir="modules/configuration" inheritall="false" target="builder-test" />
<ant dir="modules/core" inheritall="false" target="builder-test" />
<ant dir="modules/wsstack" inheritall="false" target="builder-test" />
<ant dir="modules/euare" inheritall="false" target="builder-test" />
<ant dir="modules/component" inheritall="false" target="builder-test" />
<ant dir="modules/cloud" inheritall="false" target="builder-test" />
<target name="build-test-nogwt">
<ant dir="modules/msgs" inheritall="false" target="builder-test" />
<ant dir="modules/mysql" inheritall="false" target="builder-test" />
<ant dir="modules/authentication" inheritall="false" target="builder-test" />
<ant dir="modules/configuration" inheritall="false" target="builder-test" />
<ant dir="modules/core" inheritall="false" target="builder-test" />
<ant dir="modules/wsstack" inheritall="false" target="builder-test" />
<ant dir="modules/component" inheritall="false" target="builder-test" />
<ant dir="modules/cloud" inheritall="false" target="builder-test" />
<ant dir="modules/reporting" inheritall="false" target="builder-test" />
<ant dir="modules/cluster-manager" inheritall="false" target="builder-test" />
<ant dir="modules/notifications" inheritall="false" target="builder-test" />
<ant dir="modules/storage-common" inheritall="false" target="builder-test" />
<ant dir="modules/walrus" inheritall="false" target="builder-test" />
<ant dir="modules/storage-controller" inheritall="false" target="builder-test" />
<ant dir="modules/storage-san" inheritall="false" target="builder-test" />
<ant dir="modules/dns" inheritall="false" target="builder-test" />
<ant dir="modules/vmware-broker" inheritall="false" target="builder-test" />
<ant dir="modules/reporting" inheritall="false" target="builder-test" />
</target>
<target name="build-test-www">
<ant dir="modules/storage-common" inheritall="false" target="builder-test" />
<ant dir="modules/walrus" inheritall="false" target="builder-test" />
<ant dir="modules/storage-controller" inheritall="false" target="builder-test" />
<ant dir="modules/dns" inheritall="false" target="builder-test" />
<ant dir="modules/www" inheritall="false" target="builder-test" />
<ant dir="modules/vmware-broker" inheritall="false" target="builder-test" />
<ant dir="modules/reporting" inheritall="false" target="builder-test" />
</target>
<target name="build-test-gwt">
<ant dir="modules/www" inheritall="false" target="builder-test" />
</target>
<target name="jar" depends="build-bind">
Expand Down Expand Up @@ -190,9 +192,9 @@
<include name="**/*.jar" />
</fileset>
</path>
<delete>
<!--delete>
<fileset dir="modules" includes="**/*JiBX*" />
</delete>
</delete-->
<delete file="modules/msgs/src/main/resources/msgs-binding.xml" />
<taskdef name="generate-bindings" classname="com.eucalyptus.binding.BuildBindings" classpathref="bindingclasspath" />
<generate-bindings>
Expand Down
Expand Up @@ -191,8 +191,8 @@ static void setupSystemProperties( ) {
newLibDir = getAndCheckLibDirectory( eucaHome );
}

public static void setupConfigurations( ) {
ServiceJarDiscovery.runDiscovery( new ComponentDiscovery( ) );
static void setupConfigurations( ) {
ServiceJarDiscovery.doSingleDiscovery( new ComponentDiscovery( ) );
}

private static File getAndCheckLibDirectory( String eucaHome ) {
Expand Down
16 changes: 16 additions & 0 deletions clc/modules/module-inc.xml
Expand Up @@ -182,6 +182,22 @@
<javac target="1.5" debug="true" />
</groovyc>
</target>
<target name="builder-test">
<condition property="builder.target" value="build-${builder.suffix}" else="build-java">
<isset property="builder.suffix" />
</condition>
<echo message="[BUILDER] ${builder.target} for ${ant.project.name}" />
<uptodate property="build.notRequired" targetfile="${jar.file}">
<srcfiles dir="${src.dir}" includes="**/*" />
<srcfiles dir="${test.dir}" includes="**/*" />
</uptodate>
<echo message="[COMPILE] ${builder.target} for ${ant.project.name}" />
<antcall target="${builder.target}" inheritall="true" inheritrefs="true" />
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="classpath" />
<groovyc srcdir="${test.dir}" classpathref="classpath" sourcepathref="srcpath" destdir="${build.dir}" verbose="true" listfiles="true">
<javac target="1.5" debug="true" />
</groovyc>
</target>
<!--================================== jar target ==================================-->
<target name="jar">
<mkdir dir="${target.dir}" />
Expand Down
Expand Up @@ -84,6 +84,23 @@ private static void doDiscovery( ) {
ServiceJarDiscovery.runDiscovery( );
}

public static void doSingleDiscovery( ServiceJarDiscovery s ) {
File libDir = new File( BaseDirectory.LIB.toString( ) );
for ( File f : libDir.listFiles( ) ) {
if ( f.getName( ).startsWith( "eucalyptus" ) && f.getName( ).endsWith( ".jar" )
&& !f.getName( ).matches( ".*-ext-.*" ) ) {
LOG.debug( "Found eucalyptus component jar: " + f.getName( ) );
try {
ServiceJarDiscovery.processFile( f );
} catch ( Throwable e ) {
LOG.error( e.getMessage( ) );
continue;
}
}
}
ServiceJarDiscovery.runDiscovery( s );
}

public static void checkUniqueness( Class c ) {
if ( classList.get( c ).size( ) > 1 ) {

Expand Down
Expand Up @@ -131,14 +131,31 @@ public boolean init( ) throws Exception {
System.setProperty( "euca.log.exhaustive.user", "TRACE" );
System.setProperty( "euca.log.exhaustive.user", "TRACE" );
}

/* This is a workaround for log4j brain damage which prevented the
* ActiveMQ broker from working properly.
*/
try {
//GroovyUtil.eval("com.eucalyptus.reporting.queue.QueueBroker.getInstance().startup()");
LOG.info("Groovy eval of queue factory startup succeeded.");
} catch (Exception ex) {
LOG.error("Groovy eval of queue factory startup failed.", ex);
}


System.setOut( new PrintStream( System.out ) {
public void print( final String string ) {
if ( string.replaceAll( "\\s*", "" ).length( ) > 2 ) {
LOG.info( SystemBootstrapper.class + " " + EventType.STDOUT + " " + string );
}
}
}



);


System.setErr( new PrintStream( System.err ) {
public void print( final String string ) {
if ( string.replaceAll( "\\s*", "" ).length( ) > 2 ) {
Expand All @@ -147,6 +164,7 @@ public void print( final String string ) {
}
}
);

LOG.info( LogUtil.subheader( "Starting system with debugging set as: " + Join.join( "\n", LogLevels.class.getDeclaredFields( ) ) ) );
try {
Logger.getLogger( "com.eucalyptus.entities.EntityWrapper" ).fatal( "Starting up" );
Expand Down
Expand Up @@ -76,11 +76,15 @@ public boolean processClass( Class candidate ) throws Throwable {
if ( ComponentId.class.isAssignableFrom( candidate ) && !Modifier.isAbstract( candidate.getModifiers( ) )
&& !Modifier.isInterface( candidate.getModifiers( ) ) && !Any.class.equals( candidate ) ) {
try {
LOG.info( "Found ComponentId of type: " + candidate.getCanonicalName() );
ComponentId id = ( ComponentId ) candidate.newInstance( );
ComponentIds.register( id );
LOG.info( "-> Registering ComponentId of type: " + candidate.getCanonicalName() );
Components.create( id );

} catch ( Throwable ex ) {
LOG.error( ex, ex );
LOG.info( "Error occurred while trying to register ComponentId of type: " + ex.getMessage(), ex );
}
return true;
} else {
Expand Down
Expand Up @@ -83,6 +83,7 @@ public enum SubDirectory {
UPGRADE( BaseDirectory.CONF, "upgrade" ),
REPORTS( BaseDirectory.CONF, "reports" ),
CONF( BaseDirectory.CONF, "conf" ),
QUEUE( BaseDirectory.VAR, "queue" ),
LIB( BaseDirectory.HOME, "/usr/share/eucalyptus" );
private static Logger LOG = Logger.getLogger( SubDirectory.class );
BaseDirectory parent;
Expand Down
Expand Up @@ -29,6 +29,13 @@
import com.eucalyptus.reporting.storage.StorageDisplayDb;
import com.eucalyptus.reporting.units.Units;

/**
* <p>GenerateReport is a command-line tool for rapid testing which uses
* jasper reports internally. It takes command-line args from the
* <pre>runTest.sh</pre> mechanism and writes a resultant report to a file.
*
* @author tom.werges
*/
public class GenerateReport
{
public static enum Format
Expand Down Expand Up @@ -62,6 +69,8 @@ public String getFileExtension()

}

/* Expects jrxml files to be in /tmp and writes results there.
*/
private static File baseDir = new File("/tmp/");
private static File storageReportFile = new File(baseDir, "storage.jrxml");
private static File nestedStorageReportFile = new File(baseDir, "nested_storage.jrxml");
Expand Down
@@ -1,14 +1,14 @@
package com.eucalyptus.reporting;

import java.util.Timer;
import java.util.TimerTask;
import java.util.*;

import org.apache.log4j.*;

import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.Bootstrapper;
import com.eucalyptus.bootstrap.Provides;
import com.eucalyptus.bootstrap.RunDuring;
import com.eucalyptus.component.*;
import com.eucalyptus.component.id.Reporting;
import com.eucalyptus.reporting.instance.*;
import com.eucalyptus.reporting.storage.*;
Expand All @@ -32,6 +32,7 @@ public class ReportingBootstrapper

public ReportingBootstrapper()
{
this.instanceListener = null;
}

@Override
Expand Down Expand Up @@ -75,12 +76,15 @@ public boolean load()
public boolean start()
{
try {
//TODO: brokers must FIND EACH OTHER here...


/* Start queue broker
*/
QueueBroker.getInstance().startup();
log.info("Queue broker started");

queueFactory = QueueFactory.getInstance();
//QueueFactory has been started in SystemBootstrapper.init()
queueFactory.startup();

/* Start storage receiver and storage queue poller thread
*/
Expand All @@ -101,7 +105,12 @@ public void run()
*/
QueueReceiver instanceReceiver =
queueFactory.getReceiver(QueueIdentifier.INSTANCE);
instanceListener = new InstanceEventListener();
if (instanceListener == null) {
instanceListener = new InstanceEventListener();
log.info("New instance listener instantiated");
} else {
log.info("Used existing instance listener");
}
instanceReceiver.addEventListener(instanceListener);

log.info("ReportingBootstrapper started");
Expand Down Expand Up @@ -142,4 +151,10 @@ public boolean stop()
}
}

public void setOverriddenInstanceEventListener(
InstanceEventListener overriddenListener)
{
this.instanceListener = overriddenListener;
}

}
Expand Up @@ -97,5 +97,10 @@ public Long getDiskIoSize()
return UnitUtil.convertSize(summary.getDiskIoMegs(),
INTERNAL_UNITS.getSizeUnit(), units.getSizeUnit());
}

public Units getUnits()
{
return units;
}

}

0 comments on commit b8c3654

Please sign in to comment.