1 /* Copyright (c) 2004-2016. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/s4u.hpp"
8 #ifndef VM_LIVE_MIGRATION_HPP_
9 #define VM_LIVE_MIGRATION_HPP_
15 /* The miration_rx process uses mbox_ctl to let the caller of do_migration() know the completion of the migration. */
16 s4u::MailboxPtr mbox_ctl;
17 /* The migration_rx and migration_tx processes use mbox to transfer migration data. */
19 s4u::VirtualMachine* vm_;
20 s4u::Host* src_pm_ = nullptr;
21 s4u::Host* dst_pm_ = nullptr;
24 explicit MigrationRx(s4u::VirtualMachine* vm, s4u::Host* dst_pm) : vm_(vm), dst_pm_(dst_pm)
26 src_pm_ = vm_->getPm();
28 mbox_ctl = s4u::Mailbox::byName(std::string("__mbox_mig_ctl:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" +
29 dst_pm_->getCname() + ")");
30 mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" +
31 dst_pm_->getCname() + ")");
37 /* The migration_rx and migration_tx processes use mbox to transfer migration data. */
39 s4u::VirtualMachine* vm_;
40 s4u::Host* src_pm_ = nullptr;
41 s4u::Host* dst_pm_ = nullptr;
44 explicit MigrationTx(s4u::VirtualMachine* vm, s4u::Host* dst_pm) : vm_(vm), dst_pm_(dst_pm)
46 src_pm_ = vm_->getPm();
47 mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" +
48 dst_pm_->getCname() + ")");
51 sg_size_t sendMigrationData(sg_size_t size, int stage, int stage2_round, double mig_speed, double timeout);