1 /* Copyright (c) 2004-2013. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "workstation_interface.hpp"
9 #ifndef VM_WORKSTATION_INTERFACE_HPP_
10 #define VM_WORKSTATION_INTERFACE_HPP_
12 #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM
13 // It corresponds to the cost of a VM running no tasks.
15 void surf_vm_workstation_model_init(void);
21 class WorkstationVMModel;
22 typedef WorkstationVMModel *WorkstationVMModelPtr;
25 typedef WorkstationVM *WorkstationVMPtr;
27 class WorkstationVMLmm;
28 typedef WorkstationVMLmm *WorkstationVMLmmPtr;
33 /** @ingroup SURF_vm_workstation_interface
34 * @brief SURF workstation VM model interface class
35 * @details A model is an object which handle the interactions between its Resources and its Actions
37 class WorkstationVMModel : public WorkstationModel {
40 * @brief WorkstationVMModel consrtuctor
45 * @brief WorkstationVMModel consrtuctor
47 ~WorkstationVMModel(){};
50 * @brief Create a new WorkstationVM
52 * @param name The name of the new WorkstationVM
53 * @param ind_phys_workstation The workstation hosting the VM
56 virtual void createResource(const char *name, void *ind_phys_workstation)=0;
59 void adjustWeightOfDummyCpuActions() {};
66 /** @ingroup SURF_vm_workstation_interface
67 * @brief SURF workstation VM interface class
68 * @details A workstation VM represent an virtual machine
70 class WorkstationVM : public Workstation {
73 * @brief WorkstationVM consrtructor
75 * @param model WorkstationModel associated to this Workstation
76 * @param name The name of the Workstation
77 * @param props Dictionary of properties associated to this Workstation
78 * @param netElm The RoutingEdge associated to this Workstation
79 * @param cpu The Cpu associated to this Workstation
81 WorkstationVM(ModelPtr model, const char *name, xbt_dict_t props,
82 RoutingEdgePtr netElm, CpuPtr cpu)
83 : Workstation(model, name, props, NULL, netElm, cpu) {}
86 * @brief WdorkstationVM estructor
91 * @brief Suspend the VM
93 virtual void suspend()=0;
96 * @brief Resume the VM
98 virtual void resume()=0;
101 * @brief Save the VM (Not yet implemented)
103 virtual void save()=0;
106 * @brief Restore the VM (Not yet implemented)
108 virtual void restore()=0;
111 * @brief Migrate the VM to the destination host
113 * @param ind_vm_ws_dest The destination host
115 virtual void migrate(surf_resource_t ind_vm_ws_dest)=0;
118 * @brief Get the physical machine hosting the VM
119 * @return The physical machine hosting the VM
121 virtual surf_resource_t getPm()=0;
123 virtual void setBound(double bound)=0;
124 virtual void setAffinity(CpuPtr cpu, unsigned long mask)=0;
126 /* The workstation object of the lower layer */
127 CpuActionPtr p_action;
128 WorkstationPtr p_subWs; // Pointer to the ''host'' OS
129 e_surf_vm_state_t p_currentState;
136 #endif /* VM_WORKSTATION_INTERFACE_HPP_ */