1 /* Copyright (c) 2015-2016. The SimGrid Team. All rights reserved. */
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. */
6 #include "simgrid/datatypes.h"
7 #include "simgrid/s4u/VirtualMachine.hpp"
8 #include "simgrid/s4u/host.hpp"
9 #include "simgrid/simix.hpp"
10 #include "src/plugins/vm/VirtualMachineImpl.hpp"
11 #include "src/surf/HostImpl.hpp"
12 #include "xbt/asserts.h"
17 VirtualMachine::VirtualMachine(const char* name, s4u::Host* Pm) : Host(name)
19 pimpl_vm_ = new surf::VirtualMachineImpl(this, Pm);
22 VirtualMachine::~VirtualMachine()
27 bool VirtualMachine::isMigrating()
29 return static_cast<surf::VirtualMachineImpl*>(pimpl_)->isMigrating;
32 /** @brief Retrieve a copy of the parameters of that VM/PM
33 * @details The ramsize and overcommit fields are used on the PM too */
34 void VirtualMachine::parameters(vm_params_t params)
36 static_cast<surf::VirtualMachineImpl*>(pimpl_)->getParams(params);
38 /** @brief Sets the params of that VM/PM */
39 void VirtualMachine::setParameters(vm_params_t params)
41 simgrid::simix::kernelImmediate([&]() { static_cast<surf::VirtualMachineImpl*>(pimpl_)->setParams(params); });
44 } // namespace simgrid