summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornilabjar <nilabjar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-12-27 20:02:14 +0000
committernilabjar <nilabjar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-12-27 20:02:14 +0000
commit6a020837a9bde4daadd0f7c9702c62774ff1544a (patch)
treeeb867629865ee74ff59a3b3e98cf6607d771976d
parent30794e08ca79ac5e767b2830cd40c0bbcdbe2ce5 (diff)
downloadATCD-6a020837a9bde4daadd0f7c9702c62774ff1544a.tar.gz
ChangeLogTag: Wed Dec 27 19:59:32 UTC 2006 Nilabja R <nilabjar@dre.vanderbilt.edu
-rw-r--r--ChangeLog14
-rw-r--r--DAnCE/TargetManager/CmpClient.cpp65
-rw-r--r--DAnCE/TargetManager/DomainDataManager.cpp118
-rw-r--r--DAnCE/TargetManager/DomainDataManager.h43
-rw-r--r--DAnCE/TargetManager/TargetManager.mpc1
-rw-r--r--DAnCE/TargetManager/TargetManager_exec.cpp38
-rw-r--r--DAnCE/TargetManager/TargetManager_exec.h14
-rw-r--r--ciao/CCM_Core.mpc2
-rw-r--r--ciao/Deployment_ResourceCommitmentManager.idl17
-rw-r--r--ciao/Deployment_TargetManager.idl3
10 files changed, 255 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e4cf58f289..563c6149855 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Wed Dec 27 19:59:32 UTC 2006 Nilabja R <nilabjar@dre.vanderbilt.edu>
+
+ * DAnCE/TargetManager/CmpClient.cpp:
+ * DAnCE/TargetManager/DomainDataManager.h:
+ * DAnCE/TargetManager/DomainDataManager.cpp:
+ * DAnCE/TargetManager/TargetManager.mpc:
+ * DAnCE/TargetManager/TargetManager_exec.h:
+ * DAnCE/TargetManager/TargetManager_exec.cpp:
+
+ * ciao/CCM_Core.mpc:
+ * ciao/Deployment_ResourceCommitmentManager.idl:
+ * ciao/Deployment_TargetManager.idl:
+ Changes made to accomodate the ResourceCommitmentManager
+
Tue Dec 5 17:44:49 UTC 2006 Nilabja R <nilabjar@dre.vanderbilt.edu>
* ciao/Deployment_TargetManager.idl:
diff --git a/DAnCE/TargetManager/CmpClient.cpp b/DAnCE/TargetManager/CmpClient.cpp
index 7e3480418a8..2e840ab1e32 100644
--- a/DAnCE/TargetManager/CmpClient.cpp
+++ b/DAnCE/TargetManager/CmpClient.cpp
@@ -68,66 +68,48 @@ int main (int argc, char* argv[])
// make a call to the commit resources .....
+ bool resource_available = true;
- Deployment::DeploymentPlan plan;
-
- plan.instance.length (2);
-
- ::Deployment::InstanceDeploymentDescription instance_;
- instance_.node = CORBA::string_dup ("foil");
- instance_.deployedResource.length (1);
- instance_.deployedResource[0].requirementName =
- CORBA::string_dup ("Processor");
- instance_.deployedResource[0].resourceName =
- CORBA::string_dup ("CPULoad");
+ ::Deployment::ResourceAllocationSeq resource_seq;
- instance_.deployedResource[0].property.length (1);
- instance_.deployedResource[0].property[0].name =
- CORBA::string_dup ("LoadAverage");
- CORBA::Long d = 20;
- instance_.deployedResource[0].property[0].value <<= d;
+ resource_seq.length (1);
- plan.instance[0] = instance_;
+ resource_seq[0].elementName = CORBA::string_dup ("TargetManagerNode_1");
- instance_.node = CORBA::string_dup ("blade30");
- instance_.deployedResource.length (1);
- instance_.deployedResource[0].requirementName =
- CORBA::string_dup ("Processor");
- instance_.deployedResource[0].resourceName =
- CORBA::string_dup ("CPULoad");
+ resource_seq[0].resourceName = CORBA::string_dup ("Processor");
- instance_.deployedResource[0].property.length (1);
- instance_.deployedResource[0].property[0].name =
+ resource_seq[0].property.length (1);
+ resource_seq[0].property[0].name =
CORBA::string_dup ("LoadAverage");
- d = 50;
- instance_.deployedResource[0].property[0].value <<= d;
-
- plan.instance[1] = instance_;
+ CORBA::Long d = 20;
+ resource_seq[0].property[0].value <<= d;
- bool resource_available = true;
+ ::Deployment::ResourceCommitmentManager_ptr manager;
try
{
// targetI->commitResources(plan);
+ manager = targetI->createResourceCommitment (resource_seq);
+
+ manager->commitResources (resource_seq);
+
ACE_DEBUG ((LM_DEBUG , "\n\ncommitResources Returned \n"));
}
catch(CORBA::NO_IMPLEMENT &)
{
cerr << "Error:TargetManager:CORBA::NO_IMPLEMENT thrown" << endl;
}
- catch (Deployment::ResourceNotAvailable & e)
+ catch (::Deployment::ResourceCommitmentFailure& e)
{
resource_available = 0;
- cout << "TargetManager commitResources ResourceNotAvailable Exception" <<endl;
+ cout << "TargetManager commitResources ResourceCommitmentFailure Exception" <<endl;
ACE_DEBUG ((LM_DEBUG ,
- "ResourceNotAvailable\n name=[%s]\n elementName=[%s]\n resourceName=[%s]\n \
- resourceType= [%s]\n propertyName=[%s]\n",
- e.name.in (),
- e.elementName.in (),
- e.resourceName.in (),
- e.resourceType.in (),
+ "ResourceCommitmentFailure\n reason=[%s]\n elementName=[%s]\n resourceName=[%s]\n propertyName=[%s]\n",
+ e.reason.in (),
+ resource_seq[e.index].elementName.in (),
+ resource_seq[e.index].resourceName.in (),
e.propertyName.in ()));
}
catch(CORBA::Exception & ex)
@@ -141,9 +123,12 @@ int main (int argc, char* argv[])
// Make a call to release resources , if resource < 0
try
{
- if (!resource_available)
+// if (!resource_available)
{
- // targetI->releaseResources(plan);
+ d = 10;
+ resource_seq[0].property[0].value <<= d;
+ //manager->releaseResources (resource_seq);
+ targetI->destroyResourceCommitment (manager);
ACE_DEBUG ((LM_DEBUG , "\n\nreleaseResources Returned \n"));
}
}
diff --git a/DAnCE/TargetManager/DomainDataManager.cpp b/DAnCE/TargetManager/DomainDataManager.cpp
index 4d3f01dde1f..575c2eaeeca 100644
--- a/DAnCE/TargetManager/DomainDataManager.cpp
+++ b/DAnCE/TargetManager/DomainDataManager.cpp
@@ -348,8 +348,8 @@ void CIAO::DomainDataManager
"TM::commitResource::Host name matched\n"));
try {
match_requirement_resource (
- plan.instance[i].deployedResource,
- temp_provisioned_data.node[j].resource);
+ plan.instance[i].deployedResource,
+ temp_provisioned_data.node[j].resource);
}
catch (::Deployment::ResourceNotAvailable& ex)
{
@@ -457,9 +457,14 @@ match_properties (
::Deployment::Properties deployed,
::Deployment::SatisfierProperties & available)
{
+ bool property_found;
+
for (CORBA::ULong i = 0;i < deployed.length ();i++)
{
+ property_found = false;
+
for (CORBA::ULong j = 0;j < available.length ();j++)
+ {
if (!ACE_OS::strcmp (deployed[i].name , available[j].name))
{
// check kind here ....and then subtract ....
@@ -472,9 +477,20 @@ match_properties (
"TM::commitResource::Property name matched\n"));
commit_release_resource (deployed[i] , available[j]);
-
+ property_found = true;
}
- }
+ } // internal for ....
+
+ // check if property was found or not
+ if (property_found == false)
+ {
+ // throw an error since property was not found in the Resource
+ ::Deployment::ResourceCommitmentFailure failure;
+
+ failure.reason = CORBA::string_dup ("Property Not Found\n");
+ failure.propertyName = CORBA::string_dup (deployed[i].name);
+ }
+ } // outside for ...
}
void CIAO::DomainDataManager::commit_release_resource (
@@ -507,14 +523,14 @@ void CIAO::DomainDataManager::commit_release_resource (
{
ACE_DEBUG ((LM_DEBUG, "Insufficient resources! Available: %d, Required %d\n",
available_d, required_d));
- throw ::Deployment::ResourceNotAvailable ("",
- "",
- deployed.name.in (),
- "",
- "");
- }
+ ::Deployment::ResourceCommitmentFailure failure;
+ failure.reason = CORBA::string_dup ("Insufficient resources!");
+ failure.propertyName = CORBA::string_dup (available.name);
+ failure.propertyValue = available.value;
+ throw failure;
+ }
}
else
{
@@ -736,3 +752,85 @@ bool CIAO::DomainDataManager::update_node_status ()
// update the node status here ...
return 0;
}
+
+int CIAO::DomainDataManager::commitResourceAllocation (
+ const ::Deployment::ResourceAllocationSeq & resources)
+{
+ // commit the resources
+ // parse into the plan and commit resources ...
+
+ // set the action value
+ current_action_ = commit;
+
+ return this->commit_release_RA (resources);
+}
+
+int CIAO::DomainDataManager::releaseResourceAllocation (
+ const ::Deployment::ResourceAllocationSeq & resources)
+{
+ // set the action value
+ current_action_ = release;
+
+ return this->commit_release_RA (resources);
+}
+
+
+int CIAO::DomainDataManager::
+commit_release_RA (const ::Deployment::ResourceAllocationSeq & resources)
+{
+ // temporary used to guard against exceptions
+ temp_provisioned_data_ = provisioned_data_;
+
+
+ for (CORBA::ULong i = 0;i < resources.length ();i++)
+ {
+ try
+ {
+ ::Deployment::Resource& res = find_resource (resources[i]);
+
+ match_properties (resources[i].property , res.property);
+ }
+ catch (::Deployment::ResourceCommitmentFailure& ex)
+ {
+ // catch the exception and add parameters
+ ACE_DEBUG ((LM_DEBUG, "Caught the Exception in releaseResourceAllocation\n"));
+ ex.index = i;
+ throw ex;
+ }
+ }
+
+ // here commit the commitresources
+ provisioned_data_ = temp_provisioned_data_;
+
+ return 0;
+}
+
+::Deployment::Resource&
+CIAO::DomainDataManager::find_resource (
+ const ::Deployment::ResourceAllocation& resource)
+{
+ // for now search the resource in the Node sequence; Later need
+ // to add it to the Bridges and Interconnects too according to the
+ // spec
+ for (CORBA::ULong j = 0;j < this->temp_provisioned_data_.node.length ();j++)
+ {
+ if (!strcmp (resource.elementName.in () ,
+ this->temp_provisioned_data_.node[j].name.in ()))
+ {
+ if (CIAO::debug_level () > 9)
+ ACE_DEBUG ((LM_DEBUG ,
+ "TM::commitResource::Element name matched\n"));
+ for (CORBA::ULong k =0;
+ k < this->temp_provisioned_data_.node[j].resource.length ();
+ k++)
+ {
+ if (!strcmp (this->temp_provisioned_data_.node[j].resource[k].name.in (),
+ resource.resourceName.in ()))
+ return this->temp_provisioned_data_.node[j].resource[k];//resource found here, return
+ }
+
+ // resource not found
+ throw ::Deployment::ResourceCommitmentFailure ().reason = CORBA::string_dup ("Resource Not Found\n");
+ }
+ }
+}
diff --git a/DAnCE/TargetManager/DomainDataManager.h b/DAnCE/TargetManager/DomainDataManager.h
index 7b12b52d226..0e43460cf5d 100644
--- a/DAnCE/TargetManager/DomainDataManager.h
+++ b/DAnCE/TargetManager/DomainDataManager.h
@@ -144,10 +144,33 @@ namespace CIAO
* @description The node manager in turn stops the monitor
*
*/
-
void stop_monitors ();
- protected:
+ /**
+ * @function commitResourceAllocation
+ *
+ * @brief The function allocates resources specified in the
+ * parameter
+ *
+ * @description This function is for the ResourceCommitmentManager
+ *
+ */
+ int commitResourceAllocation (
+ const ::Deployment::ResourceAllocationSeq & resources);
+
+ /**
+ * @function releaseResourceAllocation
+ *
+ * @brief The function releases resources specified in the
+ * parameter
+ *
+ * @description This function is for the ResourceCommitmentManager
+ *
+ */
+ int releaseResourceAllocation (
+ const ::Deployment::ResourceAllocationSeq & resources);
+
+ protected:
/**
@@ -256,6 +279,18 @@ namespace CIAO
*/
bool update_node_status ();
+ /**
+ * @function find_resource
+ * @brief It finds the Resource structure which is respresents the
+ * ResourceAllocation
+ */
+ ::Deployment::Resource& find_resource (
+ const ::Deployment::ResourceAllocation& resource);
+
+ int commit_release_RA (
+ const ::Deployment::ResourceAllocationSeq & resources);
+
+
/// The ORB pointer
CORBA::ORB_var orb_;
@@ -285,6 +320,10 @@ namespace CIAO
*/
::Deployment::Domain provisioned_data_;
+ /// temporary domain used in commit/release to
+ /// guard against exceptions
+ ::Deployment::Domain temp_provisioned_data_;
+
/// The current action
Action current_action_;
};
diff --git a/DAnCE/TargetManager/TargetManager.mpc b/DAnCE/TargetManager/TargetManager.mpc
index 11d1bd518b9..a4a03cca6a4 100644
--- a/DAnCE/TargetManager/TargetManager.mpc
+++ b/DAnCE/TargetManager/TargetManager.mpc
@@ -55,6 +55,7 @@ project(CIAO_TargetManager_exec) : ciao_component_dnc, ciao_config_handlers, cia
Source_Files {
DomainDataManager.cpp
TargetManager_exec.cpp
+ ResourceCommitmentManager.cpp
}
IDL_Files {
diff --git a/DAnCE/TargetManager/TargetManager_exec.cpp b/DAnCE/TargetManager/TargetManager_exec.cpp
index f947e1944d7..9480407f76c 100644
--- a/DAnCE/TargetManager/TargetManager_exec.cpp
+++ b/DAnCE/TargetManager/TargetManager_exec.cpp
@@ -16,6 +16,8 @@
#include "DomainEventsC.h"
+#include "ResourceCommitmentManager.h"
+
namespace CIDL_TargetManager_i
{
//==================================================================
@@ -159,6 +161,42 @@ namespace CIDL_TargetManager_i
}
+ ::Deployment::ResourceCommitmentManager_ptr
+ TargetManager_exec_i::createResourceCommitment (
+ const ::Deployment::ResourceAllocationSeq & manager
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure))
+ {
+ ACE_DEBUG ((LM_DEBUG, "Create Resource Commitment called \n\n"));
+
+ CIAO::ResourceCommitmentManager_i *commit_servant =
+ new CIAO::ResourceCommitmentManager_i ();
+
+ // Standard owner transfer mechanisms.
+ //
+ PortableServer::ServantBase_var safe_daemon (commit_servant);
+
+ commit_servant->commitResources (manager);
+
+ Deployment::ResourceCommitmentManager_var mgrv =
+ commit_servant->_this ();
+
+ ACE_DEBUG ((LM_DEBUG, "Returning from Create Resource Commitment \n\n"));
+ return mgrv._retn ();
+ }
+
+ void
+ TargetManager_exec_i::destroyResourceCommitment (
+ ::Deployment::ResourceCommitmentManager_ptr resources
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException))
+ {
+ ::Deployment::ResourceAllocationSeq res;
+ res.length (0);
+ resources->releaseResources (res);
+ return;
+ }
//==================================================================
// Facet Executor Implementation Class: TargetManagerExt_exec_i
// required for RACE
diff --git a/DAnCE/TargetManager/TargetManager_exec.h b/DAnCE/TargetManager/TargetManager_exec.h
index 7c23c047992..8e85f1b3b27 100644
--- a/DAnCE/TargetManager/TargetManager_exec.h
+++ b/DAnCE/TargetManager/TargetManager_exec.h
@@ -186,6 +186,20 @@ namespace CIDL_TargetManager_i
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Deployment::ResourceCommitmentManager_ptr
+ createResourceCommitment (
+ const ::Deployment::ResourceAllocationSeq & manager
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure));
+
+ virtual void
+ destroyResourceCommitment (
+ ::Deployment::ResourceCommitmentManager_ptr resources
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException));
+
private:
TargetManagerImpl_exec_i * _exec;
diff --git a/ciao/CCM_Core.mpc b/ciao/CCM_Core.mpc
index 1ae06805bf0..981ee2354b2 100644
--- a/ciao/CCM_Core.mpc
+++ b/ciao/CCM_Core.mpc
@@ -222,6 +222,7 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client, ciao_events_b
CIAO_NodeApplication_CallBackC.cpp
CIAO_ServerResourcesC.cpp
Deployment_EventsC.cpp
+ Deployment_ResourceCommitmentManagerC.cpp
}
}
@@ -256,6 +257,7 @@ project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype, ifr_clien
NodeApp_CB_Impl.cpp
Deployment_TargetManagerS.cpp
CIAO_NodeApplication_CallBackS.cpp
+ Deployment_ResourceCommitmentManagerS.cpp
}
}
diff --git a/ciao/Deployment_ResourceCommitmentManager.idl b/ciao/Deployment_ResourceCommitmentManager.idl
index fd13b7ae46b..0997c55dcec 100644
--- a/ciao/Deployment_ResourceCommitmentManager.idl
+++ b/ciao/Deployment_ResourceCommitmentManager.idl
@@ -1,7 +1,7 @@
#ifndef RESOURCE_COMMITMENT_MANAGER_IDL
#define RESOURCE_COMMITMENT_MANAGER_IDL
-
+#include "Deployment_Base.idl"
module Deployment {
exception ResourceCommitmentFailure {
@@ -11,22 +11,25 @@ module Deployment {
any propertyValue;
};
/**
- * @interface ResourceAllocation
+ * @struct ResourceAllocation
* @brief Identifies a resource within a domain that is
* allocated from and the amount it is allocated
*/
- interface ResourceAllocation
+ struct ResourceAllocation
{
- attribute string elementName;
- attribute string resourceName;
+ string elementName;
+ string resourceName;
+ Properties property;
};
/// The Resource Allocation Sequence
typedef sequence <ResourceAllocation> ResourceAllocationSeq;
interface ResourceCommitmentManager {
- void commitResources (in ResourceAllocationSeq resources);
- void releaseResources (in ResourceAllocationSeq resources);
+ void commitResources (in ResourceAllocationSeq resources)
+ raises (ResourceCommitmentFailure);
+ void releaseResources (in ResourceAllocationSeq resources)
+ raises (ResourceCommitmentFailure);
};
};
diff --git a/ciao/Deployment_TargetManager.idl b/ciao/Deployment_TargetManager.idl
index 6417aa22c77..b898a7b56fa 100644
--- a/ciao/Deployment_TargetManager.idl
+++ b/ciao/Deployment_TargetManager.idl
@@ -20,7 +20,8 @@ module Deployment {
interface TargetManager {
Domain getAllResources ();
Domain getAvailableResources ();
- ResourceCommitmentManager createResourceCommitment (in ResourceAllocationSeq manager);
+ ResourceCommitmentManager createResourceCommitment (in ResourceAllocationSeq manager)
+ raises (ResourceCommitmentFailure);
void destroyResourceCommitment (in ResourceCommitmentManager resources);
void updateDomain (in ::CORBA::StringSeq elements,
in Domain domainSubset,