From: Paul Bédaride Date: Thu, 21 Nov 2013 10:06:27 +0000 (+0100) Subject: Fix no storage share resource in VM X-Git-Tag: v3_11_beta~245 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/300e6917d746d484414e2833053c8694ebcd9a92?hp=bdb174604622ce78c0dce9cbbde290d4281e0d1a Fix no storage share resource in VM --- diff --git a/src/surf/storage.cpp b/src/surf/storage.cpp index bb5ee778cc..1d3ecc60e7 100644 --- a/src/surf/storage.cpp +++ b/src/surf/storage.cpp @@ -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(this)); + ref(); break; } XBT_OUT(); diff --git a/src/surf/workstation.cpp b/src/surf/workstation.cpp index e1d23b90cf..67038479b3 100644 --- a/src/surf/workstation.cpp +++ b/src/surf/workstation.cpp @@ -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*/){