- // Copy the reference to the vm (if SRC crashes now, do_migration will free ms)
- // This is clearly ugly but I (Adrien) need more time to do something cleaner (actually we should copy the whole ms
- // structure at the beginning and free it at the end of each function)
- simgrid::s4u::VirtualMachine* vm = vm_;
- simgrid::s4u::Host* dst_pm = dst_pm_;
-
- // Make sure that we cannot get interrupted between the migrate and the resume to not end in an inconsistent state
- simgrid::simix::kernelImmediate([vm, dst_pm]() {
- /* Update the vm location */
- /* precopy migration makes the VM temporally paused */
- xbt_assert(vm->getState() == SURF_VM_STATE_SUSPENDED);
-
- /* Update the vm location and resume it */
- vm->pimpl_vm_->setPm(dst_pm);
- vm->resume();
- });
+ /* Update the vm location */
+ /* precopy migration makes the VM temporally paused */
+ xbt_assert(vm_->getState() == SURF_VM_STATE_SUSPENDED);
+
+ /* Update the vm location and resume it */
+ vm_->setPm(dst_pm_);
+ vm_->resume();