From: alebre Date: Tue, 12 Feb 2013 10:46:51 +0000 (+0100) Subject: Additional comments - Adrien/Takahiro X-Git-Tag: v3_11_beta~297^2^2~97 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9af94d17fed5867d5404fe78930676de085ea3dd Additional comments - Adrien/Takahiro --- diff --git a/src/surf/vm_workstation.c b/src/surf/vm_workstation.c index ffa4ad06bc..71dc8a9506 100644 --- a/src/surf/vm_workstation.c +++ b/src/surf/vm_workstation.c @@ -37,7 +37,11 @@ static void vm_ws_create(const char *name, void *ind_phys_workstation) vm_ws->ws.generic_resource.model = surf_vm_workstation_model; // //// CPU RELATED STUFF //// - vm_ws->ws->generic_resource.model.extension.cpu=cpu_model_cas01(0); + // This can be done directly during the creation of the surf_vm_worsktation model if + // we consider that there will be only one CPU model for one layer of virtualization. + // However, if you want to provide several layers (i.e. a VM inside a VM hosted by a PM) + // we should add a kind of table that stores the different CPU model. + // vm_ws->ws->generic_resource.model.extension.cpu=cpu_model_cas01(VM level ? ); // //// NET RELATED STUFF //// // Bind virtual net_elm to the host @@ -96,6 +100,20 @@ static void vm_ws_set_state(void *ind_vm_ws, int state){ ((workstation_VM2013_t) surf_workstation_resource_priv(ind_vm_ws))->current_state=state; } + +static double ws_share_resources(double now) +{ + // Can be obsolete if you right can ensure that ws_model has been code previously + // invoke ws_share_resources on the physical_lyer: sub_ws->ws_share_resources() + + // assign the corresponding value to X1, X2, .... + + // invoke cpu and net share resources on layer (1) + // return min; + return -1.0; +} + + /* * A surf level object will be useless in the upper layer. Returing the name * will be simple and suffcient. @@ -119,6 +137,7 @@ static void surf_vm_workstation_model_init_internal(void) surf_vm_workstation_model->extension.vm_workstation.get_phys_host = vm_ws_get_phys_host; surf_vm_workstation_model->extension.vm_workstation.destroy = vm_ws_destroy; + surf_vm_workstation_model->model_private->share_resources = ws_share_resources; } void surf_vm_workstation_model_init() diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 25ef8efee3..74bae72aa1 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -94,6 +94,7 @@ static void ws_action_state_set(surf_action_t action, static double ws_share_resources(double now) { +// invoke share_resources on CPU and network (layer 0) return -1.0; } @@ -157,7 +158,7 @@ static void ws_action_set_max_duration(surf_action_t action, if (action->model_type == surf_network_model) surf_network_model->set_max_duration(action, duration); else if (action->model_type == surf_cpu_model) - surf_cpu_model->set_max_duration(action, duration); + surf_cpu_model->set_max_duration(action, duration); else DIE_IMPOSSIBLE; } @@ -386,6 +387,7 @@ static void surf_workstation_model_init_internal(void) { surf_workstation_model = surf_model_init(); + // TODO surf_workstation_model->extension.cpu=cpu_model_cas01(0); surf_workstation_model->name = "Workstation"; surf_workstation_model->action_unref = ws_action_unref; surf_workstation_model->action_cancel = ws_action_cancel; @@ -448,9 +450,6 @@ void surf_workstation_model_init_current_default(void) surf_workstation_model_init_internal(); - surf_cpu_model_init_Cas01_phys(); // INSTANTIATE THE CPU PHYSICAL MODEL - surf_cpu_model_init_Cas01_vm(); // INSTANTIATE THE CPU PHYSICAL MODEL - xbt_cfg_setdefault_int(_sg_cfg_set, "network/crosstraffic", 1); surf_network_model_init_LegrandVelho();