-/* Copyright (c) 2004-2013. The SimGrid Team.
+/* Copyright (c) 2004-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM
// It corresponds to the cost of a VM running no tasks.
-void surf_vm_workstation_model_init(void);
-
/***********
* Classes *
***********/
class WorkstationVMLmm;
typedef WorkstationVMLmm *WorkstationVMLmmPtr;
+/*************
+ * Callbacks *
+ *************/
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after WorkstationVM creation *
+ * @details Callback functions have the following signature: `void(WorkstationVMPtr)`
+ */
+extern surf_callback(void, WorkstationVMPtr) workstationVMCreatedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after WorkstationVM destruction *
+ * @details Callback functions have the following signature: `void(WorkstationVMPtr)`
+ */
+extern surf_callback(void, WorkstationVMPtr) workstationVMDestructedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after WorkstationVM State changed *
+ * @details Callback functions have the following signature: `void(WorkstationVMActionPtr)`
+ */
+extern surf_callback(void, WorkstationVMPtr) workstationVMStateChangedCallbacks;
+
/*********
* Model *
*********/
*/
~WorkstationVMModel(){};
+ WorkstationPtr createWorkstation(const char *name){DIE_IMPOSSIBLE;}
+
/**
* @brief Create a new WorkstationVM
- *
+ *
* @param name The name of the new WorkstationVM
* @param ind_phys_workstation The workstation hosting the VM
- *
+ *
*/
- virtual void createResource(const char *name, void *ind_phys_workstation)=0;
-
-
+ virtual WorkstationVMPtr createWorkstationVM(const char *name, surf_resource_t ind_phys_workstation)=0;
void adjustWeightOfDummyCpuActions() {};
+
+ typedef boost::intrusive::list<WorkstationVM,
+ boost::intrusive::constant_time_size<false> >
+ vm_list_t;
+ static vm_list_t ws_vms;
};
/************
* @brief SURF workstation VM interface class
* @details A workstation VM represent an virtual machine
*/
-class WorkstationVM : public Workstation {
+class WorkstationVM : public Workstation,
+ public boost::intrusive::list_base_hook<> {
public:
/**
* @brief WorkstationVM consrtructor
- *
+ *
* @param model WorkstationModel associated to this Workstation
* @param name The name of the Workstation
* @param props Dictionary of properties associated to this Workstation
* @param cpu The Cpu associated to this Workstation
*/
WorkstationVM(ModelPtr model, const char *name, xbt_dict_t props,
- RoutingEdgePtr netElm, CpuPtr cpu)
- : Workstation(model, name, props, NULL, netElm, cpu) {}
+ RoutingEdgePtr netElm, CpuPtr cpu);
/**
- * @brief WdorkstationVM estructor
+ * @brief WdorkstationVM destructor
*/
~WorkstationVM();
+ void setState(e_surf_resource_state_t state);
+
/**
* @brief Suspend the VM
*/
/**
* @brief Migrate the VM to the destination host
- *
+ *
* @param ind_vm_ws_dest The destination host
*/
virtual void migrate(surf_resource_t ind_vm_ws_dest)=0;