From a519c335d0eff55715920c3eaf8d0a5007406e91 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 17 Oct 2016 20:55:17 +0200 Subject: [PATCH] reindent after previous changes --- src/s4u/s4u_host.cpp | 24 +++++------------ src/simix/smx_vm.cpp | 14 +++------- src/surf/plugins/energy.cpp | 2 +- src/surf/virtual_machine.cpp | 50 ++++++++++++++++++------------------ 4 files changed, 36 insertions(+), 54 deletions(-) diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 56229fed33..5675bf1dca 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -137,9 +137,7 @@ boost::unordered_map const& Host::mountedStorages() { /** Get the properties assigned to a host */ xbt_dict_t Host::properties() { - return simgrid::simix::kernelImmediate([&] { - return this->pimpl_->getProperties(); - }); + return simgrid::simix::kernelImmediate([&] { return this->pimpl_->getProperties(); }); } /** Retrieve the property value (or nullptr if not set) */ @@ -147,9 +145,7 @@ const char*Host::property(const char*key) { return this->pimpl_->getProperty(key); } void Host::setProperty(const char*key, const char *value){ - simgrid::simix::kernelImmediate([&] { - this->pimpl_->setProperty(key,value); - }); + simgrid::simix::kernelImmediate([&] { this->pimpl_->setProperty(key, value); }); } /** Get the processes attached to the host */ @@ -200,16 +196,12 @@ int Host::pstate() void Host::parameters(vm_params_t params) { - simgrid::simix::kernelImmediate([&]() { - this->pimpl_->getParams(params); - }); + simgrid::simix::kernelImmediate([&]() { this->pimpl_->getParams(params); }); } void Host::setParameters(vm_params_t params) { - simgrid::simix::kernelImmediate([&]() { - this->pimpl_->setParams(params); - }); + simgrid::simix::kernelImmediate([&]() { this->pimpl_->setParams(params); }); } /** @@ -219,9 +211,7 @@ void Host::setParameters(vm_params_t params) */ xbt_dict_t Host::mountedStoragesAsDict() { - return simgrid::simix::kernelImmediate([&] { - return this->pimpl_->getMountedStorageList(); - }); + return simgrid::simix::kernelImmediate([&] { return this->pimpl_->getMountedStorageList(); }); } /** @@ -231,9 +221,7 @@ xbt_dict_t Host::mountedStoragesAsDict() */ xbt_dynar_t Host::attachedStorages() { - return simgrid::simix::kernelImmediate([&] { - return this->pimpl_->getAttachedStorageList(); - }); + return simgrid::simix::kernelImmediate([&] { return this->pimpl_->getAttachedStorageList(); }); } } // namespace simgrid diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index fec4850959..1203a519a5 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -42,7 +42,7 @@ static int __can_be_started(sg_host_t vm) } long total_ramsize_of_vms = 0; - xbt_dynar_t dyn_vms = pm->pimpl_->getVms(); + xbt_dynar_t dyn_vms = pm->pimpl_->getVms(); { unsigned int cursor = 0; sg_host_t another_vm; @@ -66,9 +66,7 @@ static int __can_be_started(sg_host_t vm) void SIMIX_vm_start(sg_host_t vm) { if (__can_be_started(vm)) - static_cast( - vm->pimpl_ - )->setState(SURF_VM_STATE_RUNNING); + static_cast(vm->pimpl_)->setState(SURF_VM_STATE_RUNNING); else THROWF(vm_error, 0, "The VM %s cannot be started", vm->name().c_str()); } @@ -76,9 +74,7 @@ void SIMIX_vm_start(sg_host_t vm) e_surf_vm_state_t SIMIX_vm_get_state(sg_host_t vm) { - return static_cast( - vm->pimpl_ - )->getState(); + return static_cast(vm->pimpl_)->getState(); } /** @@ -288,9 +284,7 @@ void SIMIX_vm_shutdown(sg_host_t vm, smx_actor_t issuer) } /* FIXME: we may have to do something at the surf layer, e.g., vcpu action */ - static_cast( - vm->pimpl_ - )->setState(SURF_VM_STATE_CREATED); + static_cast(vm->pimpl_)->setState(SURF_VM_STATE_CREATED); } void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t vm) diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 32e79f7cf3..48c724f6dd 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -245,7 +245,7 @@ static void onActionStateChange(simgrid::surf::CpuAction *action, simgrid::surf: sg_host_t sghost = sg_host_by_name(name); if(sghost == nullptr) continue; - simgrid::surf::HostImpl *host = sghost->pimpl_; + simgrid::surf::HostImpl* host = sghost->pimpl_; simgrid::surf::VirtualMachine *vm = dynamic_cast(host); if (vm) // If it's a VM, take the corresponding PM host = vm->getPm()->pimpl_; diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index f28f6aed57..1e01169b06 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -203,31 +203,31 @@ sg_host_t VirtualMachine::getPm() { /* Update the physical host of the given VM */ void VirtualMachine::migrate(sg_host_t host_dest) { - HostImpl *surfHost_dst = host_dest->pimpl_; - const char *vm_name = getName(); - const char *pm_name_src = hostPM_->name().c_str(); - const char *pm_name_dst = surfHost_dst->getName(); - - /* update net_elm with that of the destination physical host */ - sg_host_by_name(vm_name)->pimpl_netcard = sg_host_by_name(pm_name_dst)->pimpl_netcard; - - hostPM_ = host_dest; - - /* Update vcpu's action for the new pm */ - /* create a cpu action bound to the pm model at the destination. */ - CpuAction *new_cpu_action = static_cast(host_dest->pimpl_cpu->execution_start(0)); - - Action::State state = action_->getState(); - if (state != Action::State::done) - XBT_CRITICAL("FIXME: may need a proper handling, %d", static_cast(state)); - if (action_->getRemainsNoUpdate() > 0) - XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate()); - - /* keep the bound value of the cpu action of the VM. */ - double old_bound = action_->getBound(); - if (old_bound != 0) { - XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst); - new_cpu_action->setBound(old_bound); + HostImpl* surfHost_dst = host_dest->pimpl_; + const char* vm_name = getName(); + const char* pm_name_src = hostPM_->name().c_str(); + const char* pm_name_dst = surfHost_dst->getName(); + + /* update net_elm with that of the destination physical host */ + sg_host_by_name(vm_name)->pimpl_netcard = sg_host_by_name(pm_name_dst)->pimpl_netcard; + + hostPM_ = host_dest; + + /* Update vcpu's action for the new pm */ + /* create a cpu action bound to the pm model at the destination. */ + CpuAction* new_cpu_action = static_cast(host_dest->pimpl_cpu->execution_start(0)); + + Action::State state = action_->getState(); + if (state != Action::State::done) + XBT_CRITICAL("FIXME: may need a proper handling, %d", static_cast(state)); + if (action_->getRemainsNoUpdate() > 0) + XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate()); + + /* keep the bound value of the cpu action of the VM. */ + double old_bound = action_->getBound(); + if (old_bound != 0) { + XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst); + new_cpu_action->setBound(old_bound); } XBT_ATTRIB_UNUSED int ret = action_->unref(); -- 2.20.1