WRENCH  1.11
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 #include <wrench/services/Service.h>
17 
18 
19 namespace wrench {
20 
21  /***********************/
23  /***********************/
24 
29 
30  public:
31 
35  static std::unordered_map<std::string,std::string> vm_to_pm_map;
36 
38  enum State {
39  DOWN,
40  RUNNING,
41  SUSPENDED
42  };
43 
44  S4U_VirtualMachine(const std::string &vm_hostname,
45  unsigned long num_cores,
46  double ram_memory,
47  WRENCH_PROPERTY_COLLECTION_TYPE property_list,
48  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list);
49 
50  void start(std::string &pm_name);
51 
52  void suspend();
53 
54  void resume();
55 
56  void shutdown();
57 
58  void migrate(const std::string &dst_pm_name);
59 
60  std::string getPhysicalHostname();
61  unsigned long getNumCores();
62  double getMemory();
63  WRENCH_PROPERTY_COLLECTION_TYPE getPropertyList();
64  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE getMessagePayloadList();
65 
66  State getState();
67  std::string getStateAsString();
68 
69 
70  private:
71  State state;
72  std::string vm_name;
73  simgrid::s4u::VirtualMachine *vm;
74  unsigned long num_cores;
75  double ram_memory;
76  std::string pm_name;
77  WRENCH_PROPERTY_COLLECTION_TYPE property_list;
78  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list;
79  };
80 
81  /***********************/
83  /***********************/
84 }
85 
86 #endif //WRENCH_S4U_VIRTUALMACHINE_H
wrench::S4U_VirtualMachine::getPropertyList
WRENCH_PROPERTY_COLLECTION_TYPE getPropertyList()
Get the property list for the bare-metal compute service that is to run on the VM ({} means "use all ...
Definition: S4U_VirtualMachine.cpp:184
wrench::S4U_VirtualMachine::S4U_VirtualMachine
S4U_VirtualMachine(const std::string &vm_hostname, unsigned long num_cores, double ram_memory, WRENCH_PROPERTY_COLLECTION_TYPE property_list, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list)
Constructor.
Definition: S4U_VirtualMachine.cpp:33
wrench::S4U_VirtualMachine::getNumCores
unsigned long getNumCores()
Get the number of cores.
Definition: S4U_VirtualMachine.cpp:60
wrench::S4U_VirtualMachine::getPhysicalHostname
std::string getPhysicalHostname()
Get the physical hostname.
Definition: S4U_VirtualMachine.cpp:47
wrench::S4U_VirtualMachine::suspend
void suspend()
Suspend the VM.
Definition: S4U_VirtualMachine.cpp:101
wrench::S4U_VirtualMachine::getMemory
double getMemory()
Get the memory_manager_service consumption.
Definition: S4U_VirtualMachine.cpp:68
wrench::S4U_VirtualMachine::start
void start(std::string &pm_name)
Start the VM.
Definition: S4U_VirtualMachine.cpp:76
wrench
Definition: Action.cpp:28
wrench::S4U_VirtualMachine::getMessagePayloadList
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE getMessagePayloadList()
Get the message payload list for the bare-metal compute service that will run on the VM ({} means "us...
Definition: S4U_VirtualMachine.cpp:192
wrench::S4U_VirtualMachine::getStateAsString
std::string getStateAsString()
Get the VM's state as a string.
Definition: S4U_VirtualMachine.cpp:150
wrench::S4U_VirtualMachine::State
State
VM state enum.
Definition: S4U_VirtualMachine.h:38
wrench::S4U_VirtualMachine::migrate
void migrate(const std::string &dst_pm_name)
Migrate the VM.
Definition: S4U_VirtualMachine.cpp:167
wrench::S4U_VirtualMachine::getState
State getState()
Get the VM's state.
Definition: S4U_VirtualMachine.cpp:142
wrench::S4U_VirtualMachine
A wrapper for the simgrid::s4u::VirtualMachine class.
Definition: S4U_VirtualMachine.h:28
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:35
wrench::S4U_VirtualMachine::shutdown
void shutdown()
Shutdown the VM.
Definition: S4U_VirtualMachine.cpp:125
wrench::S4U_VirtualMachine::resume
void resume()
Resume the VM.
Definition: S4U_VirtualMachine.cpp:113