From: Frederic Suter Date: Tue, 3 Sep 2019 07:55:04 +0000 (+0200) Subject: connect disks to their host X-Git-Tag: v3.24~107 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/16f06cbc4371b98049be5df2750bf34ece00ad14 connect disks to their host --- diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 628569bf2d..b5f4d5c9bd 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -51,6 +51,8 @@ public: virtual std::vector get_attached_storages(); std::map storage_; + std::vector disks_; + s4u::Host* piface_ = nullptr; void turn_on(); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 9df9f386f0..218cfb8784 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -81,6 +81,8 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) host->pimpl_->storage_ = mount_list; mount_list.clear(); + host->pimpl_->disks_ = std::move(args->disks); + /* Change from the defaults */ if (args->state_trace) host->pimpl_cpu->set_state_profile(args->state_trace); @@ -332,14 +334,15 @@ void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet delete cabinet->radicals; } -void sg_platf_new_disk(simgrid::kernel::routing::DiskCreationArgs* disk) +simgrid::kernel::resource::DiskImpl* sg_platf_new_disk(simgrid::kernel::routing::DiskCreationArgs* disk) { - auto s = surf_disk_model->createDisk(disk->id, disk->read_bw, disk->write_bw); + simgrid::kernel::resource::DiskImpl* d = surf_disk_model->createDisk(disk->id, disk->read_bw, disk->write_bw); if (disk->properties) { - s->set_properties(*disk->properties); + d->set_properties(*disk->properties); delete disk->properties; } + return d; } void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage) diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 976771fe85..679a31259d 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -41,6 +41,7 @@ struct HostCreationArgs { profile::Profile* state_trace = nullptr; std::string coord = ""; std::unordered_map* properties = nullptr; + std::vector disks; }; class HostLinkCreationArgs { @@ -211,7 +212,8 @@ XBT_PUBLIC void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreation XBT_PUBLIC void sg_platf_new_trace(simgrid::kernel::routing::ProfileCreationArgs* trace); -XBT_PUBLIC void sg_platf_new_disk(simgrid::kernel::routing::DiskCreationArgs* disk); // Add a disk to the current host +XBT_PUBLIC simgrid::kernel::resource::DiskImpl* +sg_platf_new_disk(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(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type); diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 91224b243c..59a8c84545 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -28,8 +28,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF static std::string surf_parsed_filename; // Currently parsed file (for the error messages) std::vector - parsed_link_list; /* temporary store of current list link of a route */ - + parsed_link_list; /* temporary store of current link list of a route */ +std::vector parsed_disk_list; /* temporary store of current disk list of a host */ /* * Helping functions */ @@ -458,12 +458,13 @@ void ETag_surfxml_host() { : nullptr; host.pstate = surf_parse_get_int(A_surfxml_host_pstate); host.coord = A_surfxml_host_coordinates; + host.disks.swap(parsed_disk_list); sg_platf_new_host(&host); } void STag_surfxml_disk() { - XBT_DEBUG("STag_surfxml_disk"); + ZONE_TAG = 0; xbt_assert(current_property_set == nullptr, "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)"); } @@ -476,7 +477,8 @@ void ETag_surfxml_disk() { disk.id = A_surfxml_disk_id; disk.read_bw = surf_parse_get_bandwidth(A_surfxml_disk_read___bw, "read_bw of disk ", disk.id); disk.write_bw = surf_parse_get_bandwidth(A_surfxml_disk_write___bw, "write_bw of disk ", disk.id); - sg_platf_new_disk(&disk); + + parsed_disk_list.push_back(sg_platf_new_disk(&disk)); } void STag_surfxml_host___link(){