+/* **** ******** MSG vm actions ********* **** */
+
+/** @brief Create a new VM (the VM is just attached to the location but it is not started yet).
+ * @ingroup msg_VMs*
+ *
+ * Please note that a VM is a specific host. Hence, you should give a different name
+ * for each VM/PM.
+ */
+msg_vm_t MSG_vm_create(msg_host_t location, const char *name,
+ int core_nb, int mem_cap, int net_cap){
+
+ // Note new and vm_workstation refer to the same area (due to the lib/dict appraoch)
+ msg_vm_t new = NULL;
+ void *vm_workstation = NULL;
+ // Ask simix to create the surf vm resource
+ vm_workstation = simcall_vm_create(name,location);
+ new = (msg_vm_t) __MSG_host_create(vm_workstation);
+
+ MSG_vm_set_property_value(new, "CORE_NB", bprintf("%d", core_nb), free);
+ MSG_vm_set_property_value(new, "MEM_CAP", bprintf("%d", core_nb), free);
+ MSG_vm_set_property_value(new, "NET_CAP", bprintf("%d", core_nb), free);
+
+ // TODO check whether the vm (i.e the virtual host) has been correctly added into the list of all hosts.
+
+ #ifdef HAVE_TRACING
+ TRACE_msg_vm_create(name, location);
+ #endif
+
+ return new;
+}
+
+/** @brief Start a vm (ie. boot)
+ * @ingroup msg_VMs
+ *
+ * If the VM cannot be started, an exception is generated.
+ *
+ */
+void MSG_vm_start(msg_vm_t vm) {
+
+ //Please note that vm start can raise an exception if the VM cannot be started.
+ simcall_vm_start(vm);
+
+ #ifdef HAVE_TRACING
+ TRACE_msg_vm_start(vm);
+ #endif
+}
+
+/* **** Check state of a VM **** */
+int __MSG_vm_is_state(msg_vm_t vm, e_msg_vm_state_t state) {
+ return simcall_get_vm_state(vm) == state ;
+}
+