diff options
-rw-r--r-- | DAnCE/ChangeLog | 12 | ||||
-rw-r--r-- | DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp | 8 | ||||
-rw-r--r-- | DAnCE/tests/Parsing/domain.cpp | 6 | ||||
-rw-r--r-- | DAnCE/tests/Parsing/test.cpp | 9 | ||||
-rw-r--r-- | DAnCE/tools/Split_Plan/Split_Plan.cpp | 718 | ||||
-rw-r--r-- | DAnCE/tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp | 62 |
6 files changed, 415 insertions, 400 deletions
diff --git a/DAnCE/ChangeLog b/DAnCE/ChangeLog index e924828798d..2868f507739 100644 --- a/DAnCE/ChangeLog +++ b/DAnCE/ChangeLog @@ -1,9 +1,19 @@ -Wed Mar 23 18:54:04 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> +Thu Mar 24 00:21:24 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> * dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp: + * tests/Parsing/domain.cpp: + * tests/Parsing/test.cpp: * tools/Split_Plan/Split_Plan.cpp: * tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp: + Defuzzing. I fixed my laptop emacs too. + +Wed Mar 23 18:54:04 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> + + * dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp: + * tools/Split_Plan/Split_Plan.cpp: + * tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp: + Fixed scoreboard issues related to split strings on a build using wide characters. diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp index f263150cc79..2c8ed26f062 100644 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp +++ b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp @@ -825,8 +825,8 @@ namespace DAnCE ++j) { DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") + (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::start - ") ACE_TEXT ("Scheduling start for instance %C\n"), plan_.instance[*j].name.in ())); @@ -928,8 +928,8 @@ namespace DAnCE ++j) { DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") + (LM_DEBUG, DLINFO + ACE_TEXT ("LocalityManager_i::destroyApplication - ") ACE_TEXT ("Scheduling passivation for instance %C\n"), this->plan_.instance[*j].name.in ())); diff --git a/DAnCE/tests/Parsing/domain.cpp b/DAnCE/tests/Parsing/domain.cpp index b89799d2822..b32c4e6461b 100644 --- a/DAnCE/tests/Parsing/domain.cpp +++ b/DAnCE/tests/Parsing/domain.cpp @@ -42,8 +42,10 @@ int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) } catch (const DAnCE::Config_Handlers::Config_Error &ex) { - DANCE_ERROR (1, (LM_ERROR, "Caught config error while parsing XML into IDL: %C:%C\n", - ex.name_.c_str (), ex.error_.c_str ())); + DANCE_ERROR (DANCE_LOG_EMERGENCY, + (LM_ERROR, + "Caught config error while parsing XML into IDL: %C:%C\n", + ex.name_.c_str (), ex.error_.c_str ())); } catch (...) { diff --git a/DAnCE/tests/Parsing/test.cpp b/DAnCE/tests/Parsing/test.cpp index 5574aaf72db..13959cf28ab 100644 --- a/DAnCE/tests/Parsing/test.cpp +++ b/DAnCE/tests/Parsing/test.cpp @@ -47,12 +47,15 @@ int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) } catch (const DAnCE::Config_Handlers::Config_Error &ex) { - DANCE_ERROR (1, (LM_ERROR, "Caught config error while parsing XML into IDL: %C:%C\n", - ex.name_.c_str (), ex.error_.c_str ())); + DANCE_ERROR (DANCE_LOG_EMERGENCY, + (LM_ERROR, + "Caught config error while parsing XML into IDL: %C:%C\n", + ex.name_.c_str (), ex.error_.c_str ())); } catch (...) { - ACE_ERROR ((LM_ERROR, "ERROR: Unexpected exception caught while parsing plan <%C>\n", + ACE_ERROR ((LM_ERROR, + "ERROR: Unexpected exception caught while parsing plan <%C>\n", argv[1])); return 1; } diff --git a/DAnCE/tools/Split_Plan/Split_Plan.cpp b/DAnCE/tools/Split_Plan/Split_Plan.cpp index 2f482d656cd..8a91a94a765 100644 --- a/DAnCE/tools/Split_Plan/Split_Plan.cpp +++ b/DAnCE/tools/Split_Plan/Split_Plan.cpp @@ -14,383 +14,383 @@ namespace DAnCE { template <class SPLITTER, class UUIDGEN> Split_Plan<SPLITTER, UUIDGEN>::Split_Plan () - { - DANCE_TRACE ("Split_Plan::constructor"); - } + { + DANCE_TRACE ("Split_Plan::constructor"); + } template <class SPLITTER, class UUIDGEN> typename Split_Plan<SPLITTER, UUIDGEN>::TSubPlans & Split_Plan<SPLITTER, UUIDGEN>::plans () - { - DANCE_TRACE ("Split_Plan::plans"); + { + DANCE_TRACE ("Split_Plan::plans"); - return this->sub_plans_; - } + return this->sub_plans_; + } template <class SPLITTER, class UUIDGEN> void Split_Plan<SPLITTER, UUIDGEN>::split_plan ( - const Deployment::DeploymentPlan &plan, - const typename Split_Plan<SPLITTER, UUIDGEN>::TSplitFilter &filter) - { - DANCE_TRACE ("Split_Plan::split_plan"); - - TSubUUIDGen sub_uuid_gen; - TPlanSplitter plan_splitter (plan); - - // clear any bound sub plans - this->sub_plans_.unbind_all (); - - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Creating sub-plans\n"))); - - /* - * Selection phase - */ - - // Create and prepare the necessary sub-plans - for (CORBA::ULong i = 0; i < plan.instance.length(); ++i) - { - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Matching instance %C\n"), - plan.instance[i].name.in ())); - - // match instance against filter criteria - if (!plan_splitter.match_instance (i, filter)) - continue; // next instance - - // Empty sub plan and key - Deployment::DeploymentPlan sub_plan; - TSubPlanKey sub_plan_key; - - // check if instance belongs to any existing sub plan - if (!this->find_sub_plan (plan_splitter, i, sub_plan_key, sub_plan)) - { - // generic initialization of new sub plan - - // use UUID generator to generate UUID for sub plan - sub_uuid_gen.generate_sub_uuid (plan, - sub_plan, this->sub_plans_.current_size ()); - - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Initializing new sub plan %C\n"), - sub_plan.UUID.in ())); - - // setup association sequence lengths - sub_plan.implementation.length (0); - sub_plan.instance.length (0); - sub_plan.connection.length (0); - sub_plan.externalProperty.length (0); - sub_plan.dependsOn.length (0); - sub_plan.artifact.length (0); - - // @@ There is an optimization point here, - // since we really don't have to pass the entire - // CIAOServerResources into each individual child plan. - sub_plan.infoProperty = plan.infoProperty; - - // add new property referring to parent plan - Deployment::Property parent_property; - parent_property.name = CORBA::string_dup ( - "edu.vanderbilt.dre.DAnCE.ParentPlan"); - parent_property.value <<= plan.UUID.in (); - CORBA::ULong prop_idx = sub_plan.infoProperty.length (); - sub_plan.infoProperty.length (prop_idx+1); - sub_plan.infoProperty[prop_idx] = parent_property; - - // initialize locality constraints - CORBA::ULong num_localities = plan.localityConstraint.length (); - Deployment::PlanLocalities default_loc (num_localities); - default_loc.length (num_localities); - - for (CORBA::ULong i = 0; i < num_localities; ++i) - { - default_loc[i].constraint = Deployment::PlanNoConstraint; - } - - sub_plan.localityConstraint = default_loc; - - } - else - { - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Instance %C matched to sub plan %C\n"), - plan.instance[i].name.in (), - sub_plan.UUID.in ())); - } - - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Preparing sub plan %C for instance %C\n"), - sub_plan.UUID.in (), - plan.instance[i].name.in ())); - - // Prepare the sub plan for this instance - plan_splitter.prepare_sub_plan (i, sub_plan, sub_plan_key); - - // (re-)register sub plan - this->sub_plans_.bind (sub_plan_key, sub_plan); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Selection phase produced %u child plans, ") - ACE_TEXT("proceeding to copying phase\n"), - this->sub_plans_.current_size ())); - - /* - * Copying phase - */ - - // (1) Iterate over the <instance> field of the global DeploymentPlan - // structure. - // (2) Retrieve the necessary information to contruct the sub plans - // one by one. - for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) - { - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Processing instance: %C\n"), - plan.instance[i].name.in())); - - // TODO - - // Get the sub plan. - TSubPlanKey sub_plan_key; - Deployment::DeploymentPlan sub_plan; - - // find sub plan for instance (if any) - if (!this->find_sub_plan (plan_splitter, i, sub_plan_key, sub_plan)) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Instance %C excluded from selected subplans\n"), - plan.instance[i].name.in ())); - continue; - } - - // Get the instance deployment description - const Deployment::InstanceDeploymentDescription & my_instance = - plan.instance[i]; - - // Fill in the contents of the sub plan entry. - - // Append the "MonolithicDeploymentDescriptions implementation" - // field with a new "implementation", which is specified by the - // <implementationRef> field of <my_instance> entry. - Deployment::MonolithicDeploymentDescription const & my_implementation - = plan.implementation[my_instance.implementationRef]; - - CORBA::ULong index_imp = sub_plan.implementation.length (); - sub_plan.implementation.length (index_imp + 1); - sub_plan.implementation[index_imp] = my_implementation; - - // update the "ArtifactDeploymentDescriptions" <artifact> field - // of the sub plan with the artifacts referenced by the <artifactRef> - // sequence of the added implementation - - // Initialize with the correct sequence length. - CORBA::ULongSeq ulong_seq; - ulong_seq.length (my_implementation.artifactRef.length ()); - - // append the "ArtifactDeploymentDescriptions" - CORBA::ULong const impl_length = - my_implementation.artifactRef.length (); - CORBA::ULong const artifact_offset = sub_plan.artifact.length (); - - // extend <artifact> sequence to required size - sub_plan.artifact.length (artifact_offset + impl_length); - - for (CORBA::ULong iter = 0; - iter < impl_length; - iter ++) - { - CORBA::ULong artifact_ref = my_implementation.artifactRef[iter]; - - // Fill in the <artifact> field of the sub plan - sub_plan.artifact[artifact_offset + iter] = - plan.artifact[artifact_ref]; - - // Fill in the artifactRef field of the - // MonolithicDeploymentDescription - ulong_seq[iter] = artifact_offset + iter; - } - - // Change the <artifactRef> field of the added "implementation" to - // reference the artifact field of the sub plan - sub_plan.implementation[index_imp].artifactRef = ulong_seq; - - // Append the "InstanceDeploymentDescription instance" field with - // a new "instance", which is almost the same as the "instance" in - // the global plan except the <implementationRef> field. - CORBA::ULong index_ins = sub_plan.instance.length (); - sub_plan.instance.length (index_ins + 1); - sub_plan.instance[index_ins] = my_instance; - - // Update the <implementationRef> field of the "instance". - sub_plan.instance[index_ins].implementationRef = index_imp; - - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Processing connections.\n"))); - // Copy connections - for (CORBA::ULong j = 0; j < plan.connection.length (); ++j) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Connection: %C\n"), - plan.connection[j].name.in ())); - for (CORBA::ULong k = 0; - k < plan.connection[j].internalEndpoint.length (); ++k) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT("Endpoint: %C(%C)\n"), - plan.connection[j].internalEndpoint[k].portName.in (), - plan.connection[j].internalEndpoint[k].provider ? - "provider" : "client")); - - // check if connection endpoint references the instance (i) - // we're adding to the sub plan - if (i == plan.connection[j].internalEndpoint[k].instanceRef) - { - Deployment::PlanConnectionDescription * - connection_copied = 0; - - // check if we already copied this connection - // (for an earlier endpoint match) - for (CORBA::ULong m = 0; - m < sub_plan.connection.length (); ++m) - { - if (ACE_OS::strcmp (plan.connection[j].name.in (), - sub_plan.connection[m].name.in ()) == 0) - { - connection_copied = &sub_plan.connection[m]; - break; - } - } - - if (!connection_copied) - { - // Copy the connection - CORBA::ULong const index_con = - sub_plan.connection.length(); - sub_plan.connection.length (index_con + 1); - sub_plan.connection[index_con] = plan.connection[j]; - connection_copied = &sub_plan.connection[index_con]; - connection_copied->internalEndpoint.length (0); - } - - // Copy the endpoint - CORBA::ULong const index_ep = - connection_copied->internalEndpoint.length(); - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("Split_Plan::split_plan - ") - ACE_TEXT ("Copying endpoint %u into endpoint %u\n"), - k, index_ep)); - - connection_copied->internalEndpoint.length ( - index_ep + 1); - connection_copied->internalEndpoint[index_ep] = - plan.connection[j].internalEndpoint[k]; - connection_copied->internalEndpoint[index_ep].instanceRef - = index_ins; - } - } - } - - // copy any locality constraints matching the instance we're - // adding to the sub plan - for (CORBA::ULong j = 0; - j < plan.localityConstraint.length (); ++j) + const Deployment::DeploymentPlan &plan, + const typename Split_Plan<SPLITTER, UUIDGEN>::TSplitFilter &filter) + { + DANCE_TRACE ("Split_Plan::split_plan"); + + TSubUUIDGen sub_uuid_gen; + TPlanSplitter plan_splitter (plan); + + // clear any bound sub plans + this->sub_plans_.unbind_all (); + + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Creating sub-plans\n"))); + + /* + * Selection phase + */ + + // Create and prepare the necessary sub-plans + for (CORBA::ULong i = 0; i < plan.instance.length(); ++i) + { + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Matching instance %C\n"), + plan.instance[i].name.in ())); + + // match instance against filter criteria + if (!plan_splitter.match_instance (i, filter)) + continue; // next instance + + // Empty sub plan and key + Deployment::DeploymentPlan sub_plan; + TSubPlanKey sub_plan_key; + + // check if instance belongs to any existing sub plan + if (!this->find_sub_plan (plan_splitter, i, sub_plan_key, sub_plan)) + { + // generic initialization of new sub plan + + // use UUID generator to generate UUID for sub plan + sub_uuid_gen.generate_sub_uuid (plan, + sub_plan, this->sub_plans_.current_size ()); + + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Initializing new sub plan %C\n"), + sub_plan.UUID.in ())); + + // setup association sequence lengths + sub_plan.implementation.length (0); + sub_plan.instance.length (0); + sub_plan.connection.length (0); + sub_plan.externalProperty.length (0); + sub_plan.dependsOn.length (0); + sub_plan.artifact.length (0); + + // @@ There is an optimization point here, + // since we really don't have to pass the entire + // CIAOServerResources into each individual child plan. + sub_plan.infoProperty = plan.infoProperty; + + // add new property referring to parent plan + Deployment::Property parent_property; + parent_property.name = CORBA::string_dup ( + "edu.vanderbilt.dre.DAnCE.ParentPlan"); + parent_property.value <<= plan.UUID.in (); + CORBA::ULong prop_idx = sub_plan.infoProperty.length (); + sub_plan.infoProperty.length (prop_idx+1); + sub_plan.infoProperty[prop_idx] = parent_property; + + // initialize locality constraints + CORBA::ULong num_localities = plan.localityConstraint.length (); + Deployment::PlanLocalities default_loc (num_localities); + default_loc.length (num_localities); + + for (CORBA::ULong i = 0; i < num_localities; ++i) { - const Deployment::PlanLocality &loc = - plan.localityConstraint[j]; - for (CORBA::ULong k = 0; - k < loc.constrainedInstanceRef.length (); ++k) - { - // we are the same instance... - if (loc.constrainedInstanceRef[k] == i) - { - // add our new instance ref to the sub plan's - // corresponding contraint. - CORBA::ULong sub_loc_len = - sub_plan.localityConstraint[j].constrainedInstanceRef.length (); - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, - DLINFO ACE_TEXT ("Split_Plan::split_plan - ") - ACE_TEXT ("Found matching locality constraint ") - ACE_TEXT ("%u:%u,") - ACE_TEXT (" adding to %u:%u as %u\n"), - j, k, j, sub_loc_len, index_ins)); - - // set the correct constraint type - sub_plan.localityConstraint[j].constraint = - loc.constraint; - - // add instance reference to matched contraint - // thank god someone made an 18 and 20+ char - // member variable... - sub_plan.localityConstraint[j].constrainedInstanceRef.length ( - sub_loc_len + 1); - sub_plan.localityConstraint[j].constrainedInstanceRef[ - sub_loc_len] = index_ins; - } - } + default_loc[i].constraint = Deployment::PlanNoConstraint; } - // rebing updated sub plan - this->sub_plans_.rebind (sub_plan_key, sub_plan); - } + sub_plan.localityConstraint = default_loc; + + } + else + { + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Instance %C matched to sub plan %C\n"), + plan.instance[i].name.in (), + sub_plan.UUID.in ())); + } + + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Preparing sub plan %C for instance %C\n"), + sub_plan.UUID.in (), + plan.instance[i].name.in ())); + + // Prepare the sub plan for this instance + plan_splitter.prepare_sub_plan (i, sub_plan, sub_plan_key); + + // (re-)register sub plan + this->sub_plans_.bind (sub_plan_key, sub_plan); + } + + DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, + (LM_DEBUG, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Selection phase produced %u child plans, ") + ACE_TEXT("proceeding to copying phase\n"), + this->sub_plans_.current_size ())); + + /* + * Copying phase + */ + + // (1) Iterate over the <instance> field of the global DeploymentPlan + // structure. + // (2) Retrieve the necessary information to contruct the sub plans + // one by one. + for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) + { + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Processing instance: %C\n"), + plan.instance[i].name.in())); + + // TODO + + // Get the sub plan. + TSubPlanKey sub_plan_key; + Deployment::DeploymentPlan sub_plan; + + // find sub plan for instance (if any) + if (!this->find_sub_plan (plan_splitter, i, sub_plan_key, sub_plan)) + { + DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Instance %C excluded from selected subplans\n"), + plan.instance[i].name.in ())); + continue; + } + + // Get the instance deployment description + const Deployment::InstanceDeploymentDescription & my_instance = + plan.instance[i]; + + // Fill in the contents of the sub plan entry. + + // Append the "MonolithicDeploymentDescriptions implementation" + // field with a new "implementation", which is specified by the + // <implementationRef> field of <my_instance> entry. + Deployment::MonolithicDeploymentDescription const & my_implementation + = plan.implementation[my_instance.implementationRef]; + + CORBA::ULong index_imp = sub_plan.implementation.length (); + sub_plan.implementation.length (index_imp + 1); + sub_plan.implementation[index_imp] = my_implementation; + + // update the "ArtifactDeploymentDescriptions" <artifact> field + // of the sub plan with the artifacts referenced by the <artifactRef> + // sequence of the added implementation + + // Initialize with the correct sequence length. + CORBA::ULongSeq ulong_seq; + ulong_seq.length (my_implementation.artifactRef.length ()); + + // append the "ArtifactDeploymentDescriptions" + CORBA::ULong const impl_length = + my_implementation.artifactRef.length (); + CORBA::ULong const artifact_offset = sub_plan.artifact.length (); + + // extend <artifact> sequence to required size + sub_plan.artifact.length (artifact_offset + impl_length); + + for (CORBA::ULong iter = 0; + iter < impl_length; + iter ++) + { + CORBA::ULong artifact_ref = my_implementation.artifactRef[iter]; + + // Fill in the <artifact> field of the sub plan + sub_plan.artifact[artifact_offset + iter] = + plan.artifact[artifact_ref]; + + // Fill in the artifactRef field of the + // MonolithicDeploymentDescription + ulong_seq[iter] = artifact_offset + iter; + } + + // Change the <artifactRef> field of the added "implementation" to + // reference the artifact field of the sub plan + sub_plan.implementation[index_imp].artifactRef = ulong_seq; + + // Append the "InstanceDeploymentDescription instance" field with + // a new "instance", which is almost the same as the "instance" in + // the global plan except the <implementationRef> field. + CORBA::ULong index_ins = sub_plan.instance.length (); + sub_plan.instance.length (index_ins + 1); + sub_plan.instance[index_ins] = my_instance; + + // Update the <implementationRef> field of the "instance". + sub_plan.instance[index_ins].implementationRef = index_imp; + + DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Processing connections.\n"))); + // Copy connections + for (CORBA::ULong j = 0; j < plan.connection.length (); ++j) + { + DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Connection: %C\n"), + plan.connection[j].name.in ())); + for (CORBA::ULong k = 0; + k < plan.connection[j].internalEndpoint.length (); ++k) + { + DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT("Endpoint: %C(%C)\n"), + plan.connection[j].internalEndpoint[k].portName.in (), + plan.connection[j].internalEndpoint[k].provider ? + "provider" : "client")); + + // check if connection endpoint references the instance (i) + // we're adding to the sub plan + if (i == plan.connection[j].internalEndpoint[k].instanceRef) + { + Deployment::PlanConnectionDescription * + connection_copied = 0; - /* - * Finalization - */ + // check if we already copied this connection + // (for an earlier endpoint match) + for (CORBA::ULong m = 0; + m < sub_plan.connection.length (); ++m) + { + if (ACE_OS::strcmp (plan.connection[j].name.in (), + sub_plan.connection[m].name.in ()) == 0) + { + connection_copied = &sub_plan.connection[m]; + break; + } + } - // finalize all sub plans - for (TSubPlanIterator iter_plans = this->sub_plans_.begin (); - iter_plans != this->sub_plans_.end (); - ++iter_plans) - { - // get the sub plan and key for current instance - ::Deployment::DeploymentPlan& sub_plan = (*iter_plans).int_id_; - TSubPlanKey& sub_plan_key = (*iter_plans).ext_id_; + if (!connection_copied) + { + // Copy the connection + CORBA::ULong const index_con = + sub_plan.connection.length(); + sub_plan.connection.length (index_con + 1); + sub_plan.connection[index_con] = plan.connection[j]; + connection_copied = &sub_plan.connection[index_con]; + connection_copied->internalEndpoint.length (0); + } - // finalize sub plan - plan_splitter.finalize_sub_plan (sub_plan, sub_plan_key); - } - } + // Copy the endpoint + CORBA::ULong const index_ep = + connection_copied->internalEndpoint.length(); + + DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO + ACE_TEXT("Split_Plan::split_plan - ") + ACE_TEXT ("Copying endpoint %u into endpoint %u\n"), + k, index_ep)); + + connection_copied->internalEndpoint.length ( + index_ep + 1); + connection_copied->internalEndpoint[index_ep] = + plan.connection[j].internalEndpoint[k]; + connection_copied->internalEndpoint[index_ep].instanceRef + = index_ins; + } + } + } + + // copy any locality constraints matching the instance we're + // adding to the sub plan + for (CORBA::ULong j = 0; + j < plan.localityConstraint.length (); ++j) + { + const Deployment::PlanLocality &loc = + plan.localityConstraint[j]; + for (CORBA::ULong k = 0; + k < loc.constrainedInstanceRef.length (); ++k) + { + // we are the same instance... + if (loc.constrainedInstanceRef[k] == i) + { + // add our new instance ref to the sub plan's + // corresponding contraint. + CORBA::ULong sub_loc_len = + sub_plan.localityConstraint[j].constrainedInstanceRef.length (); + + DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, + (LM_TRACE, + DLINFO ACE_TEXT ("Split_Plan::split_plan - ") + ACE_TEXT ("Found matching locality constraint ") + ACE_TEXT ("%u:%u,") + ACE_TEXT (" adding to %u:%u as %u\n"), + j, k, j, sub_loc_len, index_ins)); + + // set the correct constraint type + sub_plan.localityConstraint[j].constraint = + loc.constraint; + + // add instance reference to matched contraint + // thank god someone made an 18 and 20+ char + // member variable... + sub_plan.localityConstraint[j].constrainedInstanceRef.length ( + sub_loc_len + 1); + sub_plan.localityConstraint[j].constrainedInstanceRef[ + sub_loc_len] = index_ins; + } + } + } + + // rebing updated sub plan + this->sub_plans_.rebind (sub_plan_key, sub_plan); + } + + /* + * Finalization + */ + + // finalize all sub plans + for (TSubPlanIterator iter_plans = this->sub_plans_.begin (); + iter_plans != this->sub_plans_.end (); + ++iter_plans) + { + // get the sub plan and key for current instance + ::Deployment::DeploymentPlan& sub_plan = (*iter_plans).int_id_; + TSubPlanKey& sub_plan_key = (*iter_plans).ext_id_; + + // finalize sub plan + plan_splitter.finalize_sub_plan (sub_plan, sub_plan_key); + } + } template <class SPLITTER, class UUIDGEN> bool Split_Plan<SPLITTER, UUIDGEN>::find_sub_plan ( - const TPlanSplitter &plan_splitter, - CORBA::ULong instance, - TSubPlanKey &sub_plan_key, - Deployment::DeploymentPlan &sub_plan) - { - DANCE_TRACE ("Split_Plan::find_sub_plan"); - - for (TSubPlanIterator iter_plans = this->sub_plans_.begin (); - iter_plans != this->sub_plans_.end (); - ++iter_plans) - { - if (plan_splitter.match_sub_plan (instance, (*iter_plans).ext_id_)) - { - // get the sub plan and key for current instance - sub_plan_key = (*iter_plans).ext_id_; - this->sub_plans_.unbind (sub_plan_key, sub_plan); - return true; - } - } - return false; - } + const TPlanSplitter &plan_splitter, + CORBA::ULong instance, + TSubPlanKey &sub_plan_key, + Deployment::DeploymentPlan &sub_plan) + { + DANCE_TRACE ("Split_Plan::find_sub_plan"); + + for (TSubPlanIterator iter_plans = this->sub_plans_.begin (); + iter_plans != this->sub_plans_.end (); + ++iter_plans) + { + if (plan_splitter.match_sub_plan (instance, (*iter_plans).ext_id_)) + { + // get the sub plan and key for current instance + sub_plan_key = (*iter_plans).ext_id_; + this->sub_plans_.unbind (sub_plan_key, sub_plan); + return true; + } + } + return false; + } } #endif /* DANCE_SPLIT_PLAN_CPP */ diff --git a/DAnCE/tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp b/DAnCE/tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp index 785fc74c707..c121dc89897 100644 --- a/DAnCE/tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp +++ b/DAnCE/tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp @@ -30,19 +30,19 @@ namespace DAnCE for (CORBA::ULong i = 0; i < props.length (); ++i) { DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Considering property <%C>\n"), - props[i].name.in ())); + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Considering property <%C>\n"), + props[i].name.in ())); if ((ACE_OS::strcmp (props[i].name.in (), - DAnCE::LOCALITY_NAMINGCONTEXT) == 0) || + DAnCE::LOCALITY_NAMINGCONTEXT) == 0) || (ACE_OS::strcmp (props[i].name.in (), DAnCE::INSTANCE_NC) == 0)) { DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Found property <%C>\n"), - props[i].name.in ())); + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Found property <%C>\n"), + props[i].name.in ())); CORBA::Object_var obj; @@ -59,9 +59,9 @@ namespace DAnCE if (CORBA::is_nil (obj)) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_NOTICE, DLINFO - ACE_TEXT ("Unable to extract an object reference from ") - ACE_TEXT ("property <%C>\n"), - props[i].name.in ())); + ACE_TEXT ("Unable to extract an object reference from ") + ACE_TEXT ("property <%C>\n"), + props[i].name.in ())); return; } @@ -73,8 +73,8 @@ namespace DAnCE if (CORBA::is_nil (ctx)) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_NOTICE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Failed to get a naming context\n"))); + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Failed to get a naming context\n"))); return; } @@ -90,23 +90,23 @@ namespace DAnCE if (CORBA::is_nil (this->shs_daemon_)) DANCE_ERROR (DANCE_LOG_ERROR, (LM_NOTICE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Unable to resolve SHS Daemon\n"))); + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Unable to resolve SHS Daemon\n"))); } catch (CORBA::Exception &ex) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_NOTICE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Unable to resolve SHS Daemon: %C\n"), - ex._info ().c_str ())); + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Unable to resolve SHS Daemon: %C\n"), + ex._info ().c_str ())); } catch (...) { DANCE_ERROR (DANCE_LOG_ERROR, - (LM_NOTICE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::configure - ") - ACE_TEXT ("Unable to resolve SHS Daemon: Unknown ") - ACE_TEXT ("C++ exception\n"))); + (LM_NOTICE, DLINFO + ACE_TEXT ("SHS_CORBA_Transport::configure - ") + ACE_TEXT ("Unable to resolve SHS Daemon: Unknown ") + ACE_TEXT ("C++ exception\n"))); } } @@ -122,25 +122,25 @@ namespace DAnCE this->shs_daemon_->update (update); } else - DANCE_DEBUG (DANCE_LOG_ERROR, - (LM_TRACE, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::push_event - ") - ACE_TEXT ("Unable to publish SHS status update, ") - ACE_TEXT (" nil daemon ref\n"))); + DANCE_DEBUG (DANCE_LOG_ERROR, + (LM_TRACE, DLINFO + ACE_TEXT ("SHS_CORBA_Transport::push_event - ") + ACE_TEXT ("Unable to publish SHS status update, ") + ACE_TEXT (" nil daemon ref\n"))); } catch (CORBA::Exception &ex) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::push_event - ") - ACE_TEXT ("Caught CORBA Exception: <%C>\n"), - ex._info ().c_str ())); + ACE_TEXT ("SHS_CORBA_Transport::push_event - ") + ACE_TEXT ("Caught CORBA Exception: <%C>\n"), + ex._info ().c_str ())); } catch (...) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("SHS_CORBA_Transport::push_event - ") - ACE_TEXT ("Caught C++ Exception\n"))); + ACE_TEXT ("SHS_CORBA_Transport::push_event - ") + ACE_TEXT ("Caught C++ Exception\n"))); } } } |