/* this will call surf_resource_free() */
xbt_lib_unset(host_lib, name, SURF_WKS_LEVEL);
- xbt_free(vm_ws->ws.generic_resource.name);
- xbt_free(vm_ws);
+ /* NOTE: surf_resource_free() frees vm_ws->ws.generic_resource.name and
+ * vm_ws->ws. Do not free them here. */
}
static int vm_ws_get_state(void *ind_vm_ws){
}
-// TODO Please fix it (if found is wrong, nothing is returned)
static double get_solved_value(surf_action_t cpu_action)
{
int found = 0;
- lmm_system_t pm_system = surf_workstation_model->model_private->maxmin_system;
+ /* NOTE: Do not use surf_workstation_model's maxmin_system. It is not used. */
+ lmm_system_t pm_system = surf_cpu_model_pm->model_private->maxmin_system;
lmm_variable_t var = NULL;
xbt_swag_foreach(var, &pm_system->variable_set) {
return var->value;
XBT_CRITICAL("bug: cannot found the solved variable of the action %p", cpu_action);
+ DIE_IMPOSSIBLE;
+ return -1; /* NOT REACHED */
}
/* 0. Make sure that we already calculated the resource share at the physical
* machine layer. */
{
- unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, surf_workstation_model);
- unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, surf_vm_workstation_model);
+ unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &surf_workstation_model);
+ unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &surf_vm_workstation_model);
xbt_assert((index_of_pm_ws_model < index_of_vm_ws_model), "Cannot assume surf_workstation_model comes before");
-
+
/* Another option is that we call sub_ws->share_resource() here. The
* share_resource() function has no side-effect. We can call it here to
* ensure that. */
model->name = "Virtual Workstation";
model->type = SURF_MODEL_TYPE_VM_WORKSTATION;
+ xbt_assert(surf_cpu_model_vm);
model->extension.workstation.cpu_model = surf_cpu_model_vm;
model->extension.vm_workstation.create = vm_ws_create;