#include <simgrid/mutex.h>
#include <simgrid/plugins/live_migration.h>
#include <simgrid/semaphore.h>
-#include <simgrid/storage.h>
#include <simgrid/version.h>
#include <simgrid/vm.h>
#include <simgrid/zone.h>
/** @brief Sets the user data of this host */
XBT_PUBLIC void MSG_host_set_data(sg_host_t host, void* data);
-XBT_ATTRIB_DEPRECATED_v330("This function will be removed. Speak up if you need it.") XBT_PUBLIC xbt_dict_t
- MSG_host_get_mounted_storage_list(sg_host_t host);
-
-XBT_PUBLIC xbt_dynar_t MSG_host_get_attached_storage_lists(const_sg_host_t host);
XBT_PUBLIC double MSG_host_get_speed(const_sg_host_t host);
XBT_PUBLIC double MSG_host_get_power_peak_at(const_sg_host_t host, int pstate_index);
XBT_PUBLIC int MSG_host_get_core_number(const_sg_host_t host);
sg_size_t current_position_ = SEEK_SET;
int desc_id = 0;
Disk* local_disk_ = nullptr;
- Storage* local_storage_ = nullptr;
std::string mount_point_;
- Storage* find_local_storage_on(Host* host);
Disk* find_local_disk_on(const Host* host);
- sg_size_t write_on_storage(sg_size_t size, bool write_inside);
- sg_size_t write_on_disk(sg_size_t size, bool write_inside);
public:
File(const std::string& fullpath, void* userdata);
void incr_used_size(sg_size_t size);
};
-class XBT_PUBLIC FileSystemStorageExt {
- std::unique_ptr<std::map<std::string, sg_size_t, std::less<>>> content_;
- sg_size_t used_size_ = 0;
- sg_size_t size_ = 0;
-
-public:
- static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
- explicit FileSystemStorageExt(const Storage* ptr);
- FileSystemStorageExt(const FileSystemStorageExt&) = delete;
- FileSystemStorageExt& operator=(const FileSystemStorageExt&) = delete;
- std::map<std::string, sg_size_t, std::less<>>* parse_content(const std::string& filename);
- std::map<std::string, sg_size_t, std::less<>>* get_content() { return content_.get(); }
- sg_size_t get_size() const { return size_; }
- sg_size_t get_used_size() const { return used_size_; }
- void decr_used_size(sg_size_t size);
- void incr_used_size(sg_size_t size);
-};
-
class XBT_PUBLIC FileDescriptorHostExt {
public:
static simgrid::xbt::Extension<Host, FileDescriptorHostExt> EXTENSION_ID;
#include <simgrid/s4u/Mutex.hpp>
#include <simgrid/s4u/NetZone.hpp>
#include <simgrid/s4u/Semaphore.hpp>
-#include <simgrid/s4u/Storage.hpp>
#include <simgrid/s4u/VirtualMachine.hpp>
#include <simgrid/Exception.hpp>
friend Host;
friend Link;
friend Disk;
- friend Storage;
friend kernel::routing::NetPoint;
friend kernel::routing::NetZoneImpl;
friend kernel::resource::LinkImpl;
void host_unregister(const std::string& name);
void link_register(const std::string& name, const Link* link);
void link_unregister(const std::string& name);
- void storage_register(const std::string& name, const Storage* storage);
- void storage_unregister(const std::string& name);
void netpoint_register(simgrid::kernel::routing::NetPoint* card);
void netpoint_unregister(simgrid::kernel::routing::NetPoint* card);
#endif /*DOXYGEN*/
std::vector<ActorPtr> get_all_actors() const;
std::vector<ActorPtr> get_filtered_actors(const std::function<bool(ActorPtr)>& filter) const;
-#ifndef DOXYGEN
- size_t get_storage_count() const;
- std::vector<Storage*> get_all_storages() const;
- Storage* storage_by_name(const std::string& name) const;
- Storage* storage_by_name_or_null(const std::string& name) const;
-#endif
-
std::vector<kernel::routing::NetPoint*> get_all_netpoints() const;
kernel::routing::NetPoint* netpoint_by_name_or_null(const std::string& name) const;
void add_disk(const Disk* disk);
void remove_disk(const std::string& disk_name);
- std::vector<const char*> get_attached_storages() const;
-
- /** Get an associative list [mount point]->[Storage] of all local mount points.
- *
- * This is defined in the platform file, and cannot be modified programmatically (yet).
- */
- std::unordered_map<std::string, Storage*> const& get_mounted_storages();
-
void route_to(const Host* dest, std::vector<Link*>& links, double* latency) const;
void route_to(const Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency) const;
/** Do a blocking communication between two arbitrary hosts.
private:
xbt::string name_{"noname"};
- std::unordered_map<std::string, Storage*>* mounts_ = nullptr; // caching
kernel::routing::NetPoint* pimpl_netpoint_ = nullptr;
public:
enum class OpType { READ, WRITE };
private:
- Storage* storage_ = nullptr;
Disk* disk_ = nullptr;
sg_size_t size_ = 0;
OpType type_ = OpType::READ;
public:
#ifndef DOXYGEN
friend Disk; // Factory of IOs
- friend Storage; // Factory of IOs
~Io() override = default;
#endif
double get_remaining() const override;
sg_size_t get_performed_ioops() const;
IoPtr set_disk(sg_disk_t disk);
- IoPtr set_storage(sg_storage_t storage);
IoPtr set_size(sg_size_t size);
IoPtr set_op_type(OpType type);
};
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/simix/smx_private.hpp"
-#include "src/surf/StorageImpl.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/xml/platf.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
for (auto const& kv : netpoints_)
delete kv.second;
- for (auto const& kv : storages_)
- if (kv.second)
- kv.second->destroy();
-
for (auto const& kv : links_)
if (kv.second)
kv.second->destroy();
class EngineImpl {
std::map<std::string, s4u::Host*, std::less<>> hosts_;
std::map<std::string, resource::LinkImpl*, std::less<>> links_;
- std::map<std::string, resource::StorageImpl*, std::less<>> storages_;
std::unordered_map<std::string, routing::NetPoint*> netpoints_;
std::unordered_map<std::string, actor::ActorCodeFactory> registered_functions; // Maps function names to actor code
actor::ActorCodeFactory default_function; // Function to use as a fallback when the provided name matches nothing
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/simix/smx_private.hpp"
-#include "src/surf/StorageImpl.hpp"
#include "src/surf/cpu_interface.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
IoImpl& IoImpl::set_timeout(double timeout)
{
- const s4u::Host* host = get_disk() ? get_disk()->get_host() : s4u::Host::by_name(get_storage()->get_host());
+ const s4u::Host* host = get_disk()->get_host();
timeout_detector_ = host->pimpl_cpu->sleep(timeout);
timeout_detector_->set_activity(this);
return *this;
return *this;
}
-IoImpl& IoImpl::set_storage(resource::StorageImpl* storage)
-{
- storage_ = storage;
- return *this;
-}
-
IoImpl* IoImpl::start()
{
state_ = State::RUNNING;
- if (storage_)
- surf_action_ = storage_->io_start(size_, type_);
- else
- surf_action_ = disk_->io_start(size_, type_);
+ surf_action_ = disk_->io_start(size_, type_);
surf_action_->set_activity(this);
XBT_DEBUG("Create IO synchro %p %s", this, get_cname());
{
performed_ioops_ = surf_action_->get_cost();
if (surf_action_->get_state() == resource::Action::State::FAILED) {
- if ((storage_ && not storage_->is_on()) || (disk_ && not disk_->is_on()))
+ if (disk_ && not disk_->is_on())
state_ = State::FAILED;
else
state_ = State::CANCELED;
namespace activity {
class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
- resource::StorageImpl* storage_ = nullptr;
resource::DiskImpl* disk_ = nullptr;
sg_size_t size_ = 0;
s4u::Io::OpType type_ = s4u::Io::OpType::READ;
IoImpl& set_timeout(double timeout) override;
IoImpl& set_size(sg_size_t size);
IoImpl& set_type(s4u::Io::OpType type);
- IoImpl& set_storage(resource::StorageImpl* storage);
IoImpl& set_disk(resource::DiskImpl* disk);
sg_size_t get_performed_ioops() const { return performed_ioops_; }
resource::DiskImpl* get_disk() const { return disk_; }
- resource::StorageImpl* get_storage() const { return storage_; }
IoImpl* start();
void post() override;
{
return sg_host_set_data(host, data);
}
-xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330
-{
- return sg_host_get_mounted_storage_list(host);
-}
-xbt_dynar_t MSG_host_get_attached_storage_lists(const_sg_host_t host)
-{
- return sg_host_get_attached_storage_list(host);
-}
double MSG_host_get_speed(const_sg_host_t host)
{
return sg_host_get_speed(host);
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Mailbox.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "simgrid/s4u/Storage.hpp"
#include "simgrid/simix.h"
#include "src/instr/instr_private.hpp"
#include "src/kernel/EngineImpl.hpp"
#include "src/simix/smx_private.hpp" // For access to simix_global->process_list
-#include "src/surf/StorageImpl.hpp"
#include "src/surf/network_interface.hpp"
#include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
#include <simgrid/Exception.hpp>
pimpl->links_.erase(name);
}
-/** @brief Returns the amount of storages in the platform */
-size_t Engine::get_storage_count() const
-{
- return pimpl->storages_.size();
-}
-
-/** @brief Returns the list of all storages found in the platform */
-std::vector<Storage*> Engine::get_all_storages() const
-{
- std::vector<Storage*> res;
- for (auto const& kv : pimpl->storages_)
- res.push_back(kv.second->get_iface());
- return res;
-}
-
-/** @brief Find a storage from its name.
- *
- * @throw std::invalid_argument if the searched storage does not exist.
- */
-Storage* Engine::storage_by_name(const std::string& name) const
-{
- auto storage = pimpl->storages_.find(name);
- if (storage == pimpl->storages_.end())
- throw std::invalid_argument(std::string("Storage not found: ") + name);
- return storage->second->get_iface();
-}
-
-/** @brief Find a storage from its name (or nullptr if that storage does not exist) */
-Storage* Engine::storage_by_name_or_null(const std::string& name) const
-{
- auto storage = pimpl->storages_.find(name);
- return storage == pimpl->storages_.end() ? nullptr : storage->second->get_iface();
-}
-
-void Engine::storage_register(const std::string& name, const Storage* storage)
-{
- pimpl->storages_[name] = storage->get_impl();
-}
-
-void Engine::storage_unregister(const std::string& name)
-{
- pimpl->storages_.erase(name);
-}
-
/** @brief Returns the amount of links in the platform */
size_t Engine::get_link_count() const
{
if (pimpl_netpoint_ != nullptr) // not removed yet by a children class
Engine::get_instance()->netpoint_unregister(pimpl_netpoint_);
delete pimpl_cpu;
- delete mounts_;
}
/** @brief Fire the required callbacks and destroy the object
{
kernel::actor::simcall([this, disk_name] { this->pimpl_->remove_disk(disk_name); });
}
-/**
- * @ingroup simix_storage_management
- * @brief Returns the list of storages attached to a host.
- * @return a vector containing all storages attached to the host
- */
-std::vector<const char*> Host::get_attached_storages() const
-{
- return kernel::actor::simcall([this] { return this->pimpl_->get_attached_storages(); });
-}
-
-std::unordered_map<std::string, Storage*> const& Host::get_mounted_storages()
-{
- kernel::actor::simcall([this] {
- if (mounts_ == nullptr)
- mounts_ = pimpl_->get_mounted_storages();
- });
- return *mounts_;
-}
ExecPtr Host::exec_async(double flops) const
{
host->set_data(nullptr);
}
-// ========= storage related functions ============
+// ========= Disk related functions ============
void sg_host_get_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
{
std::vector<sg_disk_t> list = host->get_disks();
(*disks)[i] = list[i];
}
-xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330
-{
- xbt_assert((host != nullptr), "Invalid parameters");
- xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
- for (auto const& elm : host->get_mounted_storages()) {
- const char* mount_name = elm.first.c_str();
- const simgrid::s4u::Storage* storage = elm.second;
- xbt_dict_set(res, mount_name, (void*)storage->get_cname());
- }
-
- return res;
-}
-
-xbt_dynar_t sg_host_get_attached_storage_list(const_sg_host_t host)
-{
- xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr);
- std::vector<const char*> storage_vector = host->get_attached_storages();
- for (auto const& name : storage_vector)
- xbt_dynar_push(storage_dynar, &name);
- return storage_dynar;
-}
-
// =========== user-level functions ===============
// ================================================
/** @brief Returns the total speed of a host */
#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Disk.hpp"
#include "simgrid/s4u/Io.hpp"
-#include "simgrid/s4u/Storage.hpp"
#include "src/kernel/activity/IoImpl.hpp"
#include "xbt/log.h"
Io* Io::start()
{
kernel::actor::simcall([this] {
- if (storage_) {
- (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
- .set_name(get_name())
- .set_storage(storage_->get_impl())
- .set_size(size_)
- .set_type(type_)
- .start();
- } else {
- (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
- .set_name(get_name())
- .set_disk(disk_->get_impl())
- .set_size(size_)
- .set_type(type_)
- .start();
- }
+ (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
+ .set_name(get_name())
+ .set_disk(disk_->get_impl())
+ .set_size(size_)
+ .set_type(type_)
+ .start();
});
if (suspended_)
return this;
}
-IoPtr Io::set_storage(sg_storage_t storage)
-{
- storage_ = storage;
- return this;
-}
-
IoPtr Io::set_size(sg_size_t size)
{
size_ = size;
find_model_description(surf_disk_model_description, value);
}
-/* callback of the cpu/model variable */
-static void _sg_cfg_cb__storage_model(const std::string& value)
-{
- xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
-
- if (value == "help") {
- model_help("storage", surf_storage_model_description);
- exit(0);
- }
-
- find_model_description(surf_storage_model_description, value);
-}
-
/* callback of the network_model variable */
static void _sg_cfg_cb__network_model(const std::string& value)
{
declare_model_flag("disk/model", "default", &_sg_cfg_cb__disk_model, surf_disk_model_description, "model",
"The model to use for the disk");
- declare_model_flag("storage/model", "default", &_sg_cfg_cb__storage_model, surf_storage_model_description, "model",
- "The model to use for the storage");
-
declare_model_flag("network/model", "LV08", &_sg_cfg_cb__network_model, surf_network_model_description, "model",
"The model to use for the network");
#include "src/mc/mc_record.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/simix/smx_private.hpp"
-#include "src/surf/StorageImpl.hpp"
#include "src/surf/xml/platf.hpp"
+#include "simgrid/kernel/resource/Model.hpp"
+
#if SIMGRID_HAVE_MC
#include "src/mc/remote/AppSide.hpp"
#endif
class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
s4u::Host* piface_ = nullptr; // we must have a pointer there because the VM wants to change the piface in its ctor
- std::map<std::string, kernel::resource::StorageImpl*, std::less<>> storage_;
std::vector<kernel::resource::DiskImpl*> disks_;
public:
void add_disk(const s4u::Disk* disk);
void remove_disk(const std::string& disk_name);
- /** @brief Get the vector of storages (by names) attached to the Host */
- virtual std::vector<const char*> get_attached_storages();
- std::unordered_map<std::string, s4u::Storage*>* get_mounted_storages();
- void set_storages(const std::map<std::string, kernel::resource::StorageImpl*, std::less<>>& storages)
- {
- storage_ = storages;
- }
-
s4u::Host* get_iface() const { return piface_; }
void turn_on() const;
*/
XBT_PUBLIC void surf_host_model_init_ptask_L07();
-/** @ingroup SURF_models
- * @brief The storage model
- */
-XBT_PUBLIC void surf_storage_model_init_default();
-
XBT_PUBLIC void surf_disk_model_init_default();
/* --------------------
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_network_model_description;
/** @brief The list of all disk models (pick one with --cfg=disk/model) */
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_disk_model_description;
-/** @brief The list of all storage models (pick one with --cfg=storage/model) */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_storage_model_description;
/** @brief The list of all host models (pick one with --cfg=host/model:) */
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_host_model_description;
XBT_PUBLIC simgrid::kernel::resource::DiskImpl*
sg_platf_new_disk(const simgrid::kernel::routing::DiskCreationArgs* disk); // Add a disk to the current host
-XBT_PUBLIC void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage); // Add a storage to the current Zone
-XBT_PUBLIC void sg_platf_new_storage_type(const simgrid::kernel::routing::StorageTypeCreationArgs* storage_type);
-XBT_PUBLIC void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount);
-
XBT_PUBLIC void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor);
XBT_PRIVATE void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect);
void ETag_surfxml_storage()
{
- simgrid::kernel::routing::StorageCreationArgs storage;
-
- storage.properties = property_sets.back();
- property_sets.pop_back();
-
- storage.filename = surf_parsed_filename;
- storage.lineno = surf_parse_lineno;
- storage.id = A_surfxml_storage_id;
- storage.type_id = A_surfxml_storage_typeId;
- storage.content = A_surfxml_storage_content;
- storage.attach = A_surfxml_storage_attach;
-
- sg_platf_new_storage(&storage);
}
void STag_surfxml_storage___type()
{
- XBT_DEBUG("STag_surfxml_storage___type");
- property_sets.push_back(new std::unordered_map<std::string, std::string>());
- xbt_assert(current_model_property_set == nullptr, "Someone forgot to reset the model property set to nullptr in its closing tag (or XML malformed)");
}
void ETag_surfxml_storage___type()
{
- simgrid::kernel::routing::StorageTypeCreationArgs storage_type;
-
- storage_type.properties = property_sets.back();
- property_sets.pop_back();
-
- storage_type.model_properties = current_model_property_set;
- current_model_property_set = nullptr;
-
- storage_type.content = A_surfxml_storage___type_content;
- storage_type.id = A_surfxml_storage___type_id;
- storage_type.model = A_surfxml_storage___type_model;
- storage_type.size =
- static_cast<sg_size_t>(surf_parse_get_size(surf_parsed_filename, surf_parse_lineno, A_surfxml_storage___type_size,
- "size of storage type", storage_type.id.c_str()));
- sg_platf_new_storage_type(&storage_type);
}
void STag_surfxml_mount()
{
- XBT_DEBUG("STag_surfxml_mount");
}
void ETag_surfxml_mount()
{
- simgrid::kernel::routing::MountCreationArgs mount;
-
- mount.name = A_surfxml_mount_name;
- mount.storageId = A_surfxml_mount_storageId;
- sg_platf_new_mount(&mount);
}
void STag_surfxml_include()