Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
VM: getters should not be simcalls
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 22 Nov 2016 09:37:07 +0000 (10:37 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 22 Nov 2016 09:40:52 +0000 (10:40 +0100)
Removing a simcall changes a bit the output, but that's ok

examples/msg/cloud-migration/cloud-migration.tesh
include/simgrid/simix.h
src/msg/msg_vm.cpp
src/simix/libsmx.cpp

index c66bb02..2c11900 100644 (file)
@@ -12,13 +12,13 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-migration ${srcdir:=.}/small_platform.xml --
 > [146.111793] (11:__pr_mig_tx:VM1(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms
 > [411.540563] (0:maestro@) FIXME: may need a proper handling, 1
 > [411.540563] (0:maestro@) FIXME: may need a proper handling, 1
-> [411.566271] (7:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s
+> [411.566271] (8:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s
 > [411.566271] (6:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.454 s
 > [10146.111793] (1:master_@Fafard) Test: Migrate two VMs at once to different PMs
 > [10146.111793] (15:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms
 > [10146.111793] (17:__pr_mig_tx:VM1(Fafard-Bourassa)@Fafard) use the default max_downtime value 30ms
 > [10362.613818] (0:maestro@) FIXME: may need a proper handling, 1
-> [10362.620589] (13:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s
+> [10362.620589] (14:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s
 > [10411.521626] (0:maestro@) FIXME: may need a proper handling, 1
 > [10411.547334] (12:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.436 s
 > [20146.111793] (0:maestro@) Bye (simulation time 20146.1)
index cbd0318..7afd8d2 100644 (file)
@@ -260,7 +260,6 @@ XBT_PUBLIC(e_smx_state_t) simcall_execution_wait(smx_activity_t execution);
 /******************************* VM simcalls ********************************/
 // Create the vm_workstation at the SURF level
 XBT_PUBLIC(void) simcall_vm_start(sg_host_t vm);
-XBT_PUBLIC(void *) simcall_vm_get_pm(sg_host_t vm);
 XBT_PUBLIC(void) simcall_vm_set_bound(sg_host_t vm, double bound);
 XBT_PUBLIC(void) simcall_vm_resume(sg_host_t vm);
 XBT_PUBLIC(void) simcall_vm_save(sg_host_t vm);
index b91f255..2e9c361 100644 (file)
@@ -871,7 +871,8 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm)
    * The second one would be easier.
    */
 
-  msg_host_t old_pm = (msg_host_t) simcall_vm_get_pm(vm);
+  simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_;
+  msg_host_t old_pm                        = pimpl->getPm();
 
   if(MSG_host_is_off(old_pm))
     THROWF(vm_error, 0, "SRC host(%s) seems off, cannot start a migration", sg_host_get_name(old_pm));
@@ -885,8 +886,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm)
   if (MSG_vm_is_migrating(vm))
     THROWF(vm_error, 0, "VM(%s) is already migrating", sg_host_get_name(vm));
 
-  simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_;
-  pimpl->isMigrating                       = 1;
+  pimpl->isMigrating = 1;
 
   {
     int ret = do_migration(vm, old_pm, new_pm);
@@ -994,7 +994,7 @@ void MSG_vm_restore(msg_vm_t vm)
  */
 msg_host_t MSG_vm_get_pm(msg_vm_t vm)
 {
-  return (msg_host_t) simcall_vm_get_pm(vm);
+  return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getPm();
 }
 
 /** @brief Set a CPU bound for a given VM.
index 606f99a..a3bf0a9 100644 (file)
@@ -186,19 +186,6 @@ void simcall_vm_start(sg_host_t vm)
   simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_start, vm));
 }
 
-/**
- * \ingroup simix_vm_management
- * \brief Get the physical host on which the given VM runs.
- *
- * \param vm VM
- * \return The physical host
- */
-void *simcall_vm_get_pm(sg_host_t vm)
-{
-  return simgrid::simix::kernelImmediate(
-      [vm]() { return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getPm(); });
-}
-
 /**
  * @brief Function to set the CPU bound of the given SIMIX VM host.
  *