From 5740c9ef46294a43f3e2bf19c1f079c35a2055df Mon Sep 17 00:00:00 2001 From: nilabjar Date: Wed, 5 Sep 2007 22:05:36 +0000 Subject: Branch for Online Monitoring --- CIAO/DAnCE/Deployment/DAnCE_Core.mpc | 2 + .../Deployment/Deployment_NodeApplication.idl | 5 + .../Deployment_NodeApplicationManager.idl | 3 + CIAO/DAnCE/Deployment/Deployment_TargetData.idl | 4 + .../DomainApplicationManager/Reply_Handler_i.cpp | 7 + .../DomainApplicationManager/Reply_Handler_i.h | 3 + CIAO/DAnCE/NodeApplication/NodeApplication.mpc | 11 + .../DAnCE/NodeApplication/NodeApplication_Impl.cpp | 36 ++ CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h | 19 + .../NodeApplicationManager.mpc | 7 + .../NodeApplicationManager_Impl.cpp | 128 +++++- .../NodeApplicationManager_Impl.h | 11 +- CIAO/DAnCE/NodeManager/BaseMonitor.h | 4 +- CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp | 112 +++-- CIAO/DAnCE/NodeManager/CIAO_Monitor.h | 24 +- CIAO/DAnCE/NodeManager/MonitorController.cpp | 510 ++++++++++++++++----- CIAO/DAnCE/NodeManager/MonitorController.h | 139 +++++- CIAO/DAnCE/NodeManager/NodeManager.mpc | 9 + CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp | 61 ++- CIAO/DAnCE/NodeManager/NodeManager_Impl.h | 10 +- 20 files changed, 885 insertions(+), 220 deletions(-) diff --git a/CIAO/DAnCE/Deployment/DAnCE_Core.mpc b/CIAO/DAnCE/Deployment/DAnCE_Core.mpc index bb63217dd79..890b1920e85 100644 --- a/CIAO/DAnCE/Deployment/DAnCE_Core.mpc +++ b/CIAO/DAnCE/Deployment/DAnCE_Core.mpc @@ -46,6 +46,7 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client, ciao_events_b } IDL_Files { + QoS.idl Deployment_ResourceCommitmentManager.idl Deployment_TargetManager.idl CIAO_NodeApplication_CallBack.idl @@ -73,6 +74,7 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client, ciao_events_b Deployment_Packaging_DataC.cpp Deployment_PlanErrorC.cpp DeploymentC.cpp + QoSC.cpp Deployment_TargetManagerC.cpp Deployment_NodeManagerC.cpp Deployment_NodeApplicationManagerC.cpp diff --git a/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl b/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl index f80dda55369..d677ea25c21 100644 --- a/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl +++ b/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl @@ -121,6 +121,11 @@ module Deployment /// CIAO specific extension void ciao_passivate () raises (StopError); + + /// This operation starts the online QoS monitoring + /// It returns its monitoring object ... + Object monitor_qos (); + }; }; diff --git a/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl b/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl index 9fc2aa09581..0af381de2d7 100644 --- a/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl @@ -57,6 +57,9 @@ module Deployment { /// CIAO specific function to set priority /// of component, required by RACE long set_priority (in string cid , in Sched_Params params); + + /// This call turns on the monitoring of Application QoS + Object monitor_qos (in ::Deployment::DeploymentPlan plan); }; }; diff --git a/CIAO/DAnCE/Deployment/Deployment_TargetData.idl b/CIAO/DAnCE/Deployment/Deployment_TargetData.idl index 877600f93bf..b674090f4d1 100644 --- a/CIAO/DAnCE/Deployment/Deployment_TargetData.idl +++ b/CIAO/DAnCE/Deployment/Deployment_TargetData.idl @@ -7,6 +7,9 @@ #include "tao/StringSeq.pidl" #include "tao/ULongSeq.pidl" +// for QoS Monitoring +#include "QoS.idl" + module Deployment { struct Resource { @@ -31,6 +34,7 @@ module Deployment { ::CORBA::ULongSeq sharedResourceRef; ::CORBA::ULongSeq connectionRef; Resources resource; + QoSSpecifications qos_seq; }; typedef sequence < Node > Nodes; diff --git a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp index b00b5af5b7f..2ff8eea1a57 100644 --- a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp +++ b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp @@ -126,3 +126,10 @@ void Deployment_AMI_NodeApplicationManagerHandler_i::destroyApplication_excep ( // Add your implementation here } +void Deployment_AMI_NodeApplicationManagerHandler_i::monitor_qos(CORBA::Object*) +{ +} + +void Deployment_AMI_NodeApplicationManagerHandler_i::monitor_qos_excep(Messaging::ExceptionHolder*) +{ +} diff --git a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h index a3d7e5d9581..940de137bdc 100644 --- a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h +++ b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h @@ -72,6 +72,9 @@ public: virtual void destroyApplication_excep (::Messaging::ExceptionHolder *); + virtual void monitor_qos(CORBA::Object*); + + virtual void monitor_qos_excep(Messaging::ExceptionHolder*); private: ::Deployment::NodeApplication_var retn_node_app_; diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication.mpc b/CIAO/DAnCE/NodeApplication/NodeApplication.mpc index 64c4e61418e..e872250f3b8 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication.mpc +++ b/CIAO/DAnCE/NodeApplication/NodeApplication.mpc @@ -44,11 +44,22 @@ project(NA_Configurator): ciao_deployment_stub, diffservpolicy, ciao_nodeapp_con project(NodeApplicationLib): ciao_server_dnc, ciao_events_dnc, ciao_nodeapp_configurator { sharedname = CIAO_NodeApplication dynamicflags = NODEAPPLICATION_BUILD_DLL + + includes += $(CIAO_ROOT)/DAnCE/NodeManager + + + IDL_Files { + App_Monitor.idl + } + Source_Files { Configurator_Factory.cpp Container_Impl.cpp NodeApplication_Core.cpp NodeApplication_Impl.cpp + App_Monitor_Impl.cpp + App_MonitorS.cpp + App_MonitorC.cpp } } diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp index 39c773bbee3..00355a4d3fe 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -6,10 +6,15 @@ #include "DAnCE/Deployment/Deployment_EventsC.h" #include "ciaosvcs/Events/CIAO_RTEC/CIAO_RTEventC.h" +#include "App_Monitor_Impl.h" + #if !defined (__ACE_INLINE__) # include "NodeApplication_Impl.inl" #endif /* __ACE_INLINE__ */ +// had to make a global var. .. gotto to remove it +extern App_Monitor_i* app_monitor; + CIAO::NodeApplication_Impl::~NodeApplication_Impl (void) { } @@ -1205,3 +1210,34 @@ _is_publisher_es_conn (Deployment::Connection conn) else return false; } + +/// start monitoring qos ... + ::CORBA::Object_ptr +CIAO::NodeApplication_Impl::monitor_qos (void) +{ + ACE_DEBUG ((LM_DEBUG, "NA :: Within the monitor_qos\n")); + this->activate_QoS_Monitor (); + + Onl_Monitor::App_Monitor_var appV = + Onl_Monitor::App_Monitor::_duplicate (this->app_monitorV_); + + return appV._retn (); +} + + +int +CIAO::NodeApplication_Impl:: +activate_QoS_Monitor () +{ + //create the servant and the object for the app monitor ... + + app_monitor_ = new App_Monitor_i (); + + app_monitorV_ = app_monitor_->_this (); + + // set the global variable ... + app_monitor = app_monitor_; + + return 0; +} + diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h index 70d5c1ee0fd..2b4a2d37b03 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h @@ -36,6 +36,8 @@ #include "NodeApp_Configurator.h" #include "Session_Container.h" +#include "App_MonitorC.h" + using CIAO::Utility::write_IOR; /** @@ -57,6 +59,9 @@ using CIAO::Utility::write_IOR; * prootections. **/ +class App_Monitor_i; + + namespace CIAO { // @@ Gan, as we discussed before can you please wrap this @@ -231,6 +236,9 @@ namespace CIAO virtual ACE_CString * create_connection_key (const Deployment::Connection & connection); + /// start monitoring qos ... + virtual ::CORBA::Object_ptr monitor_qos (void); + /// To build a map between a component instance and its container typedef ACE_Hash_Map_Manager_Exprocess_ids_.insert (process_id); + for (unsigned int i=0;i < plan_.instance.length ();i++) { if (CIAO::debug_level () > 10) @@ -997,7 +1005,7 @@ push_component_info (pid_t process_id) comp.cid_seq_.insert (plan_.instance[i].name.in ()); } - comp.process_id_ = process_id; + comp.process_ids_ = this->process_ids_; node_manager_->push_component_id_info (comp); } @@ -1107,4 +1115,122 @@ create_node_application (const ACE_CString & options) CIAO::NodeApplicationManager_Impl_Base::~NodeApplicationManager_Impl_Base (void) { + +} + +::CORBA::Object_ptr +CIAO::NodeApplicationManager_Impl_Base:: +monitor_qos (const ::Deployment::DeploymentPlan & plan) +{ + + // make a call to the NA obj ptr + ::CORBA::Object_ptr obj = this->nodeapp_->monitor_qos (); + + ACE_DEBUG ((LM_DEBUG, "Inside the monitor_qos\n")); + + // insert the dyninst binary code instrusion here ..... + ACE_DEBUG ((LM_DEBUG, "The function to be modified is %s\n", + plan_.instance[0].source[0].in ())); + + ACE_CString func; + + for (int i =0;i < plan_.instance.length ();i++) + { + func = plan_.instance[i].source[0].in (); + if (func.length () > 0) + break; + } + + + ACE_DEBUG ((LM_DEBUG, "Using DynInst\n")); + + if (func.length () == 0) + return obj; + + BPatch bpatch; + + // Attach to the program + BPatch_process *appThread = + bpatch.processAttach (this->nodeapp_command_op_.in (), this->process_id_); + + // Read the program's image and get an associated image object + BPatch_image *appImage = appThread->getImage(); + + ACE_DEBUG ((LM_DEBUG, "After getImage\n")); + + ////// Insert your function calls in to the program .... + + BPatch_Vector targetFuncs; + appImage->findFunction(func.c_str (), targetFuncs); + + if (targetFuncs.size () == 0) + ACE_DEBUG ((LM_DEBUG, "%s not found\n", func.c_str ())); + else + { + ACE_DEBUG ((LM_DEBUG, "\t\nTarget Func Found\n")); + + BPatch_Vector *entrypoints = + targetFuncs[0]->findPoint(BPatch_entry); + if ((*entrypoints).size() == 0) { + // fprintf(stderr, "Unable to find entry point to \"sleep.\"\n"); + ACE_DEBUG ((LM_DEBUG, "\t\nUnable to find entry point\n")); + } + + BPatch_Vector *exitpoints = + targetFuncs[0]->findPoint(BPatch_exit); + if ((*exitpoints).size() == 0) { + // fprintf(stderr, "Unable to find exit point to \"sleep.\"\n"); + ACE_DEBUG ((LM_DEBUG, "\t\nUnable to find exit point\n")); + } + + BPatch_Vector startFuncs; + appImage->findFunction("start_timing", startFuncs); + + if (startFuncs.size () == 0) + ACE_DEBUG ((LM_DEBUG, "start_timing not found\n")); + + BPatch_Vector stopFuncs; + appImage->findFunction("stop_timing", stopFuncs); + + if (stopFuncs.size () == 0) + ACE_DEBUG ((LM_DEBUG, "stop_timing not found\n")); + + // do the insertion in a batch .. that has two advantages + // 1. Will save time , since everything will be inserted at the same time + // 2. Will have rollback since everything will be rolled back , + // if something goes wrong ..... + + // appThread->beginInsertionSet (); + + BPatch_Vector startArgs; + // Create a function call snippet write(fd, parameter[1], parameter[2]) + BPatch_funcCallExpr startCall(*startFuncs[0], startArgs); + // Insert the code into the thread. + if (appThread->insertSnippet(startCall, *entrypoints) == NULL) + ACE_DEBUG ((LM_DEBUG, "\n\nInsert Snippet start WRONG \n\n")); + + BPatch_Vector stopArgs; + // Create a function call snippet write(fd, parameter[1], parameter[2]) + BPatch_funcCallExpr stopCall(*stopFuncs[0], stopArgs); + // Insert the code into the thread. + if (appThread->insertSnippet(stopCall, *exitpoints) == NULL) + ACE_DEBUG ((LM_DEBUG, "\n\nERROR in Insert Snippet in stop_timing call \n\n")); + + // if (appThread->finalizeInsertionSet (true) == 0) + // ACE_DEBUG ((LM_DEBUG, "\r\n Error in Finalize Insertion Set\n")); + + } // target_func success ... + + ACE_DEBUG ((LM_DEBUG, "\t\nContinuing Execution \n")); + + // continue execution of the mutatee + appThread->continueExecution(); + // wait for mutatee to terminate and allow Dyninst to handle events + // while (!appThread->isTerminated()) + // bpatch.waitForStatusChange(); + + ACE_DEBUG ((LM_DEBUG, "\t\nContinuing Execution\n")); + + return obj; } + diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h index d1297c2c000..a05f108317e 100644 --- a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h +++ b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h @@ -130,6 +130,9 @@ namespace CIAO const char * cid, const ::Deployment::Sched_Params & params); + virtual ::CORBA::Object_ptr monitor_qos ( + const ::Deployment::DeploymentPlan & plan); + protected: /// Destructor virtual ~NodeApplicationManager_Impl_Base (void); @@ -230,12 +233,16 @@ namespace CIAO /// Each NAM will only have one NA associated with it, /// so we have only one process associated with it. - // this is UNIX specific .... not portable - pid_t process_id_; + /// The process id set + ACE_Unbounded_Set process_ids_; /// For synchronization between multiple threads ACE_Condition waitCond_; ACE_Thread_Mutex mutex_; + + // this is UNIX specific .... not portable + pid_t process_id_; + }; diff --git a/CIAO/DAnCE/NodeManager/BaseMonitor.h b/CIAO/DAnCE/NodeManager/BaseMonitor.h index 5fe6a950908..ab8fa5da08e 100644 --- a/CIAO/DAnCE/NodeManager/BaseMonitor.h +++ b/CIAO/DAnCE/NodeManager/BaseMonitor.h @@ -17,6 +17,7 @@ namespace CIAO { + class MonitorController; class MonitorBase { @@ -32,7 +33,6 @@ namespace CIAO */ virtual int initialize_params ( ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, int interval )=0; /** @@ -52,6 +52,8 @@ namespace CIAO * @return The current Domain data */ virtual ::Deployment::Domain* get_current_data ()=0; + + virtual void set_context (MonitorController*) = 0; }; extern "C" ACE_Proper_Export_Flag CIAO::MonitorBase * diff --git a/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp b/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp index 9d9417da520..c86b3eed3b8 100644 --- a/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp +++ b/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp @@ -13,6 +13,11 @@ #include "CIAO_Monitor.h" #include "CIAO_common.h" #include "ace/OS_NS_stdio.h" +#include "ace/Log_Msg.h" +#include +#include + +using namespace std; extern "C" ACE_Proper_Export_Flag CIAO::MonitorBase * CIAO::createMonitor () { @@ -23,6 +28,11 @@ extern "C" ACE_Proper_Export_Flag CIAO::MonitorBase * CIAO::createMonitor () CIAO::CIAO_Monitor::CIAO_Monitor () { + previous_.user_cpu = 0; + previous_.user_cpu_low = 0; + previous_.system_cpu = 0; + previous_.idle_time = 0; + previous_.total_load = 0; } /// The Desctructor @@ -32,12 +42,10 @@ CIAO::CIAO_Monitor::~CIAO_Monitor () int CIAO::CIAO_Monitor::initialize_params ( ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, int interval ) { current_domain_.reset (new ::Deployment::Domain (domain)); - target_ptr_= target_manager; this->interval_=interval; return 0; @@ -62,69 +70,19 @@ int CIAO::CIAO_Monitor::stop () // current_domain_->node[0].name.in ())); } + ACE_DEBUG ((LM_DEBUG , + "CIAO_Monitor::Inside the get_current_data of[%s]\n", + current_domain_->node[0].name.in ())); + CORBA::Double current_load = 0; - long user_cpu; - long user_cpu_low; - long sys_cpu; - long idle_time; - - // get the load average value from the /proc/loadavg - - FILE *load_file = 0; - - load_file = ACE_OS::fopen ("/proc/stat", "r"); - - if (load_file == 0) - { - // load file cannot be opened .. - current_load = 0; - } - else - { - char buffer [99]; - - // read in the cpu label - fscanf (load_file, "%s", buffer); - - //read the user_cpu - fscanf (load_file, "%ld", &user_cpu); - - //read the user cpu low priority - fscanf (load_file, "%ld", &user_cpu_low); - - //read the system cpu - fscanf (load_file, "%ld", &sys_cpu); - - //read the cpu in idle time .. - fscanf (load_file, "%ld", &idle_time); - - ACE_OS::fclose (load_file); - - // Calculate the percent CPU - long const current_user_cpu = user_cpu - prev_user_cpu_; - long const total_cpu_usage = user_cpu + user_cpu_low + sys_cpu + - idle_time - prev_user_cpu_ - prev_idle_time_ - prev_sys_cpu_ - - prev_user_cpu_low_; - - current_load = (current_user_cpu * 100)/total_cpu_usage; - - // Save the current cpu values in the previous variables - - prev_user_cpu_ = user_cpu; - - prev_user_cpu_low_ = user_cpu_low; - - prev_sys_cpu_ = sys_cpu; - - prev_idle_time_ = idle_time; - - } - + current_load = calculate_load (); CORBA::Any any; any <<= current_load; + ACE_DEBUG ((LM_DEBUG, "The current load is %f\n", current_load)); + // here insert the util value, in the right position for (unsigned int i = 0; @@ -153,3 +111,39 @@ int CIAO::CIAO_Monitor::stop () return current_domain_.get (); } + +void CIAO::CIAO_Monitor::set_context (MonitorController* context) +{ + this->controller_ = context; +} + +double CIAO::CIAO_Monitor::calculate_load () +{ + ifstream res_file; + + res_file.open ("/proc/stat"); + + + string cpu; // for getting the cpu value + + res_file >> cpu; + res_file >> current_.user_cpu; + res_file >> current_.user_cpu_low; + res_file >> current_.system_cpu; + res_file >> current_.idle_time; + + current_.total_load = current_.user_cpu + current_.user_cpu_low + current_.system_cpu + current_.idle_time; + + double load = current_.total_load - previous_.total_load; + + double user_current_load = (current_.user_cpu - previous_.user_cpu)/load; + double system_current_load = (current_.system_cpu - previous_.system_cpu)/load; + double idle_load = (current_.idle_time - previous_.idle_time)/load; + + + res_file.close (); + + previous_ = current_; + + return user_current_load*100; +} diff --git a/CIAO/DAnCE/NodeManager/CIAO_Monitor.h b/CIAO/DAnCE/NodeManager/CIAO_Monitor.h index 5a134538701..8ffc41b99f8 100644 --- a/CIAO/DAnCE/NodeManager/CIAO_Monitor.h +++ b/CIAO/DAnCE/NodeManager/CIAO_Monitor.h @@ -29,6 +29,16 @@ namespace CIAO { class ReceiverThread; + + struct Load_Values + { + double user_cpu; + double user_cpu_low; + double system_cpu; + double idle_time; + double total_load; + }; + /** * @class CIAO_Monitor * @@ -52,7 +62,6 @@ namespace CIAO */ virtual int initialize_params ( ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, int interval ); /** @@ -79,10 +88,12 @@ namespace CIAO */ ::Deployment::Domain* get_current_data (); + void set_context (MonitorController*); + protected: + double calculate_load (); /// The TargetManager Object to be sent to the RSSSubscriber .. - ::Deployment::TargetManager_ptr target_ptr_; /// The interval after which update is to be returned. int interval_; @@ -101,6 +112,15 @@ namespace CIAO /// The previous idle time long prev_idle_time_; + + ///The MonitorController context + MonitorController* controller_; + + /// current load value ... + Load_Values current_; + + /// previous load value + Load_Values previous_; }; } // CIAO diff --git a/CIAO/DAnCE/NodeManager/MonitorController.cpp b/CIAO/DAnCE/NodeManager/MonitorController.cpp index 774f09a2788..51c4588e4e5 100644 --- a/CIAO/DAnCE/NodeManager/MonitorController.cpp +++ b/CIAO/DAnCE/NodeManager/MonitorController.cpp @@ -1,5 +1,4 @@ -// $Id$ - +// MonitorController.cpp,v 1.7 2006/02/02 16:32:26 wotte Exp //---------------------------------------------------------------------------------- /** * @file MonitorController.cpp @@ -12,24 +11,33 @@ */ //---------------------------------------------------------------------------------- +#include "orbsvcs/CosNamingC.h" #include "MonitorController.h" #include "BaseMonitor.h" -#include "MonitorCB.h" #include "CIAO_common.h" + #include "ace/Log_Msg.h" #include "ace/DLL.h" #include "ace/SString.h" #include "NodeManager_Impl.h" +#include "MonitorCB.h" +#include "Profile_Code.h" + + namespace CIAO { - typedef MonitorBase* (*MonitorFactory) (void); + typedef MonitorBase* (*MonitorFactory) (); /// for the CIAO monitor const char* monitor_lib_name = "ciaomonlib"; + /// na monitor lib name + const char* na_monitor_lib_name = "namonlib"; + + // The interval after which update will be sent. // This value will sent by the EM in the later implementation const int interval = 10; @@ -37,105 +45,129 @@ namespace CIAO static const char* factory_func = "createMonitor"; } -CIAO::MonitorController::MonitorController ( - ::CORBA::ORB_ptr orb, - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target, - ::CIAO::NodeManager_Impl_Base* node_mgr - ) - : target_facet_i_ (::Deployment::TargetManager::_duplicate (target)), - terminate_flag_ (0), +CIAO::MonitorController::MonitorController (CORBA::ORB_ptr orb, + const ::Deployment::Domain& domain, + ::CIAO::NodeManager_Impl_Base* node_mgr + ) + : terminate_flag_ (0), orb_ (orb), initial_domain_ (domain), node_mgr_ (node_mgr), - monitor_cpu_usage_ (false), - add_component_pid_ (true) + monitor_cpu_usage_ (0), + monitor_NA_usage_ (0), + add_component_pid_ (1) { } -int -CIAO::MonitorController::svc (void) +int CIAO::MonitorController::init () { - // @todo. Investigate whether we can't use the reactor with a timer - // eventhandler for this monitor controller, would safe us a thread - ACE_DLL dll; + ACE_DEBUG ((LM_DEBUG , "Inside the init function [%s]\n", + initial_domain_.node[0].name.in ())); - // Forming the library name. - ACE_CString lib_name = ACE_DLL_PREFIX; - lib_name += monitor_lib_name; - int retval = dll.open (lib_name.c_str ()); - if (retval != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.open"), - -1); - } + create_the_servant (); - // Cast the void* to non-pointer type first - it's not legal to - // cast a pointer-to-object directly to a pointer-to-function. - void *void_ptr = dll.symbol (factory_func); - ptrdiff_t tmp = reinterpret_cast (void_ptr); - MonitorFactory factory = reinterpret_cast (tmp); + ACE_DEBUG ((LM_DEBUG , "After the create servant function [%s]\n", + initial_domain_.node[0].name.in ())); + upload_obj_ref (); - if (factory == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - -1); - } + ACE_DEBUG ((LM_DEBUG , "After the upload obj ref function [%s]\n", + initial_domain_.node[0].name.in ())); + // Parse the intial domain and setup the options + parse_initial_domain (); + ACE_DEBUG ((LM_DEBUG , "After the parse_initial_domain function [%s]\n", + initial_domain_.node[0].name.in ())); + + // Populat and startup the monitor list + populate_monitor_list (); + ACE_DEBUG ((LM_DEBUG , "After the populate monitor list function [%s]\n", + initial_domain_.node[0].name.in ())); + + return 1; +} + +::Deployment::Domain* CIAO::MonitorController::update_data_for_TM () +{ + ACE_DEBUG ((LM_DEBUG , "The list size is %d\n", + monitor_list_.size ())); + + ::Deployment::Domain* domain = + new ::Deployment::Domain (this->initial_domain_); + + // Set the new domain resource to zero + domain->node[0].resource.length (0); +// form the monitor time file name + std::string mon_file = domain->node[0].name.in (); + mon_file += "_Tmon"; + Profile_Code prf_mon (mon_file); + + for (size_t i =0;i < monitor_list_.size ();i++) { - ACE_TRACE ((LM_DEBUG, "Inside the init call\n")); + + prf_mon.start (); - // Creating the monitor object. - monitor_.reset ((MonitorBase*) factory ()); - monitor_->initialize_params (initial_domain_, - target_facet_i_.in (), - interval); + ::Deployment::Domain *new_domain = + monitor_list_[i]->monitor_->get_current_data (); + add_resource_to_domain (*domain , *new_domain); - // Start the Monitor. - monitor_->start (orb_); - auto_ptr monitor_callback (new CIAO::MonitorCB (orb_, - target_facet_i_.in (), - interval)); + prf_mon.stop (); + } - // check if cpu needs to be monitored or not - for (unsigned int i = 0;i < initial_domain_.node[0].resource.length ();i++) - { - if (!ACE_OS::strcmp (initial_domain_.node[0].resource[i].name, "Processor")) - monitor_cpu_usage_ = true; - } + return domain; +} + +int CIAO::MonitorController::svc (void) +{ + ACE_DEBUG ((LM_DEBUG , "Inside the Node for [%s]\n", + initial_domain_.node[0].name.in ())); + + + // Parse the intial domain and setup the options + parse_initial_domain (); + + // Populat and startup the monitor list + populate_monitor_list (); // Wait for system to stabilize itself - ACE_OS::sleep (interval); + ACE_OS::sleep (interval); // The loop in which UpdateData is called while (!terminating ()) { - //ACE_DEBUG ((LM_DEBUG , "=The Terminate is %d\n", terminate_flag_)); + ACE_DEBUG ((LM_DEBUG , "The list size is %d\n", + monitor_list_.size ())); + + ::Deployment::Domain domain = this->initial_domain_; - // if monitoring of cpu is enable , monitor , else dont do - // anything - ::Deployment::Domain* domain = 0; + // Set the new domain resource to zero + domain.node[0].resource.length (0); + + + for (size_t i =0;i < monitor_list_.size ();i++) + { + + ::Deployment::Domain *new_domain = + monitor_list_[i]->monitor_->get_current_data (); + + add_resource_to_domain (domain , *new_domain); + } - if (monitor_cpu_usage_) - domain = monitor_->get_current_data (); - else - domain = &initial_domain_; // ****** add component data ******************* NodeManager_Impl_Base::Component_Ids cids = node_mgr_->get_component_detail (); +// ACE_DEBUG ((LM_DEBUG , "\nThe process id is [%d]\n", +// CORBA::Long (cids.process_id_))); + + // Here save the old resource length - int counter = domain->node[0].resource.length (); + int counter = domain.node[0].resource.length (); // if pid is already added , dont add if (add_component_pid_) @@ -143,42 +175,41 @@ CIAO::MonitorController::svc (void) // then add more resource element to the // domain structure // ACE_DEBUG ((LM_DEBUG , "Going to add CID/PID data\n")); - int new_res_size = domain->node[0].resource.length () + + int new_res_size = domain.node[0].resource.length () + cids.cid_seq_.size (); - domain->node[0].resource.length (new_res_size); + domain.node[0].resource.length (new_res_size); ACE_Unbounded_Set_Iterator iter (cids.cid_seq_); - for (iter = cids.cid_seq_.begin (); - iter != cids.cid_seq_.end (); - iter++,counter++) - { - domain->node[0].resource[counter].name = - CORBA::string_dup ("Component"); - domain->node[0].resource[counter].resourceType.length (0); - - // Have one property for now - domain->node[0].resource[counter].property.length (1); - domain->node[0].resource[counter].property[0].name = - CORBA::string_dup ((*iter).c_str ()); - domain->node[0].resource[counter].property[0].kind = - ::Deployment::Quantity; - domain->node[0].resource[counter].property[0].dynamic = - 0; - domain->node[0].resource[counter].property[0].value <<= - CORBA::Long (cids.process_id_); - - // ACE_DEBUG ((LM_DEBUG , "The process id is [%d]\n", - // CORBA::Long (cids.process_id_))); - } +// for (iter = cids.cid_seq_.begin (); +// iter != cids.cid_seq_.end (); +// iter++,counter++) +// { +// domain.node[0].resource[counter].name = +// CORBA::string_dup ("Component"); +// domain.node[0].resource[counter].resourceType.length (0); + +// // Have one property for now +// domain.node[0].resource[counter].property.length (1); +// domain.node[0].resource[counter].property[0].name = +// CORBA::string_dup ((*iter).c_str ()); +// domain.node[0].resource[counter].property[0].kind = +// ::Deployment::Quantity; +// domain.node[0].resource[counter].property[0].dynamic = +// 0; +// domain.node[0].resource[counter].property[0].value <<= +// CORBA::Long (cids.process_id_); + +// // ACE_DEBUG ((LM_DEBUG , "The process id is [%d]\n", +// // CORBA::Long (cids.process_id_))); +// } // set the add_component_pid_ to 0 - add_component_pid_ = false; + add_component_pid_ = 0; } //******add compoennt data - monitor_callback->update_data (*domain); // data will be updated in intervals of 10 secs. // in the latest version of spec , this value will @@ -187,48 +218,291 @@ CIAO::MonitorController::svc (void) } - monitor_->stop (); - } - - // here delete the monitor object before - // unloading the library - monitor_.reset (); - - // unload the library - dll.close (); - if (CIAO::debug_level () > 9) { ACE_DEBUG ((LM_DEBUG , "CIAO::Monitor::Terminating Monitor\n")); } - - return 0; + return 0; } CIAO::MonitorController::~MonitorController () { - this->terminate (); - this->wait (); + ACE_DEBUG ((LM_DEBUG , "CIAO::MonitorController::Destructor\n")); + terminate (); + wait (); } -void -CIAO::MonitorController::terminate () +void CIAO::MonitorController::terminate () { // make the terminate flag false ACE_GUARD (ACE_SYNCH_MUTEX, guard, - lock_); - - terminate_flag_ = true; + lock_ + ); + //Ace_DEBUG ((LM_DEBUG , "WITHIN TERMINATE CALL ......\n")); + terminate_flag_=1; } -bool -CIAO::MonitorController::terminating () +bool CIAO::MonitorController::terminating () { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, lock_, - 0); - + 0 + ); return terminate_flag_; } + + +void CIAO::MonitorController::parse_initial_domain () +{ + for (unsigned int i = 0; + i < initial_domain_.node[0].resource.length (); + i++) + { + // check if cpu usage to be monitored or not + if (!strcmp (initial_domain_.node[0].resource[i].name, "Processor")) + monitor_cpu_usage_ = 1; + + ACE_DEBUG ((LM_DEBUG, "Initial Domain,Resource Name %s\n", + initial_domain_.node[0].resource[i].name.in () )); + + // check if NA usage to be monitored or not + if (!strcmp (initial_domain_.node[0].resource[i].name, "NA_Monitor")) + monitor_NA_usage_ = 1; + } +} + +void CIAO::MonitorController::populate_monitor_list () +{ + + MonitorElement* monitor_elem; + if (monitor_cpu_usage_) + { + // create a MonitorElement + monitor_elem = new MonitorElement; + + // forming the library name + monitor_elem->lib_name_ = ACE_DLL_PREFIX; + monitor_elem->lib_name_ += monitor_lib_name; + + int retval + = monitor_elem->dll_.open (monitor_elem->lib_name_.c_str ()); + + ACE_DEBUG ((LM_DEBUG, "Monitor Lib name %s\n", + monitor_elem->lib_name_.c_str () )); + + if (retval != 0) + { + ACE_ERROR ((LM_ERROR,"%p","dll.open")); + return; + } + + MonitorFactory factory = + (MonitorFactory) monitor_elem->dll_.symbol (factory_func); + + if (factory == 0) + { + ACE_ERROR ((LM_ERROR,"%p","dll.symbol")); + return; + } + + // here creating the monitor object + monitor_elem->monitor_ = (MonitorBase*) factory (); + + ACE_DEBUG ((LM_DEBUG, "Inside the init call\n")); + + // get the resource specific data .. + + ::Deployment::Domain resource_domain_ = + this->create_monitor_domain ("Processor"); + + monitor_elem->monitor_->initialize_params (resource_domain_, + interval); + + monitor_elem->monitor_->set_context (this); + + monitor_list_.push_back (monitor_elem); + + ACE_DEBUG ((LM_DEBUG , "The list size is %d\n", + monitor_list_.size ())); + + } // if monitor_cpu_usage + if (monitor_NA_usage_) + { + + + // create a MonitorElement + monitor_elem = new MonitorElement; + + // forming the library name + monitor_elem->lib_name_ = ACE_DLL_PREFIX; + monitor_elem->lib_name_ += na_monitor_lib_name; + + ACE_DEBUG ((LM_DEBUG, "Inside the NA_Usage\n")); + + ACE_DEBUG ((LM_DEBUG, "NA Monitor Lib name %s\n", + monitor_elem->lib_name_.c_str () )); + int retval + = monitor_elem->dll_.open (monitor_elem->lib_name_.c_str ()); + + + if (retval != 0) + { + ACE_ERROR ((LM_ERROR,"%p","dll.open")); + return; + } + + MonitorFactory factory = + (MonitorFactory) monitor_elem->dll_.symbol (factory_func); + + if (factory == 0) + { + ACE_ERROR ((LM_ERROR,"%p","dll.symbol")); + return; + } + + + // here creating the monitor object + monitor_elem->monitor_ = (MonitorBase*) factory (); + + ACE_DEBUG ((LM_DEBUG, "Inside the NA init call\n")); + + // get the resource specific data .. + + ::Deployment::Domain resource_domain_ = + this->create_monitor_domain ("NA_Monitor"); + + + monitor_elem->monitor_->initialize_params (resource_domain_, + interval); + + + monitor_elem->monitor_->set_context (this); + + monitor_list_.push_back (monitor_elem); + + } +} + +CIAO::NodeManager_Impl_Base::Component_Ids +CIAO::MonitorController::get_component_process () +{ + return node_mgr_->get_component_detail (); +} + +::Deployment::Domain CIAO::MonitorController:: +create_monitor_domain (const char * resource) +{ + ::Deployment::Domain domain; + + domain.UUID = CORBA::string_dup (initial_domain_.UUID); + + domain.label = CORBA::string_dup (initial_domain_.label); + + domain.sharedResource = initial_domain_.sharedResource; + domain.interconnect = initial_domain_.interconnect; + domain.bridge = initial_domain_.bridge; + domain.infoProperty = initial_domain_.infoProperty; + + // set the node ... + domain.node.length (1); + + domain.node[0].name = + CORBA::string_dup (initial_domain_.node[0].name); + + domain.node[0].resource.length (1); + + + for (size_t i = 0; + i < initial_domain_.node[0].resource.length (); + i++) + { + if (!strcmp (initial_domain_.node[0].resource[i].name, resource)) + domain.node[0].resource[0] = + initial_domain_.node[0].resource[i]; + } + + return domain; +} + +void CIAO::MonitorController:: +add_resource_to_domain (::Deployment::Domain& new_domain, + ::Deployment::Domain monitored_domain) +{ + size_t current_size = new_domain.node[0].resource.length (); + + new_domain.node[0].resource.length (current_size + 1); + + // ACE_DEBUG ((LM_DEBUG , "Adding the resource \n")); + + new_domain.node[0].resource[current_size] = + monitored_domain.node[0].resource[0]; +} + +void CIAO::MonitorController::upload_obj_ref () +{ + CORBA::Object_var naming_context_object = + orb_->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming_context = + CosNaming::NamingContext::_narrow (naming_context_object.in ()); + + // check for context first + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup ("Node_Monitor"); + + try + { + naming_context->resolve (name); + } + catch (CosNaming::NamingContext::NotFound& ex) + { + ex._tao_print_exception ("MonitorController::upload_obj_ref\t\n"); + + try + { + naming_context->bind_new_context (name); + } + catch (CORBA::Exception & e) + { + ex._tao_print_exception ("MonitorController::upload_obj_ref:bind_new_context\t\n"); + return; + } + + } + + name.length (2); + + name[0].id = CORBA::string_dup ("Node_Monitor"); + name[1].id = CORBA::string_dup (initial_domain_.node[0].name.in ()); + + try + { + naming_context->bind (name, monitorv_); + } + catch (CORBA::Exception& ex) + { + ex._tao_print_exception ("MonitorController::upload_obj_ref\t\n"); + return; + } +} + +void CIAO::MonitorController::create_the_servant () +{ + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA"); + + poa_ = PortableServer::POA::_narrow (poa_object.in ()); + + monitor_i_ = new Onl_Monitor_NM_Monitor_i (this, this->node_mgr_); + + monitorv_ = monitor_i_->_this (); +} + +auto_ptr +CIAO::MonitorController::get_initial_domain () +{ + auto_ptr domain (new ::Deployment::Domain (this->initial_domain_)); + return domain; +} diff --git a/CIAO/DAnCE/NodeManager/MonitorController.h b/CIAO/DAnCE/NodeManager/MonitorController.h index 85d82c2cf3b..625c28e10fa 100644 --- a/CIAO/DAnCE/NodeManager/MonitorController.h +++ b/CIAO/DAnCE/NodeManager/MonitorController.h @@ -1,5 +1,4 @@ -// $Id$ - +// MonitorController.h,v 1.9 2006/02/06 00:49:53 wotte Exp //--------------------------------------------------------------------------------- /** * @file MonitorController.h @@ -16,15 +15,17 @@ #define MONITOR_CONTROLLER_H #include "NodeManager_svnt_export.h" -#include "DAnCE/Deployment/Deployment_BaseC.h" -#include "DAnCE/TargetManager/TargetManagerImplC.h" #include "ace/Task.h" #include "ace/Auto_Ptr.h" #include "ace/Synch_Traits.h" #include "ace/Synch.h" +#include "ace/Vector_T.h" +#include "NM_Monitor_Impl.h" + +#include "NodeManager_Impl.h" /** * @namespace CIAO @@ -38,7 +39,14 @@ namespace CIAO class MonitorBase; - class NodeManager_Impl_Base; + struct MonitorElement + { + ACE_DLL dll_; + ACE_CString lib_name_; + MonitorBase* monitor_; + }; + + /// forward declarations .. /** * @class MonitorController @@ -53,6 +61,7 @@ namespace CIAO { public: /** + * @function svc. * @brief The main function containing the * entire activity. * @@ -62,6 +71,7 @@ namespace CIAO */ int svc (void); /** + * @function terminate. * @brief The terminate function * * This function is called to terminate the @@ -72,50 +82,143 @@ namespace CIAO /// The Constructor. MonitorController (CORBA::ORB_ptr orb, - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target, + const ::Deployment::Domain& domain, ::CIAO::NodeManager_Impl_Base* node_mgr ); ~MonitorController (); + + + /** @function get_component_process + * + * @brief returns the component to process if mapping + */ + NodeManager_Impl_Base::Component_Ids + get_component_process (); + + /** @function init + * + * @brief Initiates the class with all the monitors + */ + int init (); + + /** @function update_data_for_TM + * + * @brief Updates data to the TM + */ + ::Deployment::Domain* update_data_for_TM (); + + /** @function get_this_domain + * + * @brief returns the initial domain + */ + auto_ptr get_initial_domain (); + protected: /** + * @function terminating. * @brief returns the terminating flag - * @return bool The terminating state of the thread + * @return bool The terminting state of the thread */ bool terminating (); + /** + * @function parse_initial_domain + * + * @brief It parses the initial domain + * and sets the options + * + */ + void parse_initial_domain (); + + + /** + * @function populate_monitor_list + * + * @brief populates the monitor list vector + */ + + void populate_monitor_list (); + + /** + * @function create_monitor_domain + * + * @brief Extracts the domain element specific + * to the monitor, so that it can be send + * to the monitor. + * @param const char* resource The resource name + * mentioned in the Domain.cdd file + * + */ + ::Deployment::Domain create_monitor_domain + (const char* resource); + + /** + * @function add_resource_to_domain + * + * @brief Adds new resources to the current domain + * + * @param new_domain The main domain to be return to TM + * resource The new resource to be added + * + */ + void add_resource_to_domain (::Deployment::Domain& new_domain, + ::Deployment::Domain monitored_domain); + + + /** + * @function create_the_servant + * + * @brief Creates the servant object and the obj ref + */ + void create_the_servant (); + + /** + * @function upload_obj_ref + * + * @brief Uploads the obj ref to the NameService + */ + void upload_obj_ref (); + /// The vector of pointers to monitor objects + ACE_Vector monitor_list_; + /// The monitor object auto_ptr monitor_; - /// The TargetManagerImpl object - CIAO::TargetManagerImpl_var target_impl_cmp_; - - /// The TargetManager Facet .... - Deployment::TargetManager_var target_facet_i_; /// The terminate flag_ bool terminate_flag_; - /// Thread Mutex for synchronizing call + //Thread Mutex for synchronizing call ACE_SYNCH_MUTEX lock_; - /// the ORB pointer .. - /// @todo Make this a _var + // the ORB pointer .. CORBA::ORB_ptr orb_; + /// The Poa var + PortableServer::POA_var poa_; + /// The initial domain ::Deployment::Domain initial_domain_; /// The Node Manager ::CIAO::NodeManager_Impl_Base* node_mgr_; - /// Flag tells ; what to monitor + /// flag tells ; what to monitor bool monitor_cpu_usage_; - /// To add component pid or not .. + /// flag tells ; what to monitor + bool monitor_NA_usage_; + + /// TO add component pid or not .. bool add_component_pid_; + + /// The Monitor object servant ... + Onl_Monitor_NM_Monitor_i* monitor_i_; + + /// The monitor var + Onl_Monitor::NM_Monitor_var monitorv_; }; } // CIAO diff --git a/CIAO/DAnCE/NodeManager/NodeManager.mpc b/CIAO/DAnCE/NodeManager/NodeManager.mpc index bc08d94a07b..8493745d5e3 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager.mpc +++ b/CIAO/DAnCE/NodeManager/NodeManager.mpc @@ -5,8 +5,13 @@ project(NodeManager_svnt): ciao_component_dnc, ciao_deployment_svnt, iortable, ifr_client, dance_extension_stub, ciao_server_dnc, ciao_nodeapplicationmanager, ciao_nodemanager_stub { sharedname = NodeManager dynamicflags = NODEMANAGER_SVNT_BUILD_DLL + includes += $(CIAO_ROOT)/DAnCE/Deployment $(CIAO_ROOT)/DAnCE/TM_Daemon + + idlflags = -GC + IDL_Files { + NM_Monitor.idl } Source_Files { @@ -15,6 +20,10 @@ project(NodeManager_svnt): ciao_component_dnc, ciao_deployment_svnt, iortable, i NAM_Map.cpp MonitorController.cpp MonitorCB.cpp + NM_Monitor_Impl.cpp + $(CIAO_ROOT)/DAnCE/NodeApplication/App_MonitorC.cpp + $(CIAO_ROOT)/DAnCE/TM_Daemon/Profile_Code.cpp + } } diff --git a/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp index bb8a90e5112..d9a0114d67d 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp +++ b/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp @@ -3,6 +3,7 @@ #include "NodeManager_Impl.h" #include "DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h" #include "ace/Log_Msg.h" +#include "MonitorController.h" CIAO::NodeManager_Impl_Base::NodeManager_Impl_Base (const char *name, CORBA::ORB_ptr orb, @@ -73,27 +74,21 @@ CIAO::NodeManager_Impl_Base::joinDomain (const Deployment::Domain & domain, // Here start the Monitor CIAO_TRACE("CIAO::NodeManager_Impl_Base::joinDomain"); - ::Deployment::Domain this_domain = domain; + ACE_DEBUG ((LM_DEBUG, "Inside the Join Domain\n")); + monitor_controller_.reset ( - new MonitorController (orb_.in (), - this_domain, - target, - this)); + new MonitorController (orb_.in (), + domain, + this)); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG , "Before Activate\n")); - } - // Activate the Monitor Controller to - // start the monitoring - monitor_controller_->activate (); + // monitor_controller_ = new MonitorController (orb_.in (), + // domain, + // this); + + monitor_controller_->init (); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG , "Monitor Activated\n")); - } } void @@ -580,7 +575,31 @@ validate_plan (const Deployment::DeploymentPlan &plan) void CIAO::NodeManager_Impl_Base:: push_component_id_info (Component_Ids comps) { - components_ = comps; + // Here instead of simply assigning , add the components + // to the end of the arrays .. + + ACE_Unbounded_Set_Iterator iter (comps.process_ids_); + + for (iter = comps.process_ids_.begin (); + iter != comps.process_ids_.end (); + iter++) + { + components_.process_ids_.insert_tail (*iter); + } + + // ACE_Unbounded_Set_Iterator iter (comps.cid_seq_); + + // for (iter = comps.process_ids_.begin (); + // iter != comps.process_ids_.end (); + // iter++) + // { + // components_.insert_tail (*iter); + // } + + + + // components_ = comps; + } CIAO::NodeManager_Impl_Base::Component_Ids @@ -590,6 +609,14 @@ get_component_detail () return components_; } +::CORBA::Object_ptr +CIAO::NodeManager_Impl_Base:: +get_NAM (const ACE_CString& plan_node) +{ + return this->poa_->id_to_reference (this->map_.get_nam (plan_node)); +} + + CIAO::NodeManager_Impl::~NodeManager_Impl () { } diff --git a/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/CIAO/DAnCE/NodeManager/NodeManager_Impl.h index 45edfb63899..e92bc931861 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager_Impl.h +++ b/CIAO/DAnCE/NodeManager/NodeManager_Impl.h @@ -35,13 +35,15 @@ #include "NodeManager_svnt_export.h" #include "NAM_Map.h" -#include "MonitorController.h" +//#include "MonitorController.h" #include "ace/Vector_T.h" namespace CIAO { class NodeApplicationManager_Impl_Base; + class MonitorController; + /** * @class NodeManager_Impl * @@ -134,7 +136,7 @@ namespace CIAO struct Component_Ids { ACE_Unbounded_Set cid_seq_; - pid_t process_id_; + ACE_Unbounded_Set process_ids_; }; virtual void push_component_id_info (Component_Ids comps); @@ -142,6 +144,10 @@ namespace CIAO Component_Ids get_component_detail (); + /// return the obj ref of the NAM + ::CORBA::Object_ptr get_NAM (const ACE_CString& plan_node); + + private: /// Validate the child deployment plan. In particular, we are /// trying to verify that all the component instances within this -- cgit v1.2.1