SimGrid  3.13
Versatile Simulation of Distributed Systems
smx_vm.cpp File Reference
#include "smx_private.h"
#include "mc/mc.h"
#include "src/surf/virtual_machine.hpp"
#include "src/surf/HostImpl.hpp"

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (simix_vm, simix,"Logging specific to SIMIX (vms)")
 
sg_host_t SIMIX_vm_create (const char *name, sg_host_t ind_phys_host)
 Internal function to create a SIMIX host. More...
 
static long host_get_ramsize (sg_host_t vm, int *overcommit)
 
static int __can_be_started (sg_host_t vm)
 
void SIMIX_vm_start (sg_host_t ind_vm)
 
e_surf_vm_state_t SIMIX_vm_get_state (sg_host_t ind_vm)
 
void SIMIX_vm_migrate (sg_host_t ind_vm, sg_host_t ind_dst_pm)
 Function to migrate a SIMIX VM host. More...
 
void SIMIX_vm_migratefrom_resumeto (sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
 Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration The simcall actually invokes the following calls: simcall_vm_set_affinity(vm, src_pm, 0); simcall_vm_migrate(vm, dst_pm); simcall_vm_resume(vm);. More...
 
voidSIMIX_vm_get_pm (sg_host_t ind_vm)
 Function to get the physical host of the given SIMIX VM host. More...
 
void SIMIX_vm_set_bound (sg_host_t ind_vm, double bound)
 Function to set the CPU bound of the given SIMIX VM host. More...
 
void SIMIX_vm_set_affinity (sg_host_t ind_vm, sg_host_t ind_pm, unsigned long mask)
 Function to set the CPU affinity of the given SIMIX VM host. More...
 
void SIMIX_vm_suspend (sg_host_t ind_vm, smx_process_t issuer)
 Function to suspend a SIMIX VM host. More...
 
void simcall_HANDLER_vm_suspend (smx_simcall_t simcall, sg_host_t ind_vm)
 
void SIMIX_vm_resume (sg_host_t ind_vm, smx_process_t issuer)
 Function to resume a SIMIX VM host. More...
 
void simcall_HANDLER_vm_resume (smx_simcall_t simcall, sg_host_t ind_vm)
 
void SIMIX_vm_save (sg_host_t ind_vm, smx_process_t issuer)
 Function to save a SIMIX VM host. More...
 
void simcall_HANDLER_vm_save (smx_simcall_t simcall, sg_host_t ind_vm)
 
void SIMIX_vm_restore (sg_host_t ind_vm, smx_process_t issuer)
 Function to restore a SIMIX VM host. More...
 
void simcall_HANDLER_vm_restore (smx_simcall_t simcall, sg_host_t ind_vm)
 
void SIMIX_vm_shutdown (sg_host_t ind_vm, smx_process_t issuer)
 Function to shutdown a SIMIX VM host. More...
 
void simcall_HANDLER_vm_shutdown (smx_simcall_t simcall, sg_host_t ind_vm)
 
void SIMIX_vm_destroy (sg_host_t ind_vm)
 Function to destroy a SIMIX VM host. More...
 

Function Documentation

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( simix_vm  ,
simix  ,
"Logging specific to SIMIX (vms)"   
)
sg_host_t SIMIX_vm_create ( const char *  name,
sg_host_t  ind_phys_host 
)

Internal function to create a SIMIX host.

Parameters
namename of the host to create
datasome user data (may be NULL)
static long host_get_ramsize ( sg_host_t  vm,
int *  overcommit 
)
static
static int __can_be_started ( sg_host_t  vm)
static
void SIMIX_vm_start ( sg_host_t  ind_vm)
e_surf_vm_state_t SIMIX_vm_get_state ( sg_host_t  ind_vm)
void SIMIX_vm_migrate ( sg_host_t  ind_vm,
sg_host_t  ind_dst_pm 
)

Function to migrate a SIMIX VM host.

Parameters
hostthe vm host to migrate (a sg_host_t)
void SIMIX_vm_migratefrom_resumeto ( sg_host_t  vm,
sg_host_t  src_pm,
sg_host_t  dst_pm 
)

Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration The simcall actually invokes the following calls: simcall_vm_set_affinity(vm, src_pm, 0); simcall_vm_migrate(vm, dst_pm); simcall_vm_resume(vm);.

It is called at the end of the migration_rx_fun function from msg/msg_vm.c

Parameters
vmVM to migrate
src_pmSource physical host
dst_pmtDestination physical host
void* SIMIX_vm_get_pm ( sg_host_t  ind_vm)

Function to get the physical host of the given SIMIX VM host.

Parameters
hostthe vm host to get_phys_host (a sg_host_t)
void SIMIX_vm_set_bound ( sg_host_t  ind_vm,
double  bound 
)

Function to set the CPU bound of the given SIMIX VM host.

Parameters
hostthe vm host (a sg_host_t)
boundbound (a double)
void SIMIX_vm_set_affinity ( sg_host_t  ind_vm,
sg_host_t  ind_pm,
unsigned long  mask 
)

Function to set the CPU affinity of the given SIMIX VM host.

Parameters
hostthe vm host (a sg_host_t)
hostthe pm host (a sg_host_t)
maskaffinity mask (a unsigned long)
void SIMIX_vm_suspend ( sg_host_t  ind_vm,
smx_process_t  issuer 
)

Function to suspend a SIMIX VM host.

This function stops the execution of the VM. All the processes on this VM will pause. The state of the VM is preserved on memory. We can later resume it again.

Parameters
hostthe vm host to suspend (a sg_host_t)
void simcall_HANDLER_vm_suspend ( smx_simcall_t  simcall,
sg_host_t  ind_vm 
)
void SIMIX_vm_resume ( sg_host_t  ind_vm,
smx_process_t  issuer 
)

Function to resume a SIMIX VM host.

This function restart the execution of the VM. All the processes on this VM will run again.

Parameters
hostthe vm host to resume (a sg_host_t)
void simcall_HANDLER_vm_resume ( smx_simcall_t  simcall,
sg_host_t  ind_vm 
)
void SIMIX_vm_save ( sg_host_t  ind_vm,
smx_process_t  issuer 
)

Function to save a SIMIX VM host.

This function is the same as vm_suspend, but the state of the VM is saved to the disk, and not preserved on memory. We can later restore it again.

Parameters
hostthe vm host to save (a sg_host_t)
void simcall_HANDLER_vm_save ( smx_simcall_t  simcall,
sg_host_t  ind_vm 
)
void SIMIX_vm_restore ( sg_host_t  ind_vm,
smx_process_t  issuer 
)

Function to restore a SIMIX VM host.

This function restart the execution of the VM. All the processes on this VM will run again.

Parameters
hostthe vm host to restore (a sg_host_t)
void simcall_HANDLER_vm_restore ( smx_simcall_t  simcall,
sg_host_t  ind_vm 
)
void SIMIX_vm_shutdown ( sg_host_t  ind_vm,
smx_process_t  issuer 
)

Function to shutdown a SIMIX VM host.

This function powers off the VM. All the processes on this VM will be killed. But, the state of the VM is preserved on memory. We can later start it again.

Parameters
hostthe vm host to shutdown (a sg_host_t)
void simcall_HANDLER_vm_shutdown ( smx_simcall_t  simcall,
sg_host_t  ind_vm 
)
void SIMIX_vm_destroy ( sg_host_t  ind_vm)

Function to destroy a SIMIX VM host.

Parameters
hostthe vm host to destroy (a sg_host_t)