- xbt_lib_set(host_lib,smx_host->name,SIMIX_HOST_LEVEL,smx_host);
+ 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);
+ }
+ }
+ }
+}