Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'xbt_random' into 'master'
[simgrid.git] / src / plugins / vm / VmLiveMigration.cpp
index 460e9f4..a828f8a 100644 (file)
@@ -9,7 +9,7 @@
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
 #include "src/plugins/vm/VmHostExt.hpp"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(vm_live_migration, "S4U virtual machines live migration");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(vm_live_migration, s4u, "S4U virtual machines live migration");
 
 namespace simgrid {
 namespace vm {
@@ -107,7 +107,7 @@ sg_size_t MigrationTx::sendMigrationData(sg_size_t size, int stage, int stage2_r
       comm = mbox->put_init(msg, size)->set_rate(mig_speed)->wait_for(timeout);
     else
       comm = mbox->put_async(msg, size)->wait_for(timeout);
-  } catch (const xbt_ex&) {
+  } catch (const Exception&) {
     if (comm) {
       sg_size_t remaining = static_cast<sg_size_t>(comm->get_remaining());
       XBT_VERB("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu", timeout, remaining, size);
@@ -182,7 +182,7 @@ void MigrationTx::operator()()
     } else if (sent > ramsize)
       XBT_CRITICAL("bug");
 
-  } catch (const xbt_ex&) {
+  } catch (const Exception&) {
     // hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
     // Stop the dirty page tracking an return (there is no memory space to release)
     sg_vm_stop_dirty_page_tracking(vm_);
@@ -222,7 +222,7 @@ void MigrationTx::operator()()
       try {
         XBT_DEBUG("Stage 2, gonna send %llu", updated_size);
         sent = sendMigrationData(updated_size, 2, stage2_round, mig_speed, mig_timeout);
-      } catch (const xbt_ex&) {
+      } catch (const Exception&) {
         // hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data
         // code)
         // Stop the dirty page tracking an return (there is no memory space to release)
@@ -266,7 +266,7 @@ void MigrationTx::operator()()
   try {
     XBT_DEBUG("Stage 3: Gonna send %zu bytes", remaining_size);
     sendMigrationData(remaining_size, 3, 0, mig_speed, -1);
-  } catch (const xbt_ex&) {
+  } catch (const Exception&) {
     // hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
     // Stop the dirty page tracking an return (there is no memory space to release)
     vm_->resume();
@@ -324,14 +324,21 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
   simgrid::s4u::Host* src_pm = vm->get_pm();
 
   if (not src_pm->is_on())
-    THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->get_cname(),
-           src_pm->get_cname());
+    throw simgrid::VmFailureException(
+        XBT_THROW_POINT, simgrid::xbt::string_printf("Cannot migrate VM '%s' from host '%s', which is offline.",
+                                                     vm->get_cname(), src_pm->get_cname()));
   if (not dst_pm->is_on())
-    THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->get_cname(), dst_pm->get_cname());
+    throw simgrid::VmFailureException(
+        XBT_THROW_POINT, simgrid::xbt::string_printf("Cannot migrate VM '%s' to host '%s', which is offline.",
+                                                     vm->get_cname(), dst_pm->get_cname()));
   if (vm->get_state() != simgrid::s4u::VirtualMachine::state::RUNNING)
-    THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->get_cname());
+    throw simgrid::VmFailureException(
+        XBT_THROW_POINT,
+        simgrid::xbt::string_printf("Cannot migrate VM '%s' that is not running yet.", vm->get_cname()));
   if (vm->get_impl()->is_migrating_)
-    THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->get_cname());
+    throw simgrid::VmFailureException(
+        XBT_THROW_POINT,
+        simgrid::xbt::string_printf("Cannot migrate VM '%s' that is already migrating.", vm->get_cname()));
 
   vm->get_impl()->is_migrating_ = true;
   simgrid::s4u::VirtualMachine::on_migration_start(*vm);