From 7f4e5b2ed2874cf5ab13b7fbe0cebff788cb5019 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 19 Dec 2016 19:40:55 +0100 Subject: [PATCH] drop unimplementd VM methods: save/restore --- ChangeLog | 5 +- include/simgrid/msg.h | 8 --- include/simgrid/s4u/VirtualMachine.hpp | 4 -- src/bindings/java/jmsg_vm.cpp | 34 ------------ src/bindings/java/jmsg_vm.h | 35 ------------ src/bindings/java/org/simgrid/msg/VM.java | 28 ---------- src/msg/msg_vm.cpp | 68 ----------------------- src/plugins/vm/VirtualMachineImpl.cpp | 48 ---------------- src/plugins/vm/VirtualMachineImpl.hpp | 6 -- 9 files changed, 3 insertions(+), 233 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7cf51f97c..8154c71477 100644 --- 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 diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index fde4ce41b1..e50c2a994c 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -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); diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 7ee8659d1c..3247e91fd4 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -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 { diff --git a/src/bindings/java/jmsg_vm.cpp b/src/bindings/java/jmsg_vm.cpp index eb1880d0d9..5563400d08 100644 --- a/src/bindings/java/jmsg_vm.cpp +++ b/src/bindings/java/jmsg_vm.cpp @@ -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); -} diff --git a/src/bindings/java/jmsg_vm.h b/src/bindings/java/jmsg_vm.h index 31e33d9823..dd89414bc5 100644 --- a/src/bindings/java/jmsg_vm.h +++ b/src/bindings/java/jmsg_vm.h @@ -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 diff --git a/src/bindings/java/org/simgrid/msg/VM.java b/src/bindings/java/org/simgrid/msg/VM.java index a393c95aac..b9becc6856 100644 --- a/src/bindings/java/org/simgrid/msg/VM.java +++ b/src/bindings/java/org/simgrid/msg/VM.java @@ -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 { diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 7586e84fc4..e2bd5085cb 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -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(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(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 */ diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index c3f7e05826..67cd7bfd15 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -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()->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()->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. diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index 2c6e95e9b5..82b3d9ea1a 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -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); -- 2.20.1