-#include "src/mc/mc_replay.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
- "SIMIX hosts");
-
-static void SIMIX_execution_finish(smx_synchro_t synchro);
-
-/**
- * \brief Internal function to create a SIMIX host.
- * \param name name of the host to create
- */
-void SIMIX_host_create(sg_host_t host) // FIXME: braindead prototype. Take sg_host as parameter
-{
- smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1);
- s_smx_process_t proc;
-
- /* Host structure */
- smx_host->process_list =
- xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
-
- /* Update global variables */
- sg_host_simix_set(host, smx_host);
-}
-
-/**
- * \brief Start the host if it is off
- *
- */
-void SIMIX_host_on(sg_host_t h)
-{
- smx_host_priv_t host = sg_host_simix(h);
-
- xbt_assert((host != NULL), "Invalid parameters");
-
- if (surf_host_get_state(surf_host_resource_priv(h))==SURF_RESOURCE_OFF) {
- surf_host_set_state(surf_host_resource_priv(h), SURF_RESOURCE_ON);
-
- unsigned int cpt;
- smx_process_arg_t arg;
- xbt_dynar_foreach(host->boot_processes,cpt,arg) {
-
- char** argv = xbt_new(char*, arg->argc);
- for (int i=0; i<arg->argc; i++)
- argv[i] = xbt_strdup(arg->argv[i]);
-
- XBT_DEBUG("Booting Process %s(%s) right now", arg->argv[0], arg->hostname);
- if (simix_global->create_process_function) {
- simix_global->create_process_function(argv[0],
- arg->code,
- NULL,
- arg->hostname,
- arg->kill_time,
- arg->argc,
- argv,
- arg->properties,
- arg->auto_restart,
- NULL);
- } else {
- simcall_process_create(arg->argv[0],
- arg->code,
- NULL,
- arg->hostname,
- arg->kill_time,
- arg->argc,
- argv,
- arg->properties,
- arg->auto_restart);
- }
+#include "smx_private.hpp"
+#include "src/mc/mc_replay.hpp"
+#include "src/plugins/vm/VirtualMachineImpl.hpp"
+#include "src/simix/smx_host_private.hpp"
+#include "src/surf/surf_interface.hpp"
+#include "xbt/ex.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix, "SIMIX hosts");
+
+namespace simgrid {
+ namespace simix {
+ simgrid::xbt::Extension<simgrid::s4u::Host, Host> Host::EXTENSION_ID;
+
+ Host::Host()
+ {
+ if (not Host::EXTENSION_ID.valid())
+ Host::EXTENSION_ID = s4u::Host::extension_create<simix::Host>();