X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f5a24e63c4711950e12735bda603ed31fd8403a7..c527cde5e1ee1bfe22dd33b3bbb77aaae8bcdcb1:/src/surf/virtual_machine.cpp diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index f79808378a..76d945a257 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -82,7 +82,8 @@ double VMModel::nextOccuringEvent(double now) xbt_assert(cpu, "cpu-less host"); double solved_value = ws_vm->action_->getVariable()->value; - XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getName(), ws_vm->getPm()->name().c_str()); + XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->piface_->name().c_str(), + ws_vm->getPm()->name().c_str()); // TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution. // cpu_cas01->constraint->bound = solved_value; @@ -104,14 +105,11 @@ double VMModel::nextOccuringEvent(double now) ************/ VirtualMachine::VirtualMachine(HostModel* model, const char* name, simgrid::s4u::Host* host_PM) - : HostImpl(model, name, nullptr /*constraint*/, nullptr /*storage*/), hostPM_(host_PM) + : HostImpl(new simgrid::s4u::Host(name), nullptr /*storage*/), hostPM_(host_PM) { /* Register this VM to the list of all VMs */ allVms_.push_back(this); - piface_ = new simgrid::s4u::Host(name); - piface_->pimpl_ = this; - /* Currently, a VM uses the network resource of its physical host. In * host_lib, this network resource object is referred from two different keys. * When deregistering the reference that points the network resource object @@ -190,13 +188,12 @@ 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* vm_name = piface_->name().c_str(); const char* pm_name_src = hostPM_->name().c_str(); - const char* pm_name_dst = surfHost_dst->getName(); + const char* pm_name_dst = host_dest->name().c_str(); /* 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; + piface_->pimpl_netcard = host_dest->pimpl_netcard; hostPM_ = host_dest;