#include "cpu_cas01.hpp"
#include "simgrid/sg_config.h"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
#include "simgrid/sg_config.h"
#include "network_interface.hpp"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
"Logging specific to the SURF host module");
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
- VM *ws_vm = &*iter;
+ VirtualMachine *ws_vm = &*iter;
CpuCas01 *cpu_cas01 = static_cast<CpuCas01*>(ws_vm->p_cpu);
xbt_assert(cpu_cas01, "cpu-less host");
xbt_dynar_t Host::getVms()
{
- xbt_dynar_t dyn = xbt_dynar_new(sizeof(VM*), NULL);
+ xbt_dynar_t dyn = xbt_dynar_new(sizeof(VirtualMachine*), NULL);
/* iterate for all virtual machines */
for (VMModel::vm_list_t::iterator iter =
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
- VM *ws_vm = &*iter;
+ VirtualMachine *ws_vm = &*iter;
if (this == ws_vm->p_subWs)
xbt_dynar_push(dyn, &ws_vm);
}
#include "surf_routing_cluster.hpp"
#include "src/instr/instr_private.h"
#include "plugins/energy.hpp"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel);
return static_cast<Host*>(surf_host_resource_priv(resource));
}
-static VM *get_casted_vm(surf_resource_t resource){
- return static_cast<VM*>(surf_host_resource_priv(resource));
+static VirtualMachine *get_casted_vm(surf_resource_t resource){
+ return static_cast<VirtualMachine*>(surf_host_resource_priv(resource));
}
extern double NOW;
xbt_dynar_t vms = get_casted_host(host)->getVms();
xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL);
unsigned int cpt;
- VM *vm;
+ VirtualMachine *vm;
xbt_dynar_foreach(vms, cpt, vm) {
sg_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName());
xbt_dynar_push(vms_, &vm_);
void surf_vm_destroy(surf_resource_t resource){
/* Before clearing the entries in host_lib, we have to pick up resources. */
- VM *vm = get_casted_vm(resource);
+ VirtualMachine *vm = get_casted_vm(resource);
char* name = xbt_dict_get_elm_key(resource);
/* We deregister objects from host_lib, without invoking the freeing callback
* of each level.
#include "surf_routing.hpp"
#include "simgrid/sg_config.h"
#include "mc/mc.h"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "cpu_cas01.hpp"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf,
"Logging specific to the SURF VM module");
* Callbacks *
*************/
-surf_callback(void, VM*) VMCreatedCallbacks;
-surf_callback(void, VM*) VMDestructedCallbacks;
-surf_callback(void, VM*) VMStateChangedCallbacks;
+surf_callback(void, VirtualMachine*) VMCreatedCallbacks;
+surf_callback(void, VirtualMachine*) VMDestructedCallbacks;
+surf_callback(void, VirtualMachine*) VMStateChangedCallbacks;
/*********
* Model *
* Resource *
************/
-VM::VM(Model *model, const char *name, xbt_dict_t props,
+VirtualMachine::VirtualMachine(Model *model, const char *name, xbt_dict_t props,
RoutingEdge *netElm, Cpu *cpu)
: Host(model, name, props, NULL, netElm, cpu)
{
VMModel::ws_vms.push_back(*this);
+
+ xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, this);
+
surf_callback_emit(VMCreatedCallbacks, this);
}
* A physical host does not disappear in the current SimGrid code, but a VM may
* disappear during a simulation.
*/
-VM::~VM()
+VirtualMachine::~VirtualMachine()
{
surf_callback_emit(VMDestructedCallbacks, this);
VMModel::ws_vms.erase(VMModel::vm_list_t::s_iterator_to(*this));
}
-void VM::setState(e_surf_resource_state_t state){
+void VirtualMachine::setState(e_surf_resource_state_t state){
Resource::setState(state);
surf_callback_emit(VMStateChangedCallbacks, this);
}
* A surf level object will be useless in the upper layer. Returning the
* dict_elm of the host.
**/
-surf_resource_t VM::getPm()
+surf_resource_t VirtualMachine::getPm()
{
return xbt_lib_get_elm_or_null(host_lib, p_subWs->getName());
}
***********/
class XBT_PRIVATE VMModel;
-class XBT_PRIVATE VM;
+class XBT_PRIVATE VirtualMachine;
/*************
* Callbacks *
/** @ingroup SURF_callbacks
* @brief Callbacks fired after VM creation. Signature: `void(VM*)`
*/
-extern XBT_PRIVATE surf_callback(void, VM*) VMCreatedCallbacks;
+extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks fired after VM destruction. Signature: `void(VM*)`
*/
-extern XBT_PRIVATE surf_callback(void, VM*) VMDestructedCallbacks;
+extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks after VM State changes. Signature: `void(VMAction*)`
*/
-extern XBT_PRIVATE surf_callback(void, VM*) VMStateChangedCallbacks;
+extern XBT_PRIVATE surf_callback(void, VirtualMachine*) VMStateChangedCallbacks;
/************
* Resource *
* @brief SURF VM interface class
* @details A VM represent a virtual machine
*/
-class VM : public Host {
+class VirtualMachine : public Host {
public:
/**
* @brief Constructor
* @param netElm The RoutingEdge associated to this VM
* @param cpu The Cpu associated to this VM
*/
- VM(Model *model, const char *name, xbt_dict_t props,
+ VirtualMachine(Model *model, const char *name, xbt_dict_t props,
RoutingEdge *netElm, Cpu *cpu);
/** @brief Destructor */
- ~VM();
+ ~VirtualMachine();
void setState(e_surf_resource_state_t state);
* @param host_PM The real machine hosting the VM
*
*/
- virtual VM *createVM(const char *name, surf_resource_t host_PM)=0;
+ virtual VirtualMachine *createVM(const char *name, surf_resource_t host_PM)=0;
void adjustWeightOfDummyCpuActions() {};
typedef boost::intrusive::member_hook<
- VM, boost::intrusive::list_member_hook<>, &VM::vm_hook> VmOptions;
- typedef boost::intrusive::list<VM, VmOptions, boost::intrusive::constant_time_size<false> > vm_list_t;
+ VirtualMachine, boost::intrusive::list_member_hook<>, &VirtualMachine::vm_hook> VmOptions;
+ typedef boost::intrusive::list<VirtualMachine, VmOptions, boost::intrusive::constant_time_size<false> > vm_list_t;
static vm_list_t ws_vms;
};
/* ind means ''indirect'' that this is a reference on the whole dict_elm
* structure (i.e not on the surf_resource_private infos) */
-VM *VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
-{
- VMHL13 *ws = new VMHL13(this, name, NULL, host_PM);
-
- xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, ws);
-
- /* TODO:
- * - check how network requests are scheduled between distinct processes competing for the same card.
- */
- return ws;
+VirtualMachine *VMHL13Model::createVM(const char *name, surf_resource_t host_PM) {
+ return new VMHL13(this, name, NULL, host_PM);
}
static inline double get_solved_value(CpuAction *cpu_action)
double VMHL13Model::shareResources(double now)
{
- /* TODO: udpate action's cost with the total cost of processes on the VM. */
+ /* TODO: update action's cost with the total cost of processes on the VM. */
/* 0. Make sure that we already calculated the resource share at the physical
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
- VM *ws_vm = &*iter;
+ VirtualMachine *ws_vm = &*iter;
Cpu *cpu = ws_vm->p_cpu;
xbt_assert(cpu, "cpu-less host");
VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
surf_resource_t host_PM)
- : VM(model, name, props, NULL, NULL)
+ : VirtualMachine(model, name, props, NULL, NULL)
{
Host *sub_ws = static_cast<Host*>(surf_host_resource_priv(host_PM));
p_action = sub_cpu->execute(0);
XBT_INFO("Create VM(%s)@PM(%s) with %ld mounted disks", name, sub_ws->getName(), xbt_dynar_length(p_storage));
+
}
/*
#include "xbt/base.h"
#include "host_clm03.hpp"
-#include "vm_interface.hpp"
+#include "virtual_machine.hpp"
#ifndef SURF_VM_HPP_
#define SURF_VM_HPP_
VMHL13Model();
~VMHL13Model(){};
- VM *createVM(const char *name, surf_resource_t host_PM);
+ VirtualMachine *createVM(const char *name, surf_resource_t host_PM);
double shareResources(double now);
void adjustWeightOfDummyCpuActions() {};
Action *executeParallelTask(int host_nb,
* Resource *
************/
-class VMHL13 : public VM {
+class VMHL13 : public VirtualMachine {
public:
VMHL13(VMModel *model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
~VMHL13();
src/surf/surfxml_parse.c
src/surf/trace_mgr_private.h
src/surf/vm_hl13.hpp
- src/surf/vm_interface.hpp
+ src/surf/virtual_machine.hpp
src/surf/host_clm03.hpp
src/surf/host_interface.hpp
src/surf/host_ptask_L07.hpp
src/surf/surfxml_parseplatf.c
src/surf/trace_mgr.c
src/surf/vm_hl13.cpp
- src/surf/vm_interface.cpp
+ src/surf/virtual_machine.cpp
src/surf/host_clm03.cpp
src/surf/host_interface.cpp
src/surf/host_ptask_L07.cpp