Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix no storage share resource in VM
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 21 Nov 2013 10:06:27 +0000 (11:06 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 21 Nov 2013 10:06:52 +0000 (11:06 +0100)
src/surf/storage.cpp
src/surf/workstation.cpp

index bb5ee77..1d3ecc6 100644 (file)
@@ -190,7 +190,7 @@ static void storage_parse_mount(sg_platf_mount_cbarg_t mount)
   mnt.name = xbt_strdup(mount->name);
 
   if(!mount_list){
-    //FIXME:XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
+    XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
     mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free);
   }
   xbt_dynar_push(mount_list,&mnt);
@@ -598,7 +598,9 @@ sg_size_t StorageLmm::getSize(){
  **********/
 
 StorageActionLmm::StorageActionLmm(ModelPtr model, double cost, bool failed, StorageLmmPtr storage, e_surf_action_storage_type_t type)
-  : Action(model, cost, failed), ActionLmm(model, cost, failed), StorageAction(model, cost, failed, storage, type) {
+  : Action(model, cost, failed),
+    ActionLmm(model, cost, failed),
+    StorageAction(model, cost, failed, storage, type) {
   XBT_IN("(%s,%g", storage->m_name, cost);
   p_variable = lmm_variable_new(p_model->p_maxminSystem, this, 1.0, -1.0 , 3);
 
@@ -618,6 +620,7 @@ StorageActionLmm::StorageActionLmm(ModelPtr model, double cost, bool failed, Sto
     lmm_expand(p_model->p_maxminSystem, storage->p_constraintWrite,
                p_variable, 1.0);
     xbt_dynar_push(storage->p_writeActions, static_cast<ActionPtr>(this));
+    ref();
     break;
   }
   XBT_OUT();
index e1d23b9..6703847 100644 (file)
@@ -129,18 +129,23 @@ double WorkstationModel::shareResources(double now){
 
   double min_by_cpu = p_cpuModel->shareResources(now);
   double min_by_net = surf_network_model->shareResources(now);
-
-  XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f",
-      this, surf_cpu_model_pm->m_name.c_str(), min_by_cpu, surf_network_model->m_name.c_str(), min_by_net);
-
-  if (min_by_cpu >= 0.0 && min_by_net >= 0.0)
-    return min(min_by_cpu, min_by_net);
-  else if (min_by_cpu >= 0.0)
-    return min_by_cpu;
-  else if (min_by_net >= 0.0)
-    return min_by_net;
-  else
-    return min_by_cpu;  /* probably min_by_cpu == min_by_net == -1 */
+  double min_by_sto = -1;
+  if (p_cpuModel == surf_cpu_model_pm)
+       min_by_sto = surf_storage_model->shareResources(now);
+
+  XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
+      this, surf_cpu_model_pm->m_name.c_str(), min_by_cpu,
+            surf_network_model->m_name.c_str(), min_by_net,
+            surf_storage_model->m_name.c_str(), min_by_sto);
+
+  double res = max(max(min_by_cpu, min_by_net), min_by_sto);
+  if (min_by_cpu >= 0.0 && min_by_cpu < res)
+       res = min_by_cpu;
+  if (min_by_net >= 0.0 && min_by_net < res)
+       res = min_by_net;
+  if (min_by_sto >= 0.0 && min_by_sto < res)
+       res = min_by_sto;
+  return res;
 }
 
 void WorkstationModel::updateActionsState(double /*now*/, double /*delta*/){