- /* Make a process container */
- extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
-
- if (TRACE_vm_is_enabled()) {
- container_t host_container = instr::Container::byName(pm->getName());
- new instr::Container(name, "MSG_VM", host_container);
- instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("start", "0 0 1"); // start is blue
- instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("suspend", "1 0 0"); // suspend is red
- }
+ // Create a VCPU for this VM
+ std::vector<double> speeds;
+ for (int i = 0; i < physical_host->get_pstate_count(); i++)
+ speeds.push_back(physical_host->get_pstate_speed(i));
+
+ physical_host->get_netpoint()
+ ->get_englobing_zone()
+ ->get_cpu_vm_model()
+ ->create_cpu(this, speeds)
+ ->set_core_count(core_amount)
+ ->seal();
+ if (physical_host->get_pstate() != 0)
+ set_pstate(physical_host->get_pstate());
+
+ // Real hosts are (only) created through NetZone::create_host(), and this where the on_creation signal is fired.
+ // VMs are created directly, thus firing the signal here. The right solution is probably to separate Host and VM.
+ simgrid::s4u::Host::on_creation(*this);