/** 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) */
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 */
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); });
}
/**
*/
xbt_dict_t Host::mountedStoragesAsDict()
{
- return simgrid::simix::kernelImmediate([&] {
- return this->pimpl_->getMountedStorageList();
- });
+ return simgrid::simix::kernelImmediate([&] { return this->pimpl_->getMountedStorageList(); });
}
/**
*/
xbt_dynar_t Host::attachedStorages()
{
- return simgrid::simix::kernelImmediate([&] {
- return this->pimpl_->getAttachedStorageList();
- });
+ return simgrid::simix::kernelImmediate([&] { return this->pimpl_->getAttachedStorageList(); });
}
} // namespace simgrid
}
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;
void SIMIX_vm_start(sg_host_t vm)
{
if (__can_be_started(vm))
- static_cast<simgrid::surf::VirtualMachine*>(
- vm->pimpl_
- )->setState(SURF_VM_STATE_RUNNING);
+ static_cast<simgrid::surf::VirtualMachine*>(vm->pimpl_)->setState(SURF_VM_STATE_RUNNING);
else
THROWF(vm_error, 0, "The VM %s cannot be started", vm->name().c_str());
}
e_surf_vm_state_t SIMIX_vm_get_state(sg_host_t vm)
{
- return static_cast<simgrid::surf::VirtualMachine*>(
- vm->pimpl_
- )->getState();
+ return static_cast<simgrid::surf::VirtualMachine*>(vm->pimpl_)->getState();
}
/**
}
/* FIXME: we may have to do something at the surf layer, e.g., vcpu action */
- static_cast<simgrid::surf::VirtualMachine*>(
- vm->pimpl_
- )->setState(SURF_VM_STATE_CREATED);
+ static_cast<simgrid::surf::VirtualMachine*>(vm->pimpl_)->setState(SURF_VM_STATE_CREATED);
}
void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t vm)
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<simgrid::surf::VirtualMachine*>(host);
if (vm) // If it's a VM, take the corresponding PM
host = vm->getPm()->pimpl_;
/* 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<CpuAction*>(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<int>(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<CpuAction*>(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<int>(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();