SimGrid  3.11
Versatile Simulation of Distributed Systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
VMs

This section describes the interface created to mimic IaaS clouds. More...

Functions

int MSG_vm_is_created (msg_vm_t)
 Opaque type describing a Virtual Machine.All this is highly experimental and the interface will probably change in the future. Please don't depend on this yet (although testing is welcomed if you feel so). Usual lack of guaranty of any kind applies here, and is even increased. More...
 
int MSG_vm_is_running (msg_vm_t vm)
 Returns whether the given VM is currently running.
 
int MSG_vm_is_migrating (msg_vm_t vm)
 Returns whether the given VM is currently migrating.
 
int MSG_vm_is_suspended (msg_vm_t vm)
 Returns whether the given VM is currently suspended, not running.
 
int MSG_vm_is_saving (msg_vm_t vm)
 Returns whether the given VM is being saved (FIXME: live saving or not?).
 
int MSG_vm_is_saved (msg_vm_t vm)
 Returns whether the given VM has been saved, not running.
 
int MSG_vm_is_restoring (msg_vm_t vm)
 Returns whether the given VM is being restored, not running.
 
msg_vm_t MSG_vm_create (msg_host_t ind_pm, const char *name, int ncpus, int ramsize, int net_cap, char *disk_path, int disksize, int mig_netspeed, int dp_intensity)
 Create a new VM with specified parameters.

  • All parameters are in MBytes.
More...
 
msg_vm_t MSG_vm_create_core (msg_host_t ind_pm, const char *name)
 Create a new VM object. The VM is not yet started. The resource of the VM is allocated upon MSG_vm_start().

  • A VM is treated as a host. The name of the VM must be unique among all hosts.

 
void MSG_vm_destroy (msg_vm_t vm)
 Destroy a VM. Destroy the VM object from the simulation.
 
void MSG_vm_start (msg_vm_t vm)
 Start a vm (i.e., boot the guest operating system)If the VM cannot be started, an exception is generated. More...
 
void MSG_vm_shutdown (msg_vm_t vm)
 Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.FIXME: No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something. I'm not quite sure.
 
void MSG_vm_migrate (msg_vm_t vm, msg_host_t new_pm)
 Migrate the VM to the given host.FIXME: No migration cost occurs. If you want to simulate this too, you want to use a MSG_task_send() before or after, depending on whether you want to do cold or hot migration.
 
void MSG_vm_suspend (msg_vm_t vm)
 Immediately suspend the execution of all processes within the given VM.This function stops the exection of the VM. All the processes on this VM will pause. The state of the VM is perserved. We can later resume it again. More...
 
void MSG_vm_resume (msg_vm_t vm)
 Resume the execution of the VM. All processes on the VM run again.No resume cost occurs.
 
void MSG_vm_save (msg_vm_t vm)
 Immediately save the execution of all processes within the given VM.This function stops the exection of the VM. All the processes on this VM will pause. The state of the VM is perserved. We can later resume it again. More...
 
void MSG_vm_restore (msg_vm_t vm)
 Restore the execution of the VM. All processes on the VM run again.FIXME: No restore cost occurs. If you want to simulate this too, you want to use a MSG_file_read() before or after, depending on the exact semantic of VM restore to you.
 
msg_host_t MSG_vm_get_pm (msg_vm_t vm)
 Get the physical host of a given VM.
 
void MSG_vm_set_bound (msg_vm_t vm, double bound)
 Set a CPU bound for a given VM.1. Note that in some cases MSG_task_set_bound() may not intuitively work for VMs. More...
 
void MSG_vm_set_affinity (msg_vm_t vm, msg_host_t pm, unsigned long mask)
 Set the CPU affinity of a given VM.This function changes the CPU affinity of a given VM. Usage is the same as MSG_task_set_affinity(). See the MSG_task_set_affinity() for details.
 

Detailed Description

This section describes the interface created to mimic IaaS clouds.

With it, you can create virtual machines to put your processes into, and interact directly with the VMs to manage groups of processes.

This interface is highly experimental at this point. Testing is welcomed, but do not expect too much of it right now. Even the interfaces may be changed in future releases of SimGrid (although things are expected to stabilize nicely before SimGrid v3.8). There is no guaranty on the rest of SimGrid, and there is less than that on this part.

Function Documentation

int MSG_vm_is_created ( msg_vm_t  vm)

Opaque type describing a Virtual Machine.All this is highly experimental and the interface will probably change in the future. Please don't depend on this yet (although testing is welcomed if you feel so). Usual lack of guaranty of any kind applies here, and is even increased.

Returns whether the given VM has just reated, not running.

msg_vm_t MSG_vm_create ( msg_host_t  ind_pm,
const char *  name,
int  ncpus,
int  ramsize,
int  net_cap,
char *  disk_path,
int  disksize,
int  mig_netspeed,
int  dp_intensity 
)

Create a new VM with specified parameters.

  • All parameters are in MBytes.

void MSG_vm_start ( msg_vm_t  vm)

Start a vm (i.e., boot the guest operating system)If the VM cannot be started, an exception is generated.

void MSG_vm_suspend ( msg_vm_t  vm)

Immediately suspend the execution of all processes within the given VM.This function stops the exection of the VM. All the processes on this VM will pause. The state of the VM is perserved. We can later resume it again.

No suspension cost occurs.

void MSG_vm_save ( msg_vm_t  vm)

Immediately save the execution of all processes within the given VM.This function stops the exection of the VM. All the processes on this VM will pause. The state of the VM is perserved. We can later resume it again.

FIXME: No suspension cost occurs. If you want to simulate this too, you want to use a MSG_file_write() before or after, depending on the exact semantic of VM save to you.

void MSG_vm_set_bound ( msg_vm_t  vm,
double  bound 
)

Set a CPU bound for a given VM.1. Note that in some cases MSG_task_set_bound() may not intuitively work for VMs.

For example, On PM0, there are Task1 and VM0. On VM0, there is Task2. Now we bound 75% to Task1@PM0 and bound 25% to Task2@VM0. Then, Task1@PM0 gets 50%. Task2@VM0 gets 25%. This is NOT 75% for Task1@PM0 and 25% for Task2@VM0, respectively.

This is because a VM has the dummy CPU action in the PM layer. Putting a task on the VM does not affect the bound of the dummy CPU action. The bound of the dummy CPU action is unlimited.

There are some solutions for this problem. One option is to update the bound of the dummy CPU action automatically. It should be the sum of all tasks on the VM. But, this solution might be costy, because we have to scan all tasks on the VM in share_resource() or we have to trap both the start and end of task execution.

The current solution is to use MSG_vm_set_bound(), which allows us to directly set the bound of the dummy CPU action.

2. Note that bound == 0 means no bound (i.e., unlimited). But, if a host has multiple CPU cores, the CPU share of a computation task (or a VM) never exceeds the capacity of a CPU core.