}
/* Construct the platform */
Msg.createEnvironment(args[0]);
- /* Retrieve the 10 first hosts of the platform file */
+ /* Retrieve the 5 first hosts of the platform file */
Host[] hosts = Host.all();
- if (hosts.length < 10) {
+ if (hosts.length < 5) {
Msg.info("I need at least 10 hosts in the platform file, but " + args[0] + " contains only " + hosts.length + " hosts");
System.exit(42);
}
this.hosts = hosts;
}
public void main(String[] args) throws MsgException {
- int slavesCount = 10;
+ int slavesCount = 5;
ArrayList<VM> vms = new ArrayList<VM>();
+ // Create one VM per host and bind a process inside each one.
for (int i = 0; i < slavesCount; i++) {
- Slave slave = new Slave(hosts[i],i);
- slave.start();
- VM vm = new VM(hosts[i],hosts[i]+"_"+i,1);
- vm.bind(slave);
+ VM vm = new VM(hosts[i],"VM_"+i);
+ vm.start();
vms.add(vm);
+ Slave slave = new Slave(vm,i);
+ slave.start();
+
}
Msg.info("Launched " + vms.size() + " VMs");
Msg.info("Add one more process per VM.");
for (int i = 0; i < vms.size(); i++) {
VM vm = vms.get(i);
- Slave slave = new Slave(hosts[i],i + vms.size());
+ Slave slave = new Slave(vm,i + vms.size());
slave.start();
- vm.bind(slave);
}
Msg.info("Migrate everyone to the second host.");
vms.get(i).migrate(hosts[1]);
}
- Msg.info("Suspend everyone, move them to the third host, and resume them.");
+// Msg.info("Suspend everyone, move them to the third host, and resume them.");
+ Msg.info("Migrate everyone to the third host (please note that cold migration is not yet available");
+
+
for (int i = 0; i < vms.size(); i++) {
VM vm = vms.get(i);
- vm.suspend();
+ // vm.suspend();
vm.migrate(hosts[2]);
- vm.resume();
+ // vm.resume();
}
workBatch(slavesCount * 2);
* Usual lack of guaranty of any kind applies here, and is even increased.
*
*/
-/* This function should not be called directly, but rather from MSG_vm_start_from_template that does not exist yet*/
+
+XBT_PUBLIC(int) MSG_vm_is_created(msg_vm_t);
+XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t);
+XBT_PUBLIC(int) MSG_vm_is_migrating(msg_vm_t);
+
+XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t);
+XBT_PUBLIC(int) MSG_vm_is_saving(msg_vm_t);
+XBT_PUBLIC(int) MSG_vm_is_saved(msg_vm_t);
+XBT_PUBLIC(int) MSG_vm_is_restoring(msg_vm_t);
+
+
+XBT_PUBLIC(const char*) MSG_vm_get_name(msg_vm_t);
// TODO add VDI later
XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name,
int core_nb, int mem_cap, int net_cap, char *disk_path, int disk_size);
-XBT_PUBLIC(void) MSG_vm_start(msg_vm_t);
+XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
-XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t);
-XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t);
+XBT_PUBLIC(void) MSG_vm_start(msg_vm_t);
-XBT_PUBLIC(const char*) MSG_vm_get_name(msg_vm_t);
+/* Shutdown the guest operating system. */
+XBT_PUBLIC(void) MSG_vm_shutdown(msg_vm_t vm);
XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, msg_host_t destination);
XBT_PUBLIC(void) MSG_vm_save(msg_vm_t vm);
XBT_PUBLIC(void) MSG_vm_restore(msg_vm_t vm);
-/* Shutdown the guest operating system. */
-XBT_PUBLIC(void) MSG_vm_shutdown(msg_vm_t vm);
-
-XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
-
msg_host_t MSG_vm_get_pm(msg_vm_t vm);
/* TODO: do we need this? */
SURF_VM_STATE_CREATED,
SURF_VM_STATE_RUNNING,
- // SURF_VM_STATE_MIGRATING,
+ SURF_VM_STATE_MIGRATING,
/* Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
SURF_VM_STATE_SUSPENDED,
jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
}
}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isCreated(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_created(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isRunning(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_running(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isMigrating(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_migrating(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isSuspended(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_suspended(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isSaving(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_saving(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isSaved(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_saved(vm);
+}
+
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isRestoring(JNIEnv * env, jobject jvm) {
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ return (jint) MSG_vm_is_restoring(vm);
+}
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_start(JNIEnv *env, jobject jvm, jobject jhost, jstring jname, jint jcoreamount) {
+Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
+ jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize) {
msg_host_t host = jhost_get_native(env, jhost);
const char *name;
name = (*env)->GetStringUTFChars(env, jname, 0);
name = xbt_strdup(name);
-
- msg_vm_t vm = MSG_vm_start(host, name, (int)jcoreamount);
+
+ // TODO disk concerns are not taken into account yet
+ // const char *diskpath;
+ // disk_path = (*env)->GetStringUTFChars(env, jdiskpath, 0);
+ // disk_path = xbt_strdup(disk_path);
+
+ msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (int) jramsize,
+ (int) jnetcap, NULL, (int) jdisksize);
jvm_bind(env,jvm,vm);
}
+
JNIEXPORT void JNICALL
Java_org_simgrid_msg_VM_destroy(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
MSG_vm_destroy(vm);
}
-JNIEXPORT jboolean JNICALL
-Java_org_simgrid_msg_VM_isSuspended(JNIEnv *env, jobject jvm) {
- msg_vm_t vm = jvm_get_native(env,jvm);
-
- return MSG_vm_is_suspended(vm) ? JNI_TRUE : JNI_FALSE;
-}
-JNIEXPORT jboolean JNICALL
-Java_org_simgrid_msg_VM_isRunning(JNIEnv *env, jobject jvm) {
- msg_vm_t vm = jvm_get_native(env,jvm);
- return MSG_vm_is_running(vm) ? JNI_TRUE : JNI_FALSE;
-}
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_bind(JNIEnv *env, jobject jvm, jobject jprocess) {
+Java_org_simgrid_msg_VM_start(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- msg_process_t process = jprocess_to_native_process(jprocess,env);
-
- xbt_assert((vm != NULL), "VM object is not bound");
- xbt_assert((process != NULL), "Process object is not bound.");
-
- MSG_vm_bind(vm,process);
+ MSG_vm_start(vm);
}
+
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_unbind(JNIEnv *env, jobject jvm, jobject jprocess) {
+Java_org_simgrid_msg_VM_shutdown(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- msg_process_t process = jprocess_to_native_process(jprocess,env);
-
- MSG_vm_unbind(vm,process);
+ MSG_vm_shutdown(vm);
}
+
JNIEXPORT void JNICALL
Java_org_simgrid_msg_VM_migrate(JNIEnv *env, jobject jvm, jobject jhost) {
msg_vm_t vm = jvm_get_native(env,jvm);
msg_host_t host = jhost_get_native(env, jhost);
+ XBT_INFO("Start migration of %s to %s", MSG_host_get_name(vm), MSG_host_get_name(host));
MSG_vm_migrate(vm,host);
+ XBT_INFO("Migration done");
}
+
JNIEXPORT void JNICALL
Java_org_simgrid_msg_VM_suspend(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- xbt_ex_t e;
- TRY {
- MSG_vm_suspend(vm);
- }
- CATCH(e) {
- xbt_ex_free(e);
- }
+ MSG_vm_suspend(vm);
}
JNIEXPORT void JNICALL
Java_org_simgrid_msg_VM_resume(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- xbt_ex_t e;
- TRY {
- MSG_vm_resume(vm);
- }
- CATCH(e) {
- xbt_ex_free(e);
- }
+ MSG_vm_resume(vm);
}
+
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_shutdown(JNIEnv *env, jobject jvm) {
+Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- xbt_ex_t e;
- TRY {
- MSG_vm_shutdown(vm);
- }
- CATCH(e) {
- xbt_ex_free(e);
- }
+ MSG_vm_save(vm);
}
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_reboot(JNIEnv *env, jobject jvm) {
+Java_org_simgrid_msg_VM_retore(JNIEnv *env, jobject jvm) {
msg_vm_t vm = jvm_get_native(env,jvm);
- xbt_ex_t e;
- TRY {
- MSG_vm_reboot(vm);
- }
- CATCH(e) {
- xbt_ex_free(e);
+ MSG_vm_restore(vm);
+}
+
+
+
+JNIEXPORT jobject JNICALL
+Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) {
+ jobject jhost;
+ msg_vm_t vm = jvm_get_native(env,jvm);
+ msg_host_t host = MSG_vm_get_pm(vm);
+
+ if (!MSG_host_get_data(host)) {
+ /* the native host not yet associated with the java host instance */
+
+ /* instanciate a new java host instance */
+ jhost = jhost_new_instance(env);
+
+ if (!jhost) {
+ jxbt_throw_jni(env, "java host instantiation failed");
+ return NULL;
+ }
+
+ /* get a global reference to the newly created host */
+ jhost = jhost_ref(env, jhost);
+
+ if (!jhost) {
+ jxbt_throw_jni(env, "global ref allocation failed");
+ return NULL;
+ }
+ /* Sets the host name */
+ const char *name = MSG_host_get_name(host);
+ jobject jname = (*env)->NewStringUTF(env,name);
+ (*env)->SetObjectField(env, jhost, jxbt_get_jfield(env, (*env)->FindClass(env, "org/simgrid/msg/Host"), "name", "Ljava/lang/String;"), jname);
+ /* Bind & store it */
+ jhost_bind(jhost, host, env);
+ MSG_host_set_data(host, (void *) jhost);
+ } else {
+ jhost = (jobject) MSG_host_get_data(host);
}
+
+ return jhost;
}
*/
JNIEXPORT void JNICALL
Java_org_simgrid_msg_VM_nativeInit(JNIEnv *env, jclass);
+
/**
* Class org_simgrid_msg_VM
- * Method start
- * Signature (I)V
+ * Method isCreated
+ * Signature ()B
*/
-JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_start(JNIEnv *env, jobject jvm, jobject jhost, jstring jname, jint jcoreamount);
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isCreated(JNIEnv *env, jobject jvm);
/**
- * Class org_simgrid_msg_VM
- * Method destroy
- * Signature ()V
+ * Class org_simgrid_msg_VM
+ * Method isRunning
+ * Signature ()B
*/
-JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_destroy(JNIEnv *env, jobject jvm);
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isRunning(JNIEnv *env, jobject jvm);
+/**
+ * Class org_simgrid_msg_VM
+ * Method isMigrating
+ * Signature ()B
+ */
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isMigrating(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
* Method isSuspended
* Signature ()B
*/
-JNIEXPORT jboolean JNICALL
+JNIEXPORT jint JNICALL
Java_org_simgrid_msg_VM_isSuspended(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
- * Method isRunning
+ * Method isResuming
* Signature ()B
*/
-JNIEXPORT jboolean JNICALL
-Java_org_simgrid_msg_VM_isRunning(JNIEnv *env, jobject jvm);
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isResuming(JNIEnv *env, jobject jvm);
+/**
+ * Class org_simgrid_msg_VM
+ * Method isSuspended
+ * Signature ()B
+ */
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isSaving(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
- * Method bind
- * Signature (Lorg/simgrid/msg/Process;)V
+ * Method isSave
+ * Signature ()B
+ */
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isSaved(JNIEnv *env, jobject jvm);
+/**
+ * Class org_simgrid_msg_VM
+ * Method isResuming
+ * Signature ()B
+ */
+JNIEXPORT jint JNICALL
+Java_org_simgrid_msg_VM_isRestoring(JNIEnv *env, jobject jvm);
+
+/**
+ * Class org_simgrid_msg_VM
+ * Method create
+ * Signature ()V
*/
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_bind(JNIEnv *env, jobject jvm, jobject jprocess);
+Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
+ jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize);
+
+/**
+ * Class org_simgrid_msg_VM
+ * Method destroy
+ * Signature ()V
+ */
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_VM_destroy(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
- * Method unbind
- * Signature (Lorg/simgrid/msg/Process;)V
+ * Method start
+ * Signature (I)V
*/
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_unbind(JNIEnv *env, jobject jvm, jobject jprocess);
+Java_org_simgrid_msg_VM_start(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
* Method migrate
Java_org_simgrid_msg_VM_shutdown(JNIEnv *env, jobject jvm);
/**
* Class org_simgrid_msg_VM
- * Method reboot
+ * Method save
+ * Signature ()V
+ */
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm);
+/**
+ * Class org_simgrid_msg_VM
+ * Method save
* Signature ()V
*/
JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_reboot(JNIEnv *env, jobject jvm);
+Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm);
#endif
/**
* Host name
*/
- private String name;
+ protected String name;
/**
* User data.
this.bind = 0;
this.data = null;
};
+
+ public String toString (){
+ return this.name;
+
+ }
/**
* This static method gets an host instance associated with a native
*
*/
public native double getSpeed();
+
/**
* Returns the value of a given host property.
*/
public native String getProperty(String name);
+
/**
* Change the value of a given host property.
*/
public native void setProperty(String name, String value);
- /** This method tests if a host is available.
+
+ /** This method tests if a host is available.
* @return True if the host is available.
*/
public native boolean isAvail();
/*
- * JNI interface to Cloud interface in Simgrid
+ * JNI interface to virtual machine in Simgrid
*
* Copyright 2006-2012 The SimGrid Team.
* All right reserved.
import org.simgrid.msg.Host;
import org.simgrid.msg.Process;
-public class VM {
+public class VM extends Host{
+ // Please note that we are not declaring a new bind variable
+ //(the bind variable has been inherited from the super class Host)
+
+ /* Static functions */
+ // GetByName is inherited from the super class Host
+
- /**
- * Create a new empty VM.
- * NOTE: MSG_vm_create_core
+ /* Constructors / destructors */
+ /**
+ * Create a `basic' VM (i.e. 1 core, 1GB of RAM, other values are not taken into account).
*/
public VM(Host host, String name) {
- create(host, name, 1024, )
+ this(host,name,1,1024*1024*1024, -1, null, -1);
+ }
+
+ /**
+ * Create a `basic' VM (i.e. 1 core, 1GB of RAM, other values are not taken into account).
+ */
+ public VM(Host host, String name, int nCore, long ramSize,
+ long netCap, String diskPath, long diskSize){
+ super();
+ super.name = name;
+ create(host, name, nCore, ramSize, netCap, diskPath, diskSize);
}
+
protected void finalize() {
destroy();
}
- /**
- * Destroy the VM
- */
- protected native void destroy();
- /**
- * Natively implemented method starting the VM.
- * @param coreAmount
- */
- private native void start(Host host, String name, int coreAmount);
-
+
+
+ /* JNI / Native code */
+ /* get/set property methods are inherited from the Host class. */
+
/** Returns whether the given VM is currently suspended
*/
- public native boolean isSuspended();
+ public native int isCreated();
+
/** Returns whether the given VM is currently running
*/
- public native boolean isRunning();
- /** Add the given process into the VM.
- * Afterward, when the VM is migrated or suspended or whatever, the process will have the corresponding handling, too.
- */
- public native void bind(Process process);
- /** Removes the given process from the given VM, and kill it
- * Will raise a ProcessNotFound exception if the process were not bound to that VM
+ public native int isRunning();
+
+ /** Returns whether the given VM is currently running
+ */
+ public native int isMigrating();
+
+ /** Returns whether the given VM is currently suspended
*/
- public native void unbind(Process process);
+ public native int isSuspended();
+
+ /** Returns whether the given VM is currently saving
+ */
+ public native int isSaving();
+
+ /** Returns whether the given VM is currently saved
+ */
+ public native int isSaved();
+
+ /** Returns whether the given VM is currently restoring its state
+ */
+ public native boolean isRestoring();
+
+ /**
+ * Natively implemented method create the VM.
+ * @param nCore, number of core
+ * @param ramSize, size of the RAM that should be allocated
+ * @param netCap (not used for the moment)
+ * @param diskPath (not used for the moment)
+ * @param diskSize (not used for the moment)
+ */
+ private native void create(Host host, String name, int nCore, long ramSize,
+ long netCap, String diskPath, long diskSize);
+
+ /**
+ * start the VM
+ */
+ public native void start();
+
+
+ /**
+ * Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.
+ * No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something
+ */
+ public native void shutdown();
+
+
/** Immediately change the host on which all processes are running
*
* No migration cost occurs. If you want to simulate this too, you want to use a
* migration.
*/
public native void migrate(Host destination);
+
/** Immediately suspend the execution of all processes within the given VM
*
* No suspension cost occurs. If you want to simulate this too, you want to
* of VM suspend to you.
*/
public native void suspend();
+
/** Immediately resumes the execution of all processes within the given VM
*
* No resume cost occurs. If you want to simulate this too, you want to
* of VM resume to you.
*/
public native void resume();
- /**
- * Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.
- * No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something
+
+ /** Immediately suspend the execution of all processes within the given VM
+ * and save its state on the persistent HDD
+ * Not yet implemented (for the moment it behaves like suspend)
+ * No suspension cost occurs. If you want to simulate this too, you want to
+ * use a \ref File.write() before or after, depending on the exact semantic
+ * of VM suspend to you.
+ */
+ public native void save();
+
+ /** Immediately resumes the execution of all processes previously saved
+ * within the given VM
+ * Not yet implemented (for the moment it behaves like resume)
+ *
+ * No resume cost occurs. If you want to simulate this too, you want to
+ * use a \ref File.read() before or after, depending on the exact semantic
+ * of VM resume to you.
*/
- public native void shutdown();
+ public native void restore();
+
+
/**
- * Reboot the VM, restarting all the processes in it.
+ * Destroy the VM
*/
- public native void reboot();
+ protected native void destroy();
- public String getName() {
- return name;
- }
+
/**
* Class initializer, to initialize various JNI stuff
return __MSG_vm_is_state(vm, SURF_VM_STATE_RUNNING);
}
-#if 0
/** @brief Returns whether the given VM is currently migrating
* @ingroup msg_VMs
*/
{
return __MSG_vm_is_state(vm, SURF_VM_STATE_MIGRATING);
}
-#endif
/** @brief Returns whether the given VM is currently suspended, not running.
* @ingroup msg_VMs
return ind_vm;
}
+/** @brief Destroy a VM. Destroy the VM object from the simulation.
+ * @ingroup msg_VMs
+ */
+void MSG_vm_destroy(msg_vm_t vm)
+{
+ /* First, terminate all processes on the VM if necessary */
+ if (MSG_vm_is_running(vm))
+ simcall_vm_shutdown(vm);
+
+ if (!MSG_vm_is_created(vm)) {
+ XBT_CRITICAL("shutdown the given VM before destroying it");
+ DIE_IMPOSSIBLE;
+ }
+
+ /* Then, destroy the VM object */
+ simcall_vm_destroy(vm);
+
+ __MSG_host_destroy(vm);
+
+ #ifdef HAVE_TRACING
+ TRACE_msg_vm_end(vm);
+ #endif
+}
+
/** @brief Start a vm (i.e., boot the guest operating system)
* @ingroup msg_VMs
return total;
}
+// TODO Is this code redundant with the information provided by
+// msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
void MSG_host_add_task(msg_host_t host, msg_task_t task)
{
msg_host_priv_t priv = msg_host_resource_priv(host);
}
-/** @brief Destroy a VM. Destroy the VM object from the simulation.
- * @ingroup msg_VMs
- */
-void MSG_vm_destroy(msg_vm_t vm)
-{
- /* First, terminate all processes on the VM if necessary */
- if (MSG_vm_is_running(vm))
- simcall_vm_shutdown(vm);
-
- if (!MSG_vm_is_created(vm)) {
- XBT_CRITICAL("shutdown the given VM before destroying it");
- DIE_IMPOSSIBLE;
- }
-
- /* Then, destroy the VM object */
- simcall_vm_destroy(vm);
-
- __MSG_host_destroy(vm);
-
- #ifdef HAVE_TRACING
- TRACE_msg_vm_end(vm);
- #endif
-}
-/** @brief Get the physical host of a givne VM.
+/** @brief Get the physical host of a given VM.
* @ingroup msg_VMs
*/
msg_host_t MSG_vm_get_pm(msg_vm_t vm)
workstation_VM2013_t ws_vm2013 = (workstation_VM2013_t) ws_clm03;
{
void *ind_sub_host = xbt_lib_get_elm_or_null(host_lib, ws_vm2013->sub_ws->generic_resource.name);
+#if 0
XBT_INFO("cost %f remains %f start %f finish %f", ws_vm2013->cpu_action->cost,
ws_vm2013->cpu_action->remains,
ws_vm2013->cpu_action->start,
ws_vm2013->cpu_action->finish
);
-
+#endif
#if 0
surf_cpu_model_pm->action_unref(ws_vm2013->cpu_action);
/* FIXME: this means busy loop? */