- /* ind_phys_workstation equals to smx_host_t */
- surf_resource_t ind_vm_workstation = xbt_lib_get_elm_or_null(host_lib, getName());
-
- /* Before clearing the entries in host_lib, we have to pick up resources. */
- CpuCas01Ptr cpu = dynamic_cast<CpuCas01Ptr>(
- static_cast<ResourcePtr>(
- surf_cpu_resource_priv(ind_vm_workstation)));
-
- /* We deregister objects from host_lib, without invoking the freeing callback
- * of each level.
- *
- * Do not call xbt_lib_remove() here. It deletes all levels of the key,
- * including MSG_HOST_LEVEL and others. We should unregister only what we know.
- */
- xbt_lib_unset(host_lib, getName(), SURF_CPU_LEVEL, 0);
- xbt_lib_unset(host_lib, getName(), ROUTING_HOST_LEVEL, 0);
- xbt_lib_unset(host_lib, getName(), SURF_WKS_LEVEL, 0);
-
- /* TODO: comment out when VM stroage is implemented. */
- // xbt_lib_unset(host_lib, name, SURF_STORAGE_LEVEL, 0);
-
-
- /* Free the cpu_action of the VM. */
- int ret = p_action->unref();
- xbt_assert(ret == 1, "Bug: some resource still remains");
-
- /* Free the cpu resource of the VM. If using power_trace, we will have to */
- delete cpu;
+ surf_callback_emit(workstationVMDestructedCallbacks, this);
+ WorkstationVMModel::ws_vms.erase(WorkstationVMModel::
+ vm_list_t::s_iterator_to(*this));
+}
+
+void WorkstationVM::setState(e_surf_resource_state_t state){
+ Resource::setState(state);
+ surf_callback_emit(workstationVMStateChangedCallbacks, this);