S4U_VirtualMachine.h
1 
11 #ifndef WRENCH_S4U_VIRTUALMACHINE_H
12 #define WRENCH_S4U_VIRTUALMACHINE_H
13 
14 #include <simgrid/s4u/VirtualMachine.hpp>
15 #include <set>
16 
17 namespace wrench {
18 
19  /***********************/
21  /***********************/
22 
27 
28  public:
29 
33  static std::unordered_map<std::string, std::string> vm_to_pm_map;
34 
36  enum State {
37  DOWN,
38  RUNNING,
39  SUSPENDED
40  };
41 
42  S4U_VirtualMachine(const std::string &vm_hostname,
43  unsigned long num_cores,
44  double ram_memory,
45  std::map<std::string, std::string> property_list,
46  std::map<std::string, double> messagepayload_list);
47 
48  void start(std::string &pm_name);
49 
50  void suspend();
51 
52  void resume();
53 
54  void shutdown();
55 
56  void migrate(const std::string &dst_pm_name);
57 
58  std::string getPhysicalHostname();
59  unsigned long getNumCores();
60  double getMemory();
61  std::map<std::string, std::string> getPropertyList();
62  std::map<std::string, double> getMessagePayloadList();
63 
64  State getState();
65  std::string getStateAsString();
66 
67 
68  private:
69  State state;
70  std::string vm_name;
71  simgrid::s4u::VirtualMachine *vm;
72  unsigned long num_cores;
73  double ram_memory;
74  std::string pm_name;
75  std::map<std::string, std::string> property_list;
76  std::map<std::string, double> messagepayload_list;
77  };
78 
79  /***********************/
81  /***********************/
82 }
83 
84 #endif //WRENCH_S4U_VIRTUALMACHINE_H
unsigned long getNumCores()
Get the number of cores.
Definition: S4U_VirtualMachine.cpp:61
std::map< std::string, double > getMessagePayloadList()
Get the message payload list for the BareMetalComputeService that will run on the VM ({} means "use a...
Definition: S4U_VirtualMachine.cpp:193
std::string getPhysicalHostname()
Get the physical hostname.
Definition: S4U_VirtualMachine.cpp:48
void suspend()
Suspend the VM.
Definition: S4U_VirtualMachine.cpp:102
double getMemory()
Get the memory consumption.
Definition: S4U_VirtualMachine.cpp:69
void start(std::string &pm_name)
Start the VM.
Definition: S4U_VirtualMachine.cpp:77
Definition: Alarm.cpp:20
std::string getStateAsString()
Get the VM's state as a string.
Definition: S4U_VirtualMachine.cpp:151
State
VM state enum.
Definition: S4U_VirtualMachine.h:36
void migrate(const std::string &dst_pm_name)
Migrate the VM.
Definition: S4U_VirtualMachine.cpp:168
State getState()
Get the VM's state.
Definition: S4U_VirtualMachine.cpp:143
A wrapper for the simgrid::s4u::VirtualMachine class.
Definition: S4U_VirtualMachine.h:26
static std::unordered_map< std::string, std::string > vm_to_pm_map
A map to keep track of VM-to-PM mapping.
Definition: S4U_VirtualMachine.h:33
S4U_VirtualMachine(const std::string &vm_hostname, unsigned long num_cores, double ram_memory, std::map< std::string, std::string > property_list, std::map< std::string, double > messagepayload_list)
Constructor.
Definition: S4U_VirtualMachine.cpp:34
void shutdown()
Shutdown the VM.
Definition: S4U_VirtualMachine.cpp:126
void resume()
Resume the VM.
Definition: S4U_VirtualMachine.cpp:114
std::map< std::string, std::string > getPropertyList()
Get the property list for the BareMetalComputeService that is to run on the VM ({} means "use all def...
Definition: S4U_VirtualMachine.cpp:185