public:
explicit Host(const char *name);
+
/** Host destruction logic */
-protected:
- ~Host(); // TODO, make me private
private:
+ ~Host();
bool currentlyDestroying_ = false;
-
public:
void destroy();
void turnOff();
/** Returns if that host is currently up and running */
bool isOn();
+ /** Returns if that host is currently down and offline */
bool isOff() { return !isOn(); }
double speed();
SIMIX_vm_shutdown(vm, simcall->issuer);
}
-extern xbt_dict_t host_list; // FIXME:killme don't dupplicate the content of s4u::Host this way
- /**
- * @brief Function to destroy a SIMIX VM host.
- *
- * @param vm the vm host to destroy (a sg_host_t)
- */
+/**
+ * @brief Function to destroy a SIMIX VM host.
+ *
+ * @param vm the vm host to destroy (a sg_host_t)
+ */
void SIMIX_vm_destroy(sg_host_t vm)
{
/* this code basically performs a similar thing like SIMIX_host_destroy() */
* Resource *
************/
-VirtualMachine::VirtualMachine(HostModel *model, const char *name, simgrid::s4u::Host *host_PM)
-: HostImpl(model, name, nullptr, nullptr, nullptr)
-, hostPM_(host_PM)
+VirtualMachine::VirtualMachine(HostModel* model, const char* name, simgrid::s4u::Host* host_PM)
+ : HostImpl(model, name, nullptr /*constraint*/, nullptr /*storage*/, nullptr /*cpu*/), hostPM_(host_PM)
{
/* Register this VM to the list of all VMs */
allVms_.push_back(this);
piface_ = new simgrid::s4u::Host(name);
piface_->extension_set<simgrid::surf::HostImpl>(this);
- /* Currently, we assume a VM has no storage. */
- storage_ = nullptr;
-
/* 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
* from the VM name, we have to make sure that the system does not call the
* free callback for the network resource object. The network resource object
* is still used by the physical machine. */
- sg_host_t host_VM = piface_;
- host_VM->pimpl_netcard = host_PM->pimpl_netcard;
-
- vmState_ = SURF_VM_STATE_CREATED;
+ piface_->pimpl_netcard = host_PM->pimpl_netcard;
// //// CPU RELATED STUFF ////
// Roughly, create a vcpu resource by using the values of the sub_cpu one.
CpuCas01 *sub_cpu = dynamic_cast<CpuCas01*>(host_PM->pimpl_cpu);
- cpu_ = surf_cpu_model_vm->createCpu(host_VM, sub_cpu->getSpeedPeakList(), 1 /*cores*/);
+ cpu_ = surf_cpu_model_vm->createCpu(piface_, sub_cpu->getSpeedPeakList(), 1 /*cores*/);
if (sub_cpu->getPState() != 0)
cpu_->setPState(sub_cpu->getPState());