Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics around the creation of the VM model
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 15 Feb 2023 23:26:24 +0000 (00:26 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 15 Feb 2023 23:28:06 +0000 (00:28 +0100)
src/kernel/resource/VirtualMachineImpl.cpp
src/kernel/routing/NetZoneImpl.cpp
src/surf/surf_interface.hpp

index 8a3365a..5bff857 100644 (file)
@@ -19,8 +19,9 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_vm, ker_resource, "Virtual Machines, containing actors and mobile across hosts");
 
-void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model)
+void surf_vm_model_init_HL13()
 {
+  auto* cpu_pm_model = simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get();
   auto vm_model = std::make_shared<simgrid::kernel::resource::VMModel>("VM_HL13");
   auto* engine  = simgrid::kernel::EngineImpl::get_instance();
 
index 404709e..57db71f 100644 (file)
@@ -24,18 +24,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_platform, kernel, "Kernel platform-related i
 
 namespace simgrid::kernel::routing {
 
-/* Pick the right models for CPU, net and host, and call their model_init_preparse */
-static void surf_config_models_setup()
-{
-  simgrid_host_models().init_from_flag_value();
-
-  XBT_DEBUG("Call vm_model_init");
-  /* TODO: ideally we should get back the pointer to CpuModel from init(), but this
-   * requires changing the declaration of the ModuleGroup returned by simgrid_cpu_models() */
-  surf_vm_model_init_HL13(
-      simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get());
-}
-
 xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                  kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
                  std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
@@ -60,7 +48,8 @@ NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
      * (FIXME: check it out by creating a file beginning with one of these tags)
      * but cluster and peer come down to zone creations, so putting this verification here is correct.
      */
-    surf_config_models_setup();
+    simgrid_host_models().init_from_flag_value();
+    surf_vm_model_init_HL13();
   }
 
   xbt_enforce(nullptr == engine->netpoint_by_name_or_null(get_name()),
index fc3a307..32289c3 100644 (file)
@@ -63,14 +63,7 @@ static inline int double_equals(double value1, double value2, double precision)
   return (fabs(value1 - value2) < precision);
 }
 
-/** @ingroup SURF_models
- *  @brief Initializes the VM model used in the platform
- *
- *  A VM model depends on the physical CPU model to share the resources inside the VM
- *  It will also creates the CPU model for actions running inside the VM
- *
- */
-XBT_PUBLIC void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model);
+XBT_PUBLIC void surf_vm_model_init_HL13();
 
 /* --------------------
  *  Model Descriptions