Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move VM into their namespace, and greatly reduce the amount of sg_host_get_name ...
[simgrid.git] / include / simgrid / s4u / VirtualMachine.hpp
1 /* Copyright (c) 2015-2016. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_S4U_VM_HPP
7 #define SIMGRID_S4U_VM_HPP
8
9 #include <simgrid/s4u/forward.hpp>
10 #include <simgrid/s4u/host.hpp>
11 #include <xbt/base.h>
12
13 typedef enum {
14   SURF_VM_STATE_CREATED, /**< created, but not yet started */
15   SURF_VM_STATE_RUNNING,
16   SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
17
18   SURF_VM_STATE_SAVING, /**< Save/restore involves disk I/O, so there should be transition states. */
19   SURF_VM_STATE_SAVED,
20   SURF_VM_STATE_RESTORING,
21 } e_surf_vm_state_t;
22
23 namespace simgrid {
24 namespace vm {
25 class VirtualMachineImpl;
26 };
27 namespace s4u {
28
29 /** @ingroup s4u_api
30  *
31  * @tableofcontents
32  *
33  * A VM is a virtual machine that contains actors. The total computing power that the contained
34  * processes can get is constrained to the virtual machine size.
35  *
36  */
37 XBT_PUBLIC_CLASS VirtualMachine : public s4u::Host
38 {
39
40 public:
41   explicit VirtualMachine(const char* name, s4u::Host* hostPm);
42
43   // No copy/move
44   VirtualMachine(VirtualMachine const&) = delete;
45   VirtualMachine& operator=(VirtualMachine const&) = delete;
46
47 private:
48   virtual ~VirtualMachine();
49
50 public:
51   bool isMigrating();
52
53   void parameters(vm_params_t params);
54   void setParameters(vm_params_t params);
55   double getRamsize();
56
57   /* FIXME: protect me */
58   simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr;
59 };
60 }
61 } // namespace simgrid::s4u
62
63 #endif /* SIMGRID_S4U_HOST_HPP */