From 0a9ce6009d2a98f3ef66a8a1b020106f09e5568c Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 23 Nov 2017 15:14:37 +0100 Subject: [PATCH] pluginify storage contents --- examples/java/io/file/Main.java | 1 + examples/java/io/storage/Main.java | 1 + examples/msg/io-file/io-file.c | 3 + examples/msg/io-file/io-file.tesh | 6 +- examples/msg/io-remote/io-remote.c | 3 + examples/msg/io-storage/io-storage.c | 3 + .../actions-storage/s4u-actions-storage.cpp | 1 + examples/s4u/io/s4u-io.cpp | 1 + include/simgrid/plugins/file_system.h | 21 +++++ include/simgrid/s4u/File.hpp | 17 ++++ include/simgrid/s4u/Storage.hpp | 7 +- src/bindings/java/jmsg.cpp | 6 ++ src/bindings/java/jmsg.hpp | 1 + src/bindings/java/org/simgrid/msg/Msg.java | 1 + src/s4u/s4u_file.cpp | 77 ++++++++++++++++++- src/s4u/s4u_storage.cpp | 24 +++++- src/surf/StorageImpl.cpp | 53 +------------ src/surf/StorageImpl.hpp | 23 +----- src/surf/storage_n11.cpp | 13 +--- .../msg/actions-storage/actions-storage.c | 2 + teshsuite/s4u/concurrent_rw/concurrent_rw.cpp | 1 + .../storage_client_server.cpp | 1 + .../storage_client_server.tesh | 4 +- tools/cmake/DefinePackages.cmake | 1 + 24 files changed, 176 insertions(+), 95 deletions(-) create mode 100644 include/simgrid/plugins/file_system.h diff --git a/examples/java/io/file/Main.java b/examples/java/io/file/Main.java index 6134fe81ce..d0dd64c734 100644 --- a/examples/java/io/file/Main.java +++ b/examples/java/io/file/Main.java @@ -15,6 +15,7 @@ public class Main { public static void main(String[] args) { Msg.init(args); + Msg.fileSystemInit(); if(args.length < 1) { Msg.info("Usage : IO platform_file "); Msg.info("example : IO ../platforms/storage/storage.xml "); diff --git a/examples/java/io/storage/Main.java b/examples/java/io/storage/Main.java index 306eee8442..0e8392eadc 100644 --- a/examples/java/io/storage/Main.java +++ b/examples/java/io/storage/Main.java @@ -14,6 +14,7 @@ public class Main { public static void main(String[] args) { Msg.init(args); + Msg.fileSystemInit(); if(args.length < 1) { Msg.info("Usage : Storage platform_file "); Msg.info("example : Storage ../platforms/storage/storage.xml "); diff --git a/examples/msg/io-file/io-file.c b/examples/msg/io-file/io-file.c index c0ad633899..ec150573c7 100644 --- a/examples/msg/io-file/io-file.c +++ b/examples/msg/io-file/io-file.c @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/msg.h" +#include "simgrid/plugins/file_system.h" XBT_LOG_NEW_DEFAULT_CATEGORY(io_file, "Messages specific for this io example"); @@ -88,6 +89,8 @@ static int host(int argc, char *argv[]) int main(int argc, char **argv) { MSG_init(&argc, argv); + MSG_storage_file_system_init(); + MSG_create_environment(argv[1]); xbt_dynar_t hosts = MSG_hosts_as_dynar(); MSG_function_register("host", host); diff --git a/examples/msg/io-file/io-file.tesh b/examples/msg/io-file/io-file.tesh index d3700afca5..34f4ef03c0 100644 --- a/examples/msg/io-file/io-file.tesh +++ b/examples/msg/io-file/io-file.tesh @@ -3,8 +3,11 @@ $ ${bindir:=.}/io-file ${srcdir:=.}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (0:maestro@) Number of host '4' > [ 0.000000] (1:host@alice) Open file 'c:\Windows\setupact.log' +> [ 0.000000] (1:host@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391537133 / 536870912000 > [ 0.000000] (2:host@bob) Open file '/home/doc/simgrid/examples/platforms/nancy.xml' +> [ 0.000000] (2:host@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 36933331 / 536870912000 > [ 0.000000] (3:host@carl) Open file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' +> [ 0.000000] (3:host@carl) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 36933331 / 536870912000 > [ 0.000000] (4:host@denise) File Descriptor information: > Full path: '/home/doc/simgrid/examples/platforms/g5k.xml' > Size: 17028 @@ -13,9 +16,6 @@ $ ${bindir:=.}/io-file ${srcdir:=.}/storage/storage.xml "--log=root.fmt:[%10.6r] > Storage Type: 'single_SSD' > File Descriptor Id: 0 > [ 0.000000] (4:host@denise) Open file '/home/doc/simgrid/examples/platforms/g5k.xml' -> [ 0.000000] (1:host@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391537133 / 536870912000 -> [ 0.000000] (2:host@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 36933331 / 536870912000 -> [ 0.000000] (3:host@carl) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 36933331 / 536870912000 > [ 0.000000] (4:host@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13221994 / 536870912000 > [ 0.000040] (2:host@bob) Have read 4028 from '/home/doc/simgrid/examples/platforms/nancy.xml' > [ 0.000085] (4:host@denise) Have read 17028 from '/home/doc/simgrid/examples/platforms/g5k.xml' diff --git a/examples/msg/io-remote/io-remote.c b/examples/msg/io-remote/io-remote.c index 948950bc45..aaece80b15 100644 --- a/examples/msg/io-remote/io-remote.c +++ b/examples/msg/io-remote/io-remote.c @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/msg.h" +#include "simgrid/plugins/file_system.h" #define INMEGA (1024*1024) @@ -55,6 +56,8 @@ int main(int argc, char **argv) msg_storage_t st; MSG_init(&argc, argv); + MSG_storage_file_system_init(); + MSG_create_environment(argv[1]); MSG_function_register("host", host); MSG_launch_application(argv[2]); diff --git a/examples/msg/io-storage/io-storage.c b/examples/msg/io-storage/io-storage.c index 298e6e6501..69d0713305 100644 --- a/examples/msg/io-storage/io-storage.c +++ b/examples/msg/io-storage/io-storage.c @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/msg.h" +#include "simgrid/plugins/file_system.h" XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation"); @@ -114,6 +115,8 @@ static int host(int argc, char *argv[]){ int main(int argc, char *argv[]) { MSG_init(&argc, argv); + MSG_storage_file_system_init(); + MSG_create_environment(argv[1]); MSG_function_register("host", host); xbt_dynar_t hosts = MSG_hosts_as_dynar(); diff --git a/examples/s4u/actions-storage/s4u-actions-storage.cpp b/examples/s4u/actions-storage/s4u-actions-storage.cpp index 79a8ababd3..39d8bd5d3d 100644 --- a/examples/s4u/actions-storage/s4u-actions-storage.cpp +++ b/examples/s4u/actions-storage/s4u-actions-storage.cpp @@ -103,6 +103,7 @@ public: int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); + sg_storage_file_system_init(); xbt_assert(argc > 3, "Usage: %s platform_file deployment_file [action_files]\n" "\texample: %s platform.xml deployment.xml actions # if all actions are in the same file\n" diff --git a/examples/s4u/io/s4u-io.cpp b/examples/s4u/io/s4u-io.cpp index 46a50133c6..c78369746d 100644 --- a/examples/s4u/io/s4u-io.cpp +++ b/examples/s4u/io/s4u-io.cpp @@ -86,6 +86,7 @@ public: int main(int argc, char **argv) { simgrid::s4u::Engine e(&argc, argv); + sg_storage_file_system_init(); e.loadPlatform("../../platforms/storage/storage.xml"); simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("denise"), MyHost()); e.run(); diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h new file mode 100644 index 0000000000..bb22a1a63a --- /dev/null +++ b/include/simgrid/plugins/file_system.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2017. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef SIMGRID_PLUGINS_FILE_SYSTEM_H_ +#define SIMGRID_PLUGINS_FILE_SYSTEM_H_ + +#include +#include + +SG_BEGIN_DECL() + +XBT_PUBLIC(void) sg_storage_file_system_init(); + +#define MSG_storage_file_system_init() sg_storage_file_system_init() + +SG_END_DECL() + +#endif diff --git a/include/simgrid/s4u/File.hpp b/include/simgrid/s4u/File.hpp index 70249e3c55..e821cc196f 100644 --- a/include/simgrid/s4u/File.hpp +++ b/include/simgrid/s4u/File.hpp @@ -6,6 +6,8 @@ #ifndef SIMGRID_S4U_FILE_HPP #define SIMGRID_S4U_FILE_HPP +#include "simgrid/plugins/file_system.h" +#include #include #include @@ -70,6 +72,21 @@ private: sg_size_t current_position_ = SEEK_SET; void* userdata_ = nullptr; }; + +class FileSystemStorageExt { +public: + static simgrid::xbt::Extension EXTENSION_ID; + explicit FileSystemStorageExt(simgrid::s4u::Storage* ptr); + ~FileSystemStorageExt(); + std::map* parseContent(std::string filename); + std::map* getContent() { return content_; } + sg_size_t getUsedSize() { return usedSize_; } + void decrUsedSize(sg_size_t size) { usedSize_ -= size; } + void incrUsedSize(sg_size_t size) { usedSize_ += size; } +private: + std::map* content_; + sg_size_t usedSize_ = 0; +}; } } // namespace simgrid::s4u diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index c009740e9d..8ba939c39e 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -7,6 +7,7 @@ #ifndef INCLUDE_SIMGRID_S4U_STORAGE_HPP_ #define INCLUDE_SIMGRID_S4U_STORAGE_HPP_ +#include "xbt/Extendable.hpp" #include #include #include @@ -15,11 +16,14 @@ #include namespace simgrid { +namespace xbt { +extern template class XBT_PUBLIC() Extendable; +} namespace s4u { XBT_ATTRIB_PUBLIC std::map* allStorages(); -XBT_PUBLIC_CLASS Storage +XBT_PUBLIC_CLASS Storage : public simgrid::xbt::Extendable { friend s4u::Engine; friend simgrid::surf::StorageImpl; @@ -39,6 +43,7 @@ public: sg_size_t getSizeFree(); sg_size_t getSizeUsed(); void decrUsedSize(sg_size_t size); + void incrUsedSize(sg_size_t size); std::map* getProperties(); const char* getProperty(std::string key); diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 21b56a96f4..44f5f5fbcb 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -11,6 +11,7 @@ #include "simgrid/msg.h" #include "simgrid/plugins/energy.h" +#include "simgrid/plugins/file_system.h" #include "simgrid/simix.h" #include "simgrid/s4u/Host.hpp" @@ -239,6 +240,11 @@ Java_org_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls, jstring jde JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_energyInit() { sg_host_energy_plugin_init(); } + +JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_fileSystemInit() +{ + sg_storage_file_system_init(); +} } // extern "C" /** Run a Java org.simgrid.msg.Process diff --git a/src/bindings/java/jmsg.hpp b/src/bindings/java/jmsg.hpp index 295a93800b..e7d0919c0f 100644 --- a/src/bindings/java/jmsg.hpp +++ b/src/bindings/java/jmsg.hpp @@ -37,6 +37,7 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv* env, jclass JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv* env, jclass cls, jobjectArray jargs); JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_energyInit(); +JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_fileSystemInit(); JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_debug(JNIEnv* env, jclass cls, jstring jargs); JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_verb(JNIEnv* env, jclass cls, jstring jargs); diff --git a/src/bindings/java/org/simgrid/msg/Msg.java b/src/bindings/java/org/simgrid/msg/Msg.java index c58b213e37..cc1cb7d0ba 100644 --- a/src/bindings/java/org/simgrid/msg/Msg.java +++ b/src/bindings/java/org/simgrid/msg/Msg.java @@ -40,6 +40,7 @@ public final class Msg { /** Tell the kernel that you want to use the energy plugin */ public static final native void energyInit(); + public static final native void fileSystemInit(); /** Run the MSG simulation. * diff --git a/src/s4u/s4u_file.cpp b/src/s4u/s4u_file.cpp index 5615bac50e..cd89f9918f 100644 --- a/src/s4u/s4u_file.cpp +++ b/src/s4u/s4u_file.cpp @@ -11,10 +11,17 @@ #include "simgrid/simix.hpp" #include "src/surf/HostImpl.hpp" +#include +#include +#include +#include +#include + XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_file,"S4U files"); namespace simgrid { namespace s4u { +simgrid::xbt::Extension FileSystemStorageExt::EXTENSION_ID; File::File(std::string fullpath, void* userdata) : File(fullpath, Host::current(), userdata){}; @@ -75,6 +82,8 @@ sg_size_t File::write(sg_size_t size) localStorage->decrUsedSize(size_ - current_position_); sg_size_t write_size = localStorage->write(size); + localStorage->incrUsedSize(write_size); + current_position_ += write_size; size_ = current_position_; @@ -153,4 +162,70 @@ int File::unlink() } } -}} // namespace simgrid::s4u +FileSystemStorageExt::FileSystemStorageExt(simgrid::s4u::Storage* ptr) +{ + content_ = parseContent(ptr->getImpl()->content_name); +} + +FileSystemStorageExt::~FileSystemStorageExt() +{ + delete content_; +} + +std::map* FileSystemStorageExt::parseContent(std::string filename) +{ + if (filename.empty()) + return nullptr; + + std::map* parse_content = new std::map(); + + std::ifstream* fs = surf_ifsopen(filename); + + std::string line; + std::vector tokens; + do { + std::getline(*fs, line); + boost::trim(line); + if (line.length() > 0) { + boost::split(tokens, line, boost::is_any_of(" \t"), boost::token_compress_on); + xbt_assert(tokens.size() == 2, "Parse error in %s: %s", filename.c_str(), line.c_str()); + sg_size_t size = std::stoull(tokens.at(1)); + + usedSize_ += size; + parse_content->insert({tokens.front(), size}); + } + } while (not fs->eof()); + delete fs; + return parse_content; +} +} +} + +using simgrid::s4u::FileSystemStorageExt; + +static void onStorageCreation(simgrid::s4u::Storage& st) +{ + st.extension_set(new FileSystemStorageExt(&st)); +} + +static void onStorageDestruction(simgrid::s4u::Storage& st) +{ + XBT_INFO("BLIH"); +} + +/* **************************** Public interface *************************** */ +SG_BEGIN_DECL() + +void sg_storage_file_system_init() +{ + + if (FileSystemStorageExt::EXTENSION_ID.valid()) + return; + + FileSystemStorageExt::EXTENSION_ID = simgrid::s4u::Storage::extension_create(); + + simgrid::s4u::Storage::onCreation.connect(&onStorageCreation); + simgrid::s4u::Storage::onDestruction.connect(&onStorageDestruction); +} + +SG_END_DECL() diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index 5cb09af9e0..9123343960 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -3,6 +3,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/s4u/File.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" #include "simgrid/simix.hpp" @@ -10,6 +11,10 @@ #include namespace simgrid { +namespace xbt { +template class Extendable; +} + namespace s4u { std::map* allStorages() @@ -52,17 +57,27 @@ Host* Storage::getHost() sg_size_t Storage::getSizeFree() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); + FileSystemStorageExt* file_system = extension(); + + return pimpl_->getSize() - file_system->getUsedSize(); } sg_size_t Storage::getSizeUsed() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); + FileSystemStorageExt* file_system = extension(); + return file_system->getUsedSize(); } void Storage::decrUsedSize(sg_size_t size) { - simgrid::simix::kernelImmediate([this, size] { pimpl_->usedSize_ -= size; }); + FileSystemStorageExt* file_system = extension(); + file_system->decrUsedSize(size); +} + +void Storage::incrUsedSize(sg_size_t size) +{ + FileSystemStorageExt* file_system = extension(); + file_system->incrUsedSize(size); } sg_size_t Storage::getSize() @@ -87,7 +102,8 @@ void Storage::setProperty(std::string key, std::string value) std::map* Storage::getContent() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); + FileSystemStorageExt* file_system = extension(); + return file_system->getContent(); } sg_size_t Storage::read(sg_size_t size) diff --git a/src/surf/StorageImpl.cpp b/src/surf/StorageImpl.cpp index cc888ddd19..9ce12e22e1 100644 --- a/src/surf/StorageImpl.cpp +++ b/src/surf/StorageImpl.cpp @@ -5,13 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "StorageImpl.hpp" - #include "surf_private.hpp" -#include -#include -#include -#include -#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, "Logging specific to the SURF storage module"); @@ -64,10 +58,10 @@ StorageImpl::StorageImpl(Model* model, std::string name, lmm_system_t maxminSyst : Resource(model, name.c_str(), lmm_constraint_new(maxminSystem, this, std::max(bread, bwrite))) , piface_(this) , typeId_(type_id) + , content_name(content_name) , size_(size) , attach_(attach) { - content_ = parseContent(content_name); StorageImpl::turnOn(); XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size); constraintRead_ = lmm_constraint_new(maxminSystem, this, bread); @@ -78,37 +72,8 @@ StorageImpl::StorageImpl(Model* model, std::string name, lmm_system_t maxminSyst StorageImpl::~StorageImpl() { storageDestructedCallbacks(this); - if (content_ != nullptr) - delete content_; } -std::map* StorageImpl::parseContent(std::string filename) -{ - usedSize_ = 0; - if (filename.empty()) - return nullptr; - - std::map* parse_content = new std::map(); - - std::ifstream* fs = surf_ifsopen(filename); - - std::string line; - std::vector tokens; - do { - std::getline(*fs, line); - boost::trim(line); - if (line.length() > 0) { - boost::split(tokens, line, boost::is_any_of(" \t"), boost::token_compress_on); - xbt_assert(tokens.size() == 2, "Parse error in %s: %s", filename.c_str(), line.c_str()); - sg_size_t size = std::stoull(tokens.at(1)); - - usedSize_ += size; - parse_content->insert({tokens.front(), size}); - } - } while (not fs->eof()); - delete fs; - return parse_content; -} bool StorageImpl::isUsed() { @@ -136,22 +101,6 @@ void StorageImpl::turnOff() } } -std::map* StorageImpl::getContent() -{ - /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */ - return content_; -} - -sg_size_t StorageImpl::getFreeSize() -{ - return size_ - usedSize_; -} - -sg_size_t StorageImpl::getUsedSize() -{ - return usedSize_; -} - /********** * Action * **********/ diff --git a/src/surf/StorageImpl.hpp b/src/surf/StorageImpl.hpp index c66f9f96d7..4fe1443585 100644 --- a/src/surf/StorageImpl.hpp +++ b/src/surf/StorageImpl.hpp @@ -115,31 +115,9 @@ public: * @return The StorageAction corresponding to the writing */ virtual StorageAction* write(sg_size_t size) = 0; - - /** - * @brief Get the content of the current Storage - * - * @return A map with path as keys and size in bytes as values - */ - virtual std::map* getContent(); - - /** - * @brief Get the available size in bytes of the current Storage - * - * @return The available size in bytes of the current Storage - */ - virtual sg_size_t getFreeSize(); - - /** - * @brief Get the used size in bytes of the current Storage - * - * @return The used size in bytes of the current Storage - */ - virtual sg_size_t getUsedSize(); virtual sg_size_t getSize() { return size_; } virtual std::string getHost() { return attach_; } - std::map* parseContent(std::string filename); static std::unordered_map* storagesMap() { return StorageImpl::storages; } lmm_constraint_t constraintWrite_; /* Constraint for maximum write bandwidth*/ @@ -147,6 +125,7 @@ public: std::string typeId_; sg_size_t usedSize_ = 0; + std::string content_name; private: sg_size_t size_; diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 54f284761a..71ee41de86 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -78,20 +78,13 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta) for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) { StorageAction& action = static_cast(*it); ++it; // increment iterator here since the following calls to action.finish() may invalidate it - double current_progress = lrint(lmm_variable_getvalue(action.getVariable()) * delta); - action.updateRemains(current_progress); - if (action.type_ == WRITE) { - action.storage_->usedSize_ += current_progress; - } + action.updateRemains(lrint(lmm_variable_getvalue(action.getVariable()) * delta)); if (action.getMaxDuration() > NO_MAX_DURATION) action.updateMaxDuration(delta); - if (action.getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action.getVariable()) > 0 && - action.storage_->usedSize_ == action.storage_->getSize()) { - action.finish(Action::State::failed); - } else if (((action.getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action.getVariable()) > 0)) || - ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) { + if (((action.getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action.getVariable()) > 0)) || + ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) { action.finish(Action::State::done); } } diff --git a/teshsuite/msg/actions-storage/actions-storage.c b/teshsuite/msg/actions-storage/actions-storage.c index d0fc4239b5..e4cfac8c6e 100644 --- a/teshsuite/msg/actions-storage/actions-storage.c +++ b/teshsuite/msg/actions-storage/actions-storage.c @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/msg.h" +#include "simgrid/plugins/file_system.h" #include XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this example"); @@ -98,6 +99,7 @@ static void action_close(const char* const* action) int main(int argc, char* argv[]) { MSG_init(&argc, argv); + MSG_storage_file_system_init(); /* Explicit initialization of the action module is required */ MSG_action_init(); diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp index 217a166490..d079d3d470 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp @@ -41,6 +41,7 @@ static void host() int main(int argc, char** argv) { simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv); + sg_storage_file_system_init(); e->loadPlatform(argv[1]); for (int i = 0; i < 5; i++) diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 9ef8840fa8..78598bcd5f 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -157,6 +157,7 @@ static void server() int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); + sg_storage_file_system_init(); xbt_assert(argc == 2, "Usage: %s platform_file\n", argv[0]); e.loadPlatform(argv[1]); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.tesh b/teshsuite/s4u/storage_client_server/storage_client_server.tesh index 08781a10da..0a7dffcdee 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.tesh +++ b/teshsuite/s4u/storage_client_server/storage_client_server.tesh @@ -54,11 +54,11 @@ $ ./storage_client_server$EXEEXT ${srcdir:=.}/../../../examples/platforms/storag > [ 0.806104] (server@alice) 6217 bytes on 6217 bytes have been written by server on /sd1 > [ 1.207952] (server@alice) *** Storage info on alice *** > [ 1.207952] (server@alice) Storage name: Disk2, mount name: c: +> [ 1.207952] (server@alice) Free size: 534479367024 bytes +> [ 1.207952] (server@alice) Used size: 2391544976 bytes > [ 1.207952] (client@bob) *** GET/SET DATA for storage element: Disk1 *** > [ 1.207952] (client@bob) Get data: '(null)' > [ 1.207952] (client@bob) Set and get data: 'Some data' -> [ 1.207952] (server@alice) Free size: 534479367024 bytes -> [ 1.207952] (server@alice) Used size: 2391544976 bytes > [ 1.207952] (server@alice) No property attached. > [ 1.207952] (server@alice) *** Dump a storage element *** > [ 1.207952] (server@alice) Print the content of the storage element: Disk2 diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 510bb81c52..18103ba005 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -664,6 +664,7 @@ set(MC_SIMGRID_MC_SRC src/mc/checker/simgrid_mc.cpp) set(headers_to_install include/simgrid/chrono.hpp include/simgrid/plugins/energy.h + include/simgrid/plugins/file_system.h include/simgrid/plugins/load.h include/simgrid/instr.h include/simgrid/msg.h -- 2.20.1