This commit is contained in:
Lucio Lelii 2010-11-09 18:58:58 +00:00
parent cda4d2f4c0
commit b59afbb4cf
16 changed files with 93 additions and 353 deletions

View File

@ -4,4 +4,8 @@ v. 1.0.0 (17-10-2008)
v. 1.2.0 (14-05-2010)
* ticket #211: ResourceManager integration
* stubs modified
* stubs modified
v. 1.3.0 (11-09-2010)
* support for cloud deployment

View File

@ -419,7 +419,8 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
<target name="jarService" depends="buildService" description="jars service implementation">
<copy todir="${build.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsd"/>
<include name="org/**/*.xsl"/>
<include name="org/**/*.xsd"/>
<include name="org/**/*.xml"/>
<include name="org/**/*.properties"/>
</fileset>

5
changelog.xml Normal file
View File

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="org.gcube.vremanagement.VREModeler.1-3-0" date="2010-11-9">
<Change>support for cloud deployment</Change>
</Changeset>
</ReleaseNotes>

View File

@ -11,7 +11,7 @@
<Main>
<Description>Allows user to create new VRE</Description>
<Name>VREModeler-service</Name>
<Version>1.2.1</Version>
<Version>1.3.0</Version>
<Dependencies>
<Dependency>
<Service>
@ -20,7 +20,7 @@
<Version>1.0.0</Version>
</Service>
<Package>VREModeler-stubs</Package>
<Version>[1.02.00,1.03.00)</Version>
<Version>[1.03.00,1.04.00)</Version>
<Scope level="GHN"/>
<Optional>false</Optional>
</Dependency>
@ -39,285 +39,13 @@
<GARArchive>org.gcube.vremanagement.vremodeler.gar</GARArchive>
<PortType>
<Name>gcube/vremanagement/vremodeler/ModelerFactoryService</Name>
<WSDL>
<definitions name="ModelerFactoryService"
targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:coretypes="http://gcube-system.org/namespaces/common/core/types"
xmlns:corefaults="http://gcube-system.org/namespaces/common/core/faults"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" >
<import namespace="http://gcube-system.org/namespaces/common/core/faults" location="../gcube/common/core/faults/GCUBEFaults.wsdl"/>
<!--============================================================
T Y P E S
============================================================-->
<types>
<xsd:schema targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://gcube-system.org/namespaces/common/core/types" schemaLocation="../gcube/common/core/types/GCUBETypes.xsd"/>
<xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="../ws/addressing/WS-Addressing.xsd" />
<!-- REQUESTS AND RESPONSES -->
<xsd:element name="createResource" type="coretypes:VOID"/>
<xsd:element name="createResourceResponse" type="wsa:EndpointReferenceType"/>
<xsd:element name="getAllVREsMessageResponse" type="xsd:string"/>
<xsd:element name="getAllVREsMessageRequest" type="coretypes:VOID"/>
<xsd:element name="initDBRequestMessage" type="coretypes:VOID"/>
<xsd:element name="initDBResponseMessage" type="coretypes:VOID"/>
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
<xsd:element name="getExistingNamesResponseMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="names" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getExistingNamesRequestMessage" type="coretypes:VOID"/>
</xsd:schema>
</types>
<!--============================================================
M E S S A G E S
============================================================-->
<message name="CreateResourceRequest">
<part name="request" element="tns:createResource"/>
</message>
<message name="CreateResourceResponse">
<part name="response" element="tns:createResourceResponse"/>
</message>
<message name="GetAllVREsRequest">
<part name="request" element="tns:getAllVREsMessageRequest"/>
</message>
<message name="GetAllVREsResponse">
<part name="response" element="tns:getAllVREsMessageResponse"/>
</message>
<message name="InitDBInputMessage">
<part name="request" element="tns:initDBRequestMessage"/>
</message>
<message name="InitDBOutputMessage">
<part name="response" element="tns:initDBResponseMessage"/>
</message>
<message name="RemoveVREInputMessage">
<part name="request" element="tns:removeVRERequestMessage"/>
</message>
<message name="RemoveVREOutputMessage">
<part name="response" element="tns:removeVREResponseMessage"/>
</message>
<message name="GetExistingNamesInputMessage">
<part name="request" element="tns:getExistingNamesRequestMessage"/>
</message>
<message name="GetExistingNamesOutputMessage">
<part name="response" element="tns:getExistingNamesResponseMessage"/>
</message>
<!--============================================================
P O R T T Y P E
============================================================-->
<portType name="ModelerFactoryPortType">
<operation name="createResource">
<input message="tns:CreateResourceRequest"/>
<output message="tns:CreateResourceResponse"/>
</operation>
<operation name="getAllVREs">
<input message="tns:GetAllVREsRequest"/>
<output message="tns:GetAllVREsResponse"/>
</operation>
<operation name="initDB">
<input message="tns:InitDBInputMessage"/>
<output message="tns:InitDBOutputMessage"/>
</operation>
<operation name="getExistingNamesVREs">
<input message="tns:GetExistingNamesInputMessage"/>
<output message="tns:GetExistingNamesOutputMessage"/>
</operation>
<operation name="removeVRE">
<input message="tns:RemoveVREInputMessage"/>
<output message="tns:RemoveVREOutputMessage"/>
</operation>
</portType>
</definitions></WSDL>
</PortType>
<PortType>
<Name>gcube/vremanagement/vremodeler/ModelerService</Name>
<WSDL>
<definitions name="ModelerFactoryService"
targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:coretypes="http://gcube-system.org/namespaces/common/core/types"
xmlns:corefaults="http://gcube-system.org/namespaces/common/core/faults"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" >
<import namespace="http://gcube-system.org/namespaces/common/core/faults" location="../gcube/common/core/faults/GCUBEFaults.wsdl"/>
<!--============================================================
T Y P E S
============================================================-->
<types>
<xsd:schema targetNamespace="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://gcube-system.org/namespaces/common/core/types" schemaLocation="../gcube/common/core/types/GCUBETypes.xsd"/>
<xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="../ws/addressing/WS-Addressing.xsd" />
<!-- REQUESTS AND RESPONSES -->
<xsd:element name="createResource" type="coretypes:VOID"/>
<xsd:element name="createResourceResponse" type="wsa:EndpointReferenceType"/>
<xsd:element name="getAllVREsMessageResponse" type="xsd:string"/>
<xsd:element name="getAllVREsMessageRequest" type="coretypes:VOID"/>
<xsd:element name="initDBRequestMessage" type="coretypes:VOID"/>
<xsd:element name="initDBResponseMessage" type="coretypes:VOID"/>
<xsd:element name="removeVRERequestMessage" type="xsd:string"/>
<xsd:element name="removeVREResponseMessage" type="coretypes:VOID"/>
<xsd:element name="getExistingNamesResponseMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="names" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getExistingNamesRequestMessage" type="coretypes:VOID"/>
</xsd:schema>
</types>
<!--============================================================
M E S S A G E S
============================================================-->
<message name="CreateResourceRequest">
<part name="request" element="tns:createResource"/>
</message>
<message name="CreateResourceResponse">
<part name="response" element="tns:createResourceResponse"/>
</message>
<message name="GetAllVREsRequest">
<part name="request" element="tns:getAllVREsMessageRequest"/>
</message>
<message name="GetAllVREsResponse">
<part name="response" element="tns:getAllVREsMessageResponse"/>
</message>
<message name="InitDBInputMessage">
<part name="request" element="tns:initDBRequestMessage"/>
</message>
<message name="InitDBOutputMessage">
<part name="response" element="tns:initDBResponseMessage"/>
</message>
<message name="RemoveVREInputMessage">
<part name="request" element="tns:removeVRERequestMessage"/>
</message>
<message name="RemoveVREOutputMessage">
<part name="response" element="tns:removeVREResponseMessage"/>
</message>
<message name="GetExistingNamesInputMessage">
<part name="request" element="tns:getExistingNamesRequestMessage"/>
</message>
<message name="GetExistingNamesOutputMessage">
<part name="response" element="tns:getExistingNamesResponseMessage"/>
</message>
<!--============================================================
P O R T T Y P E
============================================================-->
<portType name="ModelerFactoryPortType">
<operation name="createResource">
<input message="tns:CreateResourceRequest"/>
<output message="tns:CreateResourceResponse"/>
</operation>
<operation name="getAllVREs">
<input message="tns:GetAllVREsRequest"/>
<output message="tns:GetAllVREsResponse"/>
</operation>
<operation name="initDB">
<input message="tns:InitDBInputMessage"/>
<output message="tns:InitDBOutputMessage"/>
</operation>
<operation name="getExistingNamesVREs">
<input message="tns:GetExistingNamesInputMessage"/>
<output message="tns:GetExistingNamesOutputMessage"/>
</operation>
<operation name="removeVRE">
<input message="tns:RemoveVREInputMessage"/>
<output message="tns:RemoveVREOutputMessage"/>
</operation>
</portType>
</definitions></WSDL>
<WSDL></WSDL>
</PortType>
</Main>
<Software>
<Description>Allows user to create new VRE</Description>
<Name>VREModeler-stubs</Name>
<Version>1.2.1</Version>
<Version>1.3.0</Version>
<Files><File>org.gcube.vremanagement.vremodeler.stubs.jar</File></Files>
</Software>
</Packages>

View File

@ -18,6 +18,10 @@ public class CollectionConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic collectionTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","Collection"));
static{
collectionTopic.setUseRenotifier(false);
}
private GCUBEScope scope;
public CollectionConsumer(GCUBEScope scope){
@ -30,12 +34,12 @@ public class CollectionConsumer extends BaseNotificationConsumer{
logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){
logger.trace("adding a new Collection in DB");
GCUBECollection collection= GHNContext.getImplementation(GCUBECollection.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
collection.load(new StringReader(profile));
new CollectionHandler().add(collection);
} else if (operation.compareTo("destroy")==0){

View File

@ -22,6 +22,7 @@ public class GHNConsumer extends BaseNotificationConsumer{
static{
ghnTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GHN"));
ghnTopic.setPrecondition("(//operationType[text()='destroy']) or (//operationType[text()='create'])");
ghnTopic.setUseRenotifier(false);
}
private GCUBELog logger= new GCUBELog(GHNConsumer.class);
@ -40,13 +41,13 @@ public class GHNConsumer extends BaseNotificationConsumer{
logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
//logger.trace("received id: "+id+" op: "+operation+" profile: "+profile);
if (operation.compareTo("create")==0){
logger.trace("adding a new GHN in DB");
GCUBEHostingNode ghn= GHNContext.getImplementation(GCUBEHostingNode.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
ghn.load(new StringReader(profile));
new GHNHandler().add(ghn);
} else if (operation.compareTo("destroy")==0){

View File

@ -20,6 +20,10 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
public static final GCUBENotificationTopic functionalityTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","GenericResource"));
static{
functionalityTopic.setUseRenotifier(false);
}
private String functionalityResourceId;
private GCUBEScope scope;
@ -33,7 +37,6 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
try{
ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
logger.info("notification received for genericResource "+id+" and operation "+operation);
@ -41,14 +44,16 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
resource.load(new StringReader(profile));
//FunctionalityHandler
//FunctionalityHandler
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
functionalityHandler.add(resource);
}else if (operation.compareTo("create")==0){
logger.trace("notification received for generic resource with operation create");
GCUBEGenericResource genericResource= GHNContext.getImplementation(GCUBEGenericResource.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
genericResource.load(new StringReader(profile));
if (genericResource.getName().compareTo("FuctionalitiesResource")==0){
FunctionalityHandler functionalityHandler= new FunctionalityHandler();

View File

@ -18,6 +18,10 @@ public class MCollectionConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic mCollectionTopic=new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","MetadataCollection"));
static{
mCollectionTopic.setUseRenotifier(false);
}
private GCUBELog logger= new GCUBELog(MCollectionConsumer.class);
private GCUBEScope scope;
@ -32,10 +36,10 @@ public class MCollectionConsumer extends BaseNotificationConsumer{
//logger.trace("notification received");
ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){
logger.trace("adding a new MCollection in DB");
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
GCUBEMCollection mCollection= GHNContext.getImplementation(GCUBEMCollection.class);
mCollection.load(new StringReader(profile));
new MCollectionHandler(mCollection.getRelCollection().getCollectionID()).add(mCollection);

View File

@ -18,6 +18,10 @@ public class RunningInstanceConsumer extends BaseNotificationConsumer{
public static final GCUBENotificationTopic riTopic= new GCUBENotificationTopic(new QName("http://gcube-system.org/namespaces/informationsystem/registry","RunningInstance"));
static{
riTopic.setUseRenotifier(false);
}
private GCUBEScope scope;
public RunningInstanceConsumer(GCUBEScope scope){
@ -30,11 +34,11 @@ public class RunningInstanceConsumer extends BaseNotificationConsumer{
logger.trace("notification received for RI");
ServiceContext.getContext().setScope(this.scope);
String id= event.getPayload().getMessage()[0].getChildNodes().item(0).getChildNodes().item(0).getNodeValue();
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
String operation=event.getPayload().getMessage()[0].getChildNodes().item(2).getChildNodes().item(0).getNodeValue();
if (operation.compareTo("create")==0){
logger.trace("adding a new RI in DB");
GCUBERunningInstance ri= GHNContext.getImplementation(GCUBERunningInstance.class);
String profile=event.getPayload().getMessage()[0].getChildNodes().item(1).getChildNodes().item(0).getNodeValue();
ri.load(new StringReader(profile));
new RunningInstancesHandler(ri.getGHNID()).add(ri);
} else if (operation.compareTo("destroy")==0){

View File

@ -55,8 +55,7 @@ public class DBInterface {
// of the db.
// It can contain directory names relative to the
// current working directory
Connection conn = DriverManager.getConnection("jdbc:hsqldb:file:"
+ dbFile+ServiceContext.getContext().getScope().toString().replace("/", "-"), // filenames
"sa", // username

View File

@ -55,7 +55,7 @@ public class IStoDBUtil {
logger.info("Starting initialization!!");
if (!DBInterface.dbAlreadyCreated())
createTables(scope);
cleanDB(scope);
else cleanDB(scope);
}
private static void cleanDB(GCUBEScope scope) throws GCUBEFault

View File

@ -14,6 +14,7 @@ import org.gcube.vremanagement.vremodeler.consumers.GHNConsumer;
import org.gcube.vremanagement.vremodeler.consumers.GenericResourceConsumer;
import org.gcube.vremanagement.vremodeler.consumers.MCollectionConsumer;
import org.gcube.vremanagement.vremodeler.consumers.RunningInstanceConsumer;
import org.gcube.vremanagement.vremodeler.db.DBInterface;
import org.gcube.vremanagement.vremodeler.db.IStoDBUtil;
import org.gcube.vremanagement.vremodeler.impl.util.ServicePair;
import org.gcube.vremanagement.vremodeler.resources.handlers.CollectionHandler;
@ -116,6 +117,7 @@ public class ServiceContext extends GCUBEServiceContext{
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
ServiceContext.getContext().setScope(scope);
notifier.unregisterFromISNotification(this, topicToRemove, scope);
if (!scope.isInfrastructure()) DBInterface.close();
}
}

View File

@ -61,7 +61,7 @@ public class DeployGHNsOnCloud{
configureAndStartContainers(eolus, hostnames);
//waiting few seconds for GHN registration
Thread.sleep(30000);
Thread.sleep(60000);
checkGHNAvailability(hostnames);
//now we can be sure that the GHNs are registered on the IS
@ -129,6 +129,8 @@ public class DeployGHNsOnCloud{
}
}
}
//waiting 1 minute for the boot of the VMs
Thread.sleep(180000);
return vmsNames;
}

View File

@ -24,6 +24,7 @@ import org.gcube.common.core.resources.GCUBEGenericResource;
import org.gcube.common.core.resources.GCUBEMCollection;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.scope.GCUBEScope.MalformedScopeExpressionException;
import org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl;
import org.gcube.common.core.utils.handlers.GCUBEServiceHandler.NoQueryResultException;
import org.gcube.common.core.utils.logging.GCUBELog;
@ -134,6 +135,7 @@ public class DeployVRE extends Thread{
}
}else{
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().store();
logger.info("Deploying of the VRE with id "+this.resourceId+" FAILED on first step");
throw new Exception("Error Deployng the VRE filed on first step");
@ -152,7 +154,7 @@ public class DeployVRE extends Thread{
}
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
private boolean deployManagerOnVRE(String candidateGhnId) throws MalformedScopeExpressionException, Exception{
try {
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
} catch (Exception e) {
@ -163,68 +165,44 @@ public class DeployVRE extends Thread{
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
getResource().store();
ResourceManagerPortType rmPortType=getResourceMangerPT(this.startingScope);
ResourceManagerServiceHandler<Boolean, Object[]> resourceManagerHandler= new ResourceManagerServiceHandler<Boolean,Object[]>(){
String report;
try{
AddResourcesParameters arp= new AddResourcesParameters();
ServiceList services= new ServiceList();
ServiceItem[] service= new ServiceItem[1];
service[0]=new ServiceItem();
service[0].setServiceClass("VREManagement");
service[0].setServiceName("ResourceManager");
service[0].setServiceVersion("1.00.00");
services.setService(service);
@SuppressWarnings({ "static-access"})
@Override
protected Boolean makeCall(ResourceManagerPortType resourceManagerPT)
throws Exception {
String report;
try{
String vreName=(String) this.getParameter()[0];
String candidateGHN=(String) this.getParameter()[1];
AddResourcesParameters arp= new AddResourcesParameters();
ServiceList services= new ServiceList();
ServiceItem[] service= new ServiceItem[1];
service[0]=new ServiceItem();
service[0].setServiceClass("VREManagement");
service[0].setServiceName("ResourceManager");
service[0].setServiceVersion("1.00.00");
services.setService(service);
services.setGHN(new String[]{candidateGHN});
arp.setServices(services);
arp.setTargetScope(this.scope+"/"+vreName);
String reportId=resourceManagerPT.addResources(arp);
logger.trace("the report id for Rm is "+reportId);
//waiting few seconds
Thread.currentThread().sleep(60000);
int attempt=0;
do{
Thread.currentThread().sleep(20000);
report=resourceManagerPT.getReport(reportId);
attempt++;
getResource().getDeployReport().getResourceManagerDeployingReport().setResourceManagerReport(report);
getResource().store();
}while (!isDeploymentStatusFinished(report) && attempt<10);
}catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
logger.trace("report step 1: "+report);
logger.info("is something failed in the first step?"+isSomethingFailed(report));
return !isSomethingFailed(report);
}
};
resourceManagerHandler.clearBlackboard();
resourceManagerHandler.setHandled(new GCUBEServiceClientImpl());
resourceManagerHandler.setParameter(new Object[]{vreName,candidateGhnId});
resourceManagerHandler.scope=this.startingScope;
try {
resourceManagerHandler.run();
} catch (Exception e) {
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().store();
logger.error("DeployingVRE step 1 -- failed "+e);
return false;
}
services.setGHN(new String[]{candidateGhnId});
arp.setServices(services);
arp.setTargetScope(this.startingScope+"/"+vreName);
String reportId=rmPortType.addResources(arp);
logger.trace("the report id for Rm is "+reportId);
//waiting few seconds
Thread.sleep(60000);
int attempt=0;
do{
Thread.sleep(20000);
report=rmPortType.getReport(reportId);
attempt++;
getResource().getDeployReport().getResourceManagerDeployingReport().setResourceManagerReport(report);
getResource().store();
}while (!isDeploymentStatusFinished(report) && attempt<10);
}catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
logger.trace("report step 1: "+report);
logger.info("is something failed in the first step?"+isSomethingFailed(report));
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store();
return resourceManagerHandler.getReturnValue();
return !isSomethingFailed(report);
}
@ -236,7 +214,7 @@ public class DeployVRE extends Thread{
ReportFiller.initizlizeFunctionalityForReport(getResource().getDeployReport().getFunctionalityDeployingReport(),this.resourceId);
ReportFiller.initializeResourcesForReport(getResource().getDeployReport().getResourceDeployingReport(), this.resourceId);
ResourceManagerPortType rmPortType=getResourceMangerPTinVRE();
ResourceManagerPortType rmPortType=getResourceMangerPT(GCUBEScope.getScope(this.startingScope+"/"+this.vreName));
CreateScopeParameters scopeParameter=getScopeParameters();
@ -397,7 +375,7 @@ public class DeployVRE extends Thread{
return ret;
}
private ResourceManagerPortType getResourceMangerPTinVRE() throws Exception{
private ResourceManagerPortType getResourceMangerPT(GCUBEScope scope) throws Exception{
ResourceManagerPortType rmPortType = null;
int attempt=0;
do{
@ -411,25 +389,27 @@ public class DeployVRE extends Thread{
query.setExpression("declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry';" +
" for $outer in collection(\"/db/Profiles/RunningInstance\")//Document/Data/is:Profile/Resource " +
" let $scope:= $outer/Scopes/Scope[string() eq '"+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString()+"'] " +
" let $scope:= $outer/Scopes/Scope[string() eq '"+scope.toString()+"'] " +
" where count($scope)>0 " +
" and $outer/Profile/ServiceName/string() eq 'ResourceManager' " +
" and $outer/Profile/DeploymentData/Status/string() eq 'ready'"+
" return $outer");
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
for (GCUBERunningInstance instance : client.execute(query, GCUBEScope.getScope(this.startingScope+"/"+this.vreName)))
for (GCUBERunningInstance instance : client.execute(query, scope))
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/ResourceManager"));
if(eprs.size()==0) throw new NoQueryResultException();
ResourceManagerServiceAddressingLocator vmsal= new ResourceManagerServiceAddressingLocator();
logger.trace("trying to contact instance at "+eprs.get(0).getAddress());
rmPortType= vmsal.getResourceManagerPortTypePort(eprs.get(0));
rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,GCUBEScope.getScope(this.startingScope+"/"+this.vreName), Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
rmPortType = GCUBERemotePortTypeContext.getProxy(rmPortType,scope, Integer.parseInt((String)ServiceContext.getContext().getProperty("resourceManagerTimeout", true)));
}catch(Exception e){
logger.warn(e);
logger.warn("the query for resourceManager returned no result, re-trying in 30 secs ("+attempt+")");
}finally {attempt++;}
}while(rmPortType==null && attempt<10);
if (attempt>=10) throw new Exception("no ResourceMaanger can be retrieved for scope "+GCUBEScope.getScope(this.startingScope+"/"+this.vreName).toString());
if (attempt>=10) throw new Exception("no ResourceMaanger can be retrieved for scope "+scope);
return rmPortType;
}

View File

@ -25,6 +25,7 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
ISClient client= GHNContext.getImplementation(ISClient.class);
GCUBEGHNQuery query=client.getQuery(GCUBEGHNQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/GHNDescription/Type","Dynamic"));
query.addAtomicConditions(new AtomicCondition("/Profile/GHNDescription/Status","certified"));
List<GCUBEHostingNode> ghnList= client.execute(query, ServiceContext.getContext().getScope());
for (GCUBEHostingNode ghn:ghnList)
try{

View File

@ -54,7 +54,7 @@ public class ModelerTest {
vreReq.setDescription("desc");
vreReq.setDesigner("Lucio");
vreReq.setManager("Lucio");
vreReq.setName("testCloud");
vreReq.setName("lucioCloud");
msptp.setDescription(vreReq);
System.out.println("description set");