<host id="bob" speed="1Gf">
<disk id="Disk1" read_bw="100MBps" write_bw="40MBps">
<prop id="size" value="500GiB"/>
- <prop id="mount" value="/home"/>
+ <prop id="mount" value="/scratch"/>
<prop id="content" value="storage/content/storage_content.txt"/>
</disk>
<disk id="Disk2" read_bw="200MBps" write_bw="80MBps"/>
</host>
<host id="alice" speed="1Gf">
- <disk id="Disk1" read_bw="200MBps" write_bw="80MBps"/>
+ <disk id="Disk1" read_bw="200MBps" write_bw="80MBps">
+ <prop id="size" value="500GiB"/>
+ <prop id="mount" value="c:"/>
+ <prop id="content" value="storage/content/win_storage_content.txt"/>
+ </disk>
</host>
<link id="link1" bandwidth="125MBps" latency="150us" />
const char* filename = file.get_path();
XBT_INFO("Opened file '%s'", filename);
file.dump();
-
- XBT_INFO("Try to read %llu from '%s'", file.size(), filename);
- sg_size_t read = file.read(file.size());
- XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu", read, filename, file.tell());
- XBT_INFO("Seek back to the beginning of the stream...");
- file.seek(0, SEEK_SET);
- XBT_INFO("Offset is now at: %llu", file.tell());
-
- if (argc > 5) {
- simgrid::s4u::File remoteFile(argv[2], nullptr);
- filename = remoteFile.get_path();
- XBT_INFO("Opened file '%s'", filename);
- XBT_INFO("Try to write %llu MiB to '%s'", remoteFile.size() / 1024, filename);
- sg_size_t write = remoteFile.write(remoteFile.size() * 1024);
- XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
-
- if (std::stoi(argv[5]) != 0) {
- XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(),
- simgrid::s4u::Host::current()->get_cname(), argv[3]);
- remoteFile.remote_move(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
- } else {
- XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(),
- simgrid::s4u::Host::current()->get_cname(), argv[3]);
- remoteFile.remote_copy(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
- }
+ XBT_INFO("Try to write %llu MiB to '%s'", file.size() / 1024, filename);
+ sg_size_t write = file.write(file.size() * 1024);
+ XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
+
+ if (std::stoi(argv[4]) != 0) {
+ XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, file.size(),
+ simgrid::s4u::Host::current()->get_cname(), argv[2]);
+ file.remote_move(simgrid::s4u::Host::by_name(argv[2]), argv[3]);
+ } else {
+ XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, file.size(),
+ simgrid::s4u::Host::current()->get_cname(), argv[2]);
+ file.remote_copy(simgrid::s4u::Host::by_name(argv[2]), argv[3]);
}
return 0;
e.load_platform(argv[1]);
e.register_function("host", host);
e.load_deployment(argv[2]);
- std::vector<simgrid::s4u::Storage*> allStorages = e.get_all_storages();
+ std::vector<simgrid::s4u::Host*> all_hosts = e.get_all_hosts();
- for (auto const& s : allStorages) {
- XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
- sg_storage_get_size_free(s) / INMEGA, s->get_cname());
+ for (auto const& h : all_hosts) {
+ for (auto const& d : h->get_disks())
+ XBT_INFO("Init: %llu/%llu MiB used/free on '%s@%s'", sg_disk_get_size_used(d) / INMEGA,
+ sg_disk_get_size_free(d) / INMEGA, d->get_cname(), h->get_cname());
}
e.run();
- for (auto const& s : allStorages) {
- XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
- sg_storage_get_size_free(s) / INMEGA, s->get_cname());
+ for (auto const& h : all_hosts) {
+ for (auto const& d : h->get_disks())
+ XBT_INFO("End: %llu/%llu MiB used/free on '%s@%s'", sg_disk_get_size_used(d) / INMEGA,
+ sg_disk_get_size_free(d) / INMEGA, d->get_cname(), h->get_cname());
}
XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-io-file-remote ${platfdir}/storage/remote_io.xml s4u-io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
-> [ 0.000000] (0@ ) Init: 12/476824 MiB used/free on 'Disk1'
-> [ 0.000000] (0@ ) Init: 2280/474556 MiB used/free on 'Disk2'
-> [ 0.000000] (1@alice) Opened file 'c:\Windows\setupact.log'
+$ ${bindir:=.}/s4u-io-file-remote ${platfdir}/hosts_with_disks.xml s4u-io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
+> [ 0.000000] (0@ ) Init: 2280/509719 MiB used/free on 'Disk1@alice'
+> [ 0.000000] (0@ ) Init: 35/511964 MiB used/free on 'Disk1@bob'
+> [ 0.000000] (0@ ) Init: 0/0 MiB used/free on 'Disk2@bob'
+> [ 0.000000] (1@alice) Opened file 'c:\Windows\Professional.xml'
> [ 0.000000] (1@alice) File Descriptor information:
-> Full path: 'c:\Windows\setupact.log'
-> Size: 101663
+> Full path: 'c:\Windows\Professional.xml'
+> Size: 31881
> Mount point: 'c:'
-> Storage Id: 'Disk2'
-> Storage Type: 'SATA-II_HDD'
+> Disk Id: 'Disk1'
+> Host Id: 'alice'
> File Descriptor Id: 0
-> [ 0.000000] (1@alice) Try to read 101663 from 'c:\Windows\setupact.log'
-> [ 0.000000] (2@ bob) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (1@alice) Try to write 31 MiB to 'c:\Windows\Professional.xml'
+> [ 0.000000] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
> [ 0.000000] (2@ bob) File Descriptor information:
-> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
-> Size: 12710497
+> Full path: '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> Size: 17028
> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> Storage Type: 'SATA-II_HDD'
+> Disk Id: 'Disk1'
+> Host Id: 'bob'
> File Descriptor Id: 0
-> [ 0.000000] (2@ bob) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (3@ carl) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (3@ carl) File Descriptor information:
-> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
-> Size: 12710497
-> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> Storage Type: 'SATA-II_HDD'
-> File Descriptor Id: 0
-> [ 0.000000] (3@ carl) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (4@ dave) Opened file 'c:\Windows\bootstat.dat'
-> [ 0.000000] (4@ dave) File Descriptor information:
-> Full path: 'c:\Windows\bootstat.dat'
-> Size: 67584
-> Mount point: 'c:'
-> Storage Id: 'Disk2'
-> Storage Type: 'SATA-II_HDD'
-> File Descriptor Id: 0
-> [ 0.000000] (4@ dave) Try to read 67584 from 'c:\Windows\bootstat.dat'
-> [ 0.001469] (4@ dave) Have read 67584 from 'c:\Windows\bootstat.dat'. Offset is now at: 67584
-> [ 0.001469] (4@ dave) Seek back to the beginning of the stream...
-> [ 0.001469] (4@ dave) Offset is now at: 0
-> [ 0.001469] (4@ dave) Opened file 'c:\Windows\Professional.xml'
-> [ 0.001469] (4@ dave) Try to write 31 MiB to 'c:\Windows\Professional.xml'
-> [ 0.003741] (1@alice) Have read 101663 from 'c:\Windows\setupact.log'. Offset is now at: 101663
-> [ 0.003741] (1@alice) Seek back to the beginning of the stream...
-> [ 0.003741] (1@alice) Offset is now at: 0
-> [ 0.276315] (3@ carl) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.276315] (3@ carl) Seek back to the beginning of the stream...
-> [ 0.276315] (3@ carl) Offset is now at: 0
-> [ 0.387036] (2@ bob) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.387036] (2@ bob) Seek back to the beginning of the stream...
-> [ 0.387036] (2@ bob) Offset is now at: 0
-> [ 0.387036] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.387036] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.528211] (4@ dave) Have written 32646144 bytes to 'c:\Windows\Professional.xml'.
-> [ 0.528211] (4@ dave) Move 'c:\Windows\Professional.xml' (of size 32646144) from 'dave' to 'carl'
-> [ 0.819921] (2@ bob) Have written 17436672 bytes to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
-> [ 0.819921] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
-> [ 1.843969] (0@ ) End: 60/476776 MiB used/free on 'Disk1'
-> [ 1.843969] (0@ ) End: 2297/474539 MiB used/free on 'Disk2'
-> [ 1.843969] (0@ ) Simulation time 1.84397
+> [ 0.000000] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.408077] (1@alice) Have written 32646144 bytes to 'c:\Windows\Professional.xml'.
+> [ 0.408077] (1@alice) Move 'c:\Windows\Professional.xml' (of size 32646144) from 'alice' to 'bob'
+> [ 0.435917] (2@ bob) Have written 17436672 bytes to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
+> [ 0.435917] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
+> [ 1.823119] (0@ ) End: 2297/509702 MiB used/free on 'Disk1@alice'
+> [ 1.823119] (0@ ) End: 82/511917 MiB used/free on 'Disk1@bob'
+> [ 1.823119] (0@ ) End: 0/0 MiB used/free on 'Disk2@bob'
+> [ 1.823119] (0@ ) Simulation time 1.82312
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
<actor host="alice" function="host">
- <argument value = "c:\Windows\setupact.log"/>
+ <argument value = "c:\Windows\Professional.xml"/>
+ <argument value = "bob"/>
+ <argument value = "/scratch/mailbox/Professional.xml"/>
+ <argument value = "1"/>
</actor>
<actor host="bob" function="host">
- <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
<argument value = "/scratch/doc/simgrid/examples/platforms/g5k.xml"/>
<argument value = "alice"/>
<argument value = "c:\Windows\Platforms\g5k.xml"/>
<argument value = "0"/>
</actor>
- <actor host="carl" function="host">
- <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
- </actor>
- <actor host="dave" function="host">
- <argument value = "c:\Windows\bootstat.dat"/>
- <argument value = "c:\Windows\Professional.xml"/>
- <argument value = "carl"/>
- <argument value = "/scratch/mailbox/Professional.xml"/>
- <argument value = "1"/>
- </actor>
</platform>
show_info(disks);
// Open an non-existing file to create it
- std::string filename = "/home/tmp/data.txt";
+ std::string filename = "/scratch/tmp/data.txt";
simgrid::s4u::File* file = new simgrid::s4u::File(filename, nullptr);
sg_size_t write = file->write(200000); // Write 200,000 bytes
- XBT_INFO("Create a %llu bytes file named '%s' on /sd1", write, filename.c_str());
+ XBT_INFO("Create a %llu bytes file named '%s' on /scratch", write, filename.c_str());
// check that sizes have changed
show_info(disks);
XBT_INFO("Write %llu bytes on %s", write, filename.c_str());
// Now rename file from ./tmp/data.txt to ./tmp/simgrid.readme
- std::string newpath = "/home/tmp/simgrid.readme";
+ std::string newpath = "/scratch/tmp/simgrid.readme";
XBT_INFO("Move '%s' to '%s'", file->get_path(), newpath.c_str());
file->move(newpath);
show_info(disks);
// Reopen the file and then unlink it
- file = new simgrid::s4u::File("/home/tmp/simgrid.readme", nullptr);
+ file = new simgrid::s4u::File("/scratch/tmp/simgrid.readme", nullptr);
XBT_INFO("Unlink file: '%s'", file->get_path());
file->unlink();
delete file; // Unlinking the file on "disk" does not free the object
$ ${bindir:=.}/s4u-io-file-system ${platfdir}/hosts_with_disks.xml
> [bob:host:(1) 0.000000] [s4u_test/INFO] Storage info on bob:
-> [bob:host:(1) 0.000000] [s4u_test/INFO] Disk1 (/home) Used: 36933331; Free: 536833978669; Total: 536870912000.
+> [bob:host:(1) 0.000000] [s4u_test/INFO] Disk1 (/scratch) Used: 36933331; Free: 536833978669; Total: 536870912000.
> [bob:host:(1) 0.000000] [s4u_test/INFO] Disk2 ((null)) Used: 0; Free: 0; Total: 0.
-> [bob:host:(1) 0.005000] [s4u_test/INFO] Create a 200000 bytes file named '/home/tmp/data.txt' on /sd1
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Create a 200000 bytes file named '/scratch/tmp/data.txt' on /scratch
> [bob:host:(1) 0.005000] [s4u_test/INFO] Storage info on bob:
-> [bob:host:(1) 0.005000] [s4u_test/INFO] Disk1 (/home) Used: 37133331; Free: 536833778669; Total: 536870912000.
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Disk1 (/scratch) Used: 37133331; Free: 536833778669; Total: 536870912000.
> [bob:host:(1) 0.005000] [s4u_test/INFO] Disk2 ((null)) Used: 0; Free: 0; Total: 0.
-> [bob:host:(1) 0.007000] [s4u_test/INFO] Read 200000 bytes on /home/tmp/data.txt
-> [bob:host:(1) 0.009500] [s4u_test/INFO] Write 100000 bytes on /home/tmp/data.txt
-> [bob:host:(1) 0.009500] [s4u_test/INFO] Move '/home/tmp/data.txt' to '/home/tmp/simgrid.readme'
+> [bob:host:(1) 0.007000] [s4u_test/INFO] Read 200000 bytes on /scratch/tmp/data.txt
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Write 100000 bytes on /scratch/tmp/data.txt
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Move '/scratch/tmp/data.txt' to '/scratch/tmp/simgrid.readme'
> [bob:host:(1) 0.009500] [s4u_test/INFO] User data attached to the file: 777
> [bob:host:(1) 0.009500] [s4u_test/INFO] Storage info on bob:
-> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/home) Used: 37233331; Free: 536833678669; Total: 536870912000.
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/scratch) Used: 37233331; Free: 536833678669; Total: 536870912000.
> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk2 ((null)) Used: 0; Free: 0; Total: 0.
-> [bob:host:(1) 0.009500] [s4u_test/INFO] Unlink file: '/home/tmp/simgrid.readme'
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Unlink file: '/scratch/tmp/simgrid.readme'
> [bob:host:(1) 0.009500] [s4u_test/INFO] Storage info on bob:
-> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/home) Used: 36933331; Free: 536833978669; Total: 536870912000.
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/scratch) Used: 36933331; Free: 536833978669; Total: 536870912000.
> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk2 ((null)) Used: 0; Free: 0; Total: 0.
const std::unordered_map<std::string, std::string>* get_properties() const;
const char* get_property(const std::string& key) const;
void set_property(const std::string&, const std::string& value);
+ Host* get_host();
void set_data(void* data) { userdata_ = data; }
void* get_data() { return userdata_; }
************/
class DiskImpl : public Resource, public surf::PropertyHolder {
bool currently_destroying_ = false;
+ s4u::Host* host_ = nullptr;
public:
DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
void turn_on() override;
void turn_off() override;
+ s4u::Host* get_host() { return host_; }
+ void set_host(s4u::Host* host) { host_ = host; }
+
void destroy(); // Must be called instead of the destructor
virtual DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
virtual DiskAction* read(sg_size_t size) = 0;
std::map<std::string, sg_size_t>* content;
if (local_storage_)
content = local_storage_->extension<FileSystemStorageExt>()->get_content();
- else
+
+ if (local_disk_)
content = local_disk_->extension<FileSystemDiskExt>()->get_content();
+
// if file does not exist create an empty file
auto sz = content->find(path_);
if (sz != content->end()) {
void File::dump()
{
- XBT_INFO("File Descriptor information:\n"
- "\t\tFull path: '%s'\n"
- "\t\tSize: %llu\n"
- "\t\tMount point: '%s'\n"
- "\t\tStorage Id: '%s'\n"
- "\t\tStorage Type: '%s'\n"
- "\t\tFile Descriptor Id: %d",
- get_path(), size_, mount_point_.c_str(), local_storage_->get_cname(), local_storage_->get_type(), desc_id);
+ if (local_storage_)
+ XBT_INFO("File Descriptor information:\n"
+ "\t\tFull path: '%s'\n"
+ "\t\tSize: %llu\n"
+ "\t\tMount point: '%s'\n"
+ "\t\tStorage Id: '%s'\n"
+ "\t\tStorage Type: '%s'\n"
+ "\t\tFile Descriptor Id: %d",
+ get_path(), size_, mount_point_.c_str(), local_storage_->get_cname(), local_storage_->get_type(), desc_id);
+ if (local_disk_)
+ XBT_INFO("File Descriptor information:\n"
+ "\t\tFull path: '%s'\n"
+ "\t\tSize: %llu\n"
+ "\t\tMount point: '%s'\n"
+ "\t\tDisk Id: '%s'\n"
+ "\t\tHost Id: '%s'\n"
+ "\t\tFile Descriptor Id: %d",
+ get_path(), size_, mount_point_.c_str(), local_disk_->get_cname(), local_disk_->get_host()->get_cname(),
+ desc_id);
}
sg_size_t File::read(sg_size_t size)
return -1;
} else {
XBT_DEBUG("UNLINK %s on disk '%s'", path_.c_str(), name);
+
if (local_storage_)
local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_);
+
if (local_disk_)
local_disk_->extension<FileSystemDiskExt>()->decr_used_size(size_);
int File::remote_copy(sg_host_t host, const char* fullpath)
{
/* Find the host where the file is physically located and read it */
- Storage* storage_src = local_storage_;
- Host* src_host = storage_src->get_host();
+ Host* src_host;
+ if (local_storage_) {
+ src_host = local_storage_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
+ }
+
+ if (local_disk_) {
+ src_host = local_disk_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_disk_->get_cname());
+ }
+
seek(0, SEEK_SET);
- XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
// if the current position is close to the end of the file, we may not be able to read the requested size
- sg_size_t read_size = local_storage_->read(size_);
+ sg_size_t read_size = 0;
+ if (local_storage_)
+ read_size = local_storage_->read(size_);
+ if (local_disk_)
+ read_size = local_disk_->read(size_);
+
current_position_ += read_size;
- /* Find the host that owns the storage where the file has to be copied */
- Storage* storage_dest = nullptr;
- Host* dst_host;
- size_t longest_prefix_length = 0;
-
- for (auto const& elm : host->get_mounted_storages()) {
- std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
- if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
- /* The current mount name is found in the full path and is bigger than the previous*/
- longest_prefix_length = elm.first.length();
- storage_dest = elm.second;
+ Host* dst_host = host;
+ if (local_storage_) {
+ /* Find the host that owns the storage where the file has to be copied */
+ Storage* storage_dest = nullptr;
+ size_t longest_prefix_length = 0;
+
+ for (auto const& elm : host->get_mounted_storages()) {
+ std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
+ if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = elm.first.length();
+ storage_dest = elm.second;
+ }
+ }
+
+ if (storage_dest != nullptr) {
+ /* Mount point found, retrieve the host the storage is attached to */
+ dst_host = storage_dest->get_host();
+ } else {
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
+ return -1;
}
}
- if (storage_dest != nullptr) {
- /* Mount point found, retrieve the host the storage is attached to */
- dst_host = storage_dest->get_host();
- } else {
- XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
- return -1;
+ if (local_disk_) {
+ size_t longest_prefix_length = 0;
+ Disk* dst_disk = nullptr;
+
+ for (auto const& disk : host->get_disks()) {
+ const char* current_mount_str = disk->get_property("mount");
+ if (current_mount_str) {
+ std::string current_mount = std::string(current_mount_str);
+ std::string mount_point = std::string(fullpath).substr(0, current_mount.length());
+ if (mount_point == current_mount && current_mount.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = current_mount.length();
+ dst_disk = disk;
+ }
+ }
+ }
+
+ if (dst_disk == nullptr) {
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
+ return -1;
+ }
}
XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->get_cname(),
- storage_dest->get_host()->get_cname());
+ dst_host->get_cname());
src_host->send_to(dst_host, read_size);
/* Create file on remote host, write it and close it */
File* fd = new File(fullpath, dst_host, nullptr);
- sg_size_t write_size = fd->local_storage_->write(read_size);
- fd->local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
- (*(fd->local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
+ if (local_storage_) {
+ sg_size_t write_size = fd->local_storage_->write(read_size);
+ fd->local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
+ (*(fd->local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
+ }
+ if (local_disk_)
+ fd->write(read_size);
delete fd;
return 0;
}
xbt::signal<void(Disk const&)> Disk::on_destruction;
xbt::signal<void(Disk const&)> Disk::on_state_change;
+Host* Disk::get_host()
+{
+ return pimpl_->get_host();
+}
+
const std::unordered_map<std::string, std::string>* Disk::get_properties() const
{
return pimpl_->get_properties();
mount_list.clear();
host->pimpl_->disks_ = std::move(args->disks);
+ for (auto d : host->pimpl_->disks_)
+ d->set_host(host);
/* Change from the defaults */
if (args->state_trace)