WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
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
wrench::S4U_VirtualMachine::getNumCores
unsigned long getNumCores()
Get the number of cores.
Definition: S4U_VirtualMachine.cpp:61
wrench::S4U_VirtualMachine::getMessagePayloadList
std::map< std::string, double > getMessagePayloadList()
Get the message payload list for the bare_metal that will run on the VM ({} means "use all defaults")
Definition: S4U_VirtualMachine.cpp:193
wrench::S4U_VirtualMachine::getPhysicalHostname
std::string getPhysicalHostname()
Get the physical hostname.
Definition: S4U_VirtualMachine.cpp:48
wrench::S4U_VirtualMachine::suspend
void suspend()
Suspend the VM.
Definition: S4U_VirtualMachine.cpp:102
wrench::S4U_VirtualMachine::getMemory
double getMemory()
Get the memory_manager_service consumption.
Definition: S4U_VirtualMachine.cpp:69
wrench::S4U_VirtualMachine::start
void start(std::string &pm_name)
Start the VM.
Definition: S4U_VirtualMachine.cpp:77
wrench
Definition: Alarm.cpp:20
wrench::S4U_VirtualMachine::getStateAsString
std::string getStateAsString()
Get the VM's state as a string.
Definition: S4U_VirtualMachine.cpp:151
wrench::S4U_VirtualMachine::State
State
VM state enum.
Definition: S4U_VirtualMachine.h:36
wrench::S4U_VirtualMachine::migrate
void migrate(const std::string &dst_pm_name)
Migrate the VM.
Definition: S4U_VirtualMachine.cpp:168
wrench::S4U_VirtualMachine::getState
State getState()
Get the VM's state.
Definition: S4U_VirtualMachine.cpp:143
wrench::S4U_VirtualMachine
A wrapper for the simgrid::s4u::VirtualMachine class.
Definition: S4U_VirtualMachine.h:26
wrench::S4U_VirtualMachine::vm_to_pm_map
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
wrench::S4U_VirtualMachine::S4U_VirtualMachine
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
wrench::S4U_VirtualMachine::shutdown
void shutdown()
Shutdown the VM.
Definition: S4U_VirtualMachine.cpp:126
wrench::S4U_VirtualMachine::resume
void resume()
Resume the VM.
Definition: S4U_VirtualMachine.cpp:114
wrench::S4U_VirtualMachine::getPropertyList
std::map< std::string, std::string > getPropertyList()
Get the property list for the bare_metal that is to run on the VM ({} means "use all defaults")
Definition: S4U_VirtualMachine.cpp:185