Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
drop unimplementd VM methods: save/restore
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Dec 2016 18:40:55 +0000 (19:40 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Dec 2016 23:11:07 +0000 (00:11 +0100)
ChangeLog
include/simgrid/msg.h
include/simgrid/s4u/VirtualMachine.hpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jmsg_vm.h
src/bindings/java/org/simgrid/msg/VM.java
src/msg/msg_vm.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VirtualMachineImpl.hpp

index e7cf51f..8154c71 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,8 +42,9 @@ SimGrid (3.14) UNRELEASED; urgency=low
    - MSG_storage_set_property_value()
  * VM properties. Since msg_vm_t are msg_host_t, just use
    MSG_host_get_property_value() and friends
- * MSG_vm_create had ignored parameters, that are now dropped:
-   core_nb, disk_path and disk_size.
+ * VM I/O related things:
+   - Ignored parameter of vm_create: core_nb, disk_path and disk_size.
+   - Unimplemented save/restore methods
  * MSG_as_router_get_property_value() was redundent with
    MSG_environment_as_get_property_value(). 
    - Removed MSG_as_router_*propert*() functions
index fde4ce4..e50c2a9 100644 (file)
@@ -469,11 +469,7 @@ XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar);
 XBT_PUBLIC(int) MSG_vm_is_created(msg_vm_t vm);
 XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t vm);
 XBT_PUBLIC(int) MSG_vm_is_migrating(msg_vm_t vm);
-
 XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t vm);
-XBT_PUBLIC(int) MSG_vm_is_saving(msg_vm_t vm);
-XBT_PUBLIC(int) MSG_vm_is_saved(msg_vm_t vm);
-XBT_PUBLIC(int) MSG_vm_is_restoring(msg_vm_t vm);
 
 #define MSG_vm_get_name(vm) MSG_host_get_name(vm)
 
@@ -498,10 +494,6 @@ XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, msg_host_t destination);
 XBT_PUBLIC(void) MSG_vm_suspend(msg_vm_t vm);
 XBT_PUBLIC(void) MSG_vm_resume(msg_vm_t vm);
 
-/* Save the VM state to a disk. */
-XBT_PUBLIC(void) MSG_vm_save(msg_vm_t vm);
-XBT_PUBLIC(void) MSG_vm_restore(msg_vm_t vm);
-
 XBT_PUBLIC(msg_host_t) MSG_vm_get_pm(msg_vm_t vm);
 XBT_PUBLIC(void) MSG_vm_set_bound(msg_vm_t vm, double bound);
 
index 7ee8659..3247e91 100644 (file)
@@ -14,10 +14,6 @@ typedef enum {
   SURF_VM_STATE_CREATED, /**< created, but not yet started */
   SURF_VM_STATE_RUNNING,
   SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
-
-  SURF_VM_STATE_SAVING, /**< Save/restore involves disk I/O, so there should be transition states. */
-  SURF_VM_STATE_SAVED,
-  SURF_VM_STATE_RESTORING,
 } e_surf_vm_state_t;
 
 namespace simgrid {
index eb1880d..5563400 100644 (file)
@@ -63,24 +63,6 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_VM_isSuspended(JNIEnv * env, jobject
   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_setBound(JNIEnv *env, jobject jvm, jdouble bound)
 {
   msg_vm_t vm = jvm_get_native(env,jvm);
@@ -95,11 +77,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv* env, jobject jvm,
   const char* name = env->GetStringUTFChars(jname, 0);
   name = xbt_strdup(name);
 
-  // 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)jramsize, (int)jmig_netspeed, (int)jdp_intensity);
 
   jvm_bind(env, jvm, vm);
@@ -148,14 +125,3 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_resume(JNIEnv *env, jobject jvm)
   MSG_vm_resume(vm);
 }
 
-JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm)
-{
-  msg_vm_t vm = jvm_get_native(env,jvm);
-  MSG_vm_save(vm);
-}
-
-JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm)
-{
-  msg_vm_t vm = jvm_get_native(env,jvm);
-  MSG_vm_restore(vm);
-}
index 31e33d9..dd89414 100644 (file)
@@ -59,27 +59,6 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_VM_isSuspended(JNIEnv *env, jobject
  */
 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      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      setBound
@@ -137,19 +116,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_resume(JNIEnv *env, jobject jvm);
  */
 JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_shutdown(JNIEnv *env, jobject jvm);
 
-/**
- * Class            org_simgrid_msg_VM
- * Method           save
- * Signature    ()V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm);
-
-/**
- * Class            org_simgrid_msg_VM
- * Method           restore
- * Signature    ()V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm);
-
 SG_END_DECL()
 #endif
index a393c95..b9becc6 100644 (file)
@@ -71,15 +71,6 @@ public class VM extends Host {
        /** Returns whether the given VM is currently suspended */      
        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 ramSize size of the RAM that should be allocated (in MB)
@@ -141,25 +132,6 @@ public class VM extends Host {
         */
        public native void resume();
 
-       /** 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 restore();
-
        /**  Class initializer (for JNI), don't do it yourself */
        public static native void nativeInit();
        static {
index 7586e84..e2bd508 100644 (file)
@@ -89,30 +89,6 @@ int MSG_vm_is_suspended(msg_vm_t vm)
   return __MSG_vm_is_state(vm, SURF_VM_STATE_SUSPENDED);
 }
 
-/** @brief Returns whether the given VM is being saved (FIXME: live saving or not?).
- *  @ingroup msg_VMs
- */
-int MSG_vm_is_saving(msg_vm_t vm)
-{
-  return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVING);
-}
-
-/** @brief Returns whether the given VM has been saved, not running.
- *  @ingroup msg_VMs
- */
-int MSG_vm_is_saved(msg_vm_t vm)
-{
-  return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVED);
-}
-
-/** @brief Returns whether the given VM is being restored, not running.
- *  @ingroup msg_VMs
- */
-int MSG_vm_is_restoring(msg_vm_t vm)
-{
-  return __MSG_vm_is_state(vm, SURF_VM_STATE_RESTORING);
-}
-
 /* **** ******** MSG vm actions ********* **** */
 /** @brief Create a new VM with specified parameters.
  *  @ingroup msg_VMs*
@@ -866,50 +842,6 @@ void MSG_vm_resume(msg_vm_t vm)
   }
 }
 
-
-/** @brief Immediately save the execution of all processes within the given VM.
- *  @ingroup msg_VMs
- *
- * This function stops the execution of the VM. All the processes on this VM
- * will pause. The state of the VM is preserved. We can later resume it again.
- *
- * FIXME: No suspension cost occurs. If you want to simulate this too, you want to use a \ref MSG_file_write() before
- * or after, depending on the exact semantic of VM save to you.
- */
-void MSG_vm_save(msg_vm_t vm)
-{
-  smx_actor_t issuer=SIMIX_process_self();
-  simgrid::simix::kernelImmediate([vm,issuer]() {
-    static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->save(issuer);
-  });
-
-  if (TRACE_msg_vm_is_enabled()) {
-    container_t vm_container = PJ_container_get(vm->cname());
-    type_t type              = PJ_type_get("MSG_VM_STATE", vm_container->type);
-    val_t value              = PJ_value_get_or_new("save", "0 1 0", type); // save is green
-    new_pajePushState(MSG_get_clock(), vm_container, type, value);
-  }
-}
-
-/** @brief Restore the execution of the VM. All processes on the VM run again.
- *  @ingroup msg_VMs
- *
- * FIXME: No restore cost occurs. If you want to simulate this too, you want to use a \ref MSG_file_read() before or
- * after, depending on the exact semantic of VM restore to you.
- */
-void MSG_vm_restore(msg_vm_t vm)
-{
-  simgrid::simix::kernelImmediate([vm]() {
-    static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->restore();
-  });
-
-  if (TRACE_msg_vm_is_enabled()) {
-    container_t vm_container = PJ_container_get(vm->cname());
-    type_t type              = PJ_type_get("MSG_VM_STATE", vm_container->type);
-    new_pajePopState(MSG_get_clock(), vm_container, type);
-  }
-}
-
 /** @brief Get the physical host of a given VM.
  *  @ingroup msg_VMs
  */
index c3f7e05..67cd7bf 100644 (file)
@@ -198,54 +198,6 @@ void VirtualMachineImpl::resume()
   vmState_ = SURF_VM_STATE_RUNNING;
 }
 
-/**
- * @brief Function to save a VM.
- * This function is the same as vm_suspend, but the state of the VM is saved to the disk, and not preserved in memory.
- * We can later restore it again.
- *
- * @param issuer the process requesting this operation
- */
-void VirtualMachineImpl::save(smx_actor_t issuer)
-{
-  if (isMigrating)
-    THROWF(vm_error, 0, "Cannot save VM %s: it is migrating.", piface_->cname());
-
-  if (getState() != SURF_VM_STATE_RUNNING)
-    THROWF(vm_error, 0, "Cannot save VM %s: it is not running.", piface_->cname());
-
-  xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
-  XBT_DEBUG("Save VM %s, where %d processes exist", piface_->cname(), xbt_swag_size(process_list));
-
-  vmState_ = SURF_VM_STATE_SAVING;
-  action_->suspend();
-  vmState_ = SURF_VM_STATE_SAVED;
-
-  smx_actor_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
-    XBT_DEBUG("suspend %s", smx_process->cname());
-    SIMIX_process_suspend(smx_process, issuer);
-  }
-}
-
-void VirtualMachineImpl::restore()
-{
-  if (getState() != SURF_VM_STATE_SAVED)
-    THROWF(vm_error, 0, "Cannot restore VM %s: it was not saved", piface_->cname());
-
-  xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
-  XBT_DEBUG("Restore VM %s, where %d processes exist", piface_->cname(), xbt_swag_size(process_list));
-
-  vmState_ = SURF_VM_STATE_RESTORING;
-  action_->resume();
-  vmState_ = SURF_VM_STATE_RUNNING;
-
-  smx_actor_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
-    XBT_DEBUG("resume %s", smx_process->cname());
-    SIMIX_process_resume(smx_process);
-  }
-}
-
 /** @brief Power off a VM.
  *
  * All hosted processes will be killed, but the VM state is preserved on memory.
index 2c6e95e..82b3d9e 100644 (file)
@@ -68,12 +68,6 @@ public:
   /** @brief Resume the VM */
   virtual void resume();
 
-  /** @brief Save (suspend+store on disk) the VM */
-  virtual void save(smx_actor_t issuer);
-
-  /** @brief Restore (read from disk+resume) the VM */
-  virtual void restore();
-
   /** @brief Shutdown the VM */
   virtual void shutdown(smx_actor_t issuer);