From: Martin Quinson Date: Mon, 29 Aug 2016 09:17:35 +0000 (+0200) Subject: move some placeholder functions from VMHL13 to VirtualMachine X-Git-Tag: v3_14~462 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3e1e1ef3fe28de3204d1c6d60e89f8b2ae0cbb50?ds=sidebyside move some placeholder functions from VMHL13 to VirtualMachine --- diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index fd7317bdfa..3b35bf3d14 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -75,6 +75,35 @@ void VirtualMachine::turnOff() { onVmStateChange(this); } } +void VirtualMachine::suspend() +{ + action_->suspend(); + vmState_ = SURF_VM_STATE_SUSPENDED; +} + +void VirtualMachine::resume() +{ + action_->resume(); + vmState_ = SURF_VM_STATE_RUNNING; +} + +void VirtualMachine::save() +{ + vmState_ = SURF_VM_STATE_SAVING; + + /* FIXME: do something here */ + action_->suspend(); + vmState_ = SURF_VM_STATE_SAVED; +} + +void VirtualMachine::restore() +{ + vmState_ = SURF_VM_STATE_RESTORING; + + /* FIXME: do something here */ + action_->resume(); + vmState_ = SURF_VM_STATE_RUNNING; +} /** @brief returns the physical machine on which the VM is running **/ sg_host_t VirtualMachine::getPm() { diff --git a/src/surf/virtual_machine.hpp b/src/surf/virtual_machine.hpp index 9cfdde05b0..b14a7440e6 100644 --- a/src/surf/virtual_machine.hpp +++ b/src/surf/virtual_machine.hpp @@ -60,16 +60,16 @@ public: ~VirtualMachine(); /** @brief Suspend the VM */ - virtual void suspend()=0; + virtual void suspend(); /** @brief Resume the VM */ - virtual void resume()=0; + virtual void resume(); /** @brief Save the VM (Not yet implemented) */ - virtual void save()=0; + virtual void save(); /** @brief Restore the VM (Not yet implemented) */ - virtual void restore()=0; + virtual void restore(); /** @brief Migrate the VM to the destination host */ virtual void migrate(sg_host_t dest_PM)=0; diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 4b7c927f78..41b183d503 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -127,35 +127,6 @@ VMHL13::~VMHL13() { delete cpu_; } -void VMHL13::suspend() -{ - action_->suspend(); - vmState_ = SURF_VM_STATE_SUSPENDED; -} - -void VMHL13::resume() -{ - action_->resume(); - vmState_ = SURF_VM_STATE_RUNNING; -} - -void VMHL13::save() -{ - vmState_ = SURF_VM_STATE_SAVING; - - /* FIXME: do something here */ - action_->suspend(); - vmState_ = SURF_VM_STATE_SAVED; -} - -void VMHL13::restore() -{ - vmState_ = SURF_VM_STATE_RESTORING; - - /* FIXME: do something here */ - action_->resume(); - vmState_ = SURF_VM_STATE_RUNNING; -} /* Update the physical host of the given VM */ void VMHL13::migrate(sg_host_t host_dest) diff --git a/src/surf/vm_hl13.hpp b/src/surf/vm_hl13.hpp index 54642d3f4e..e50883ad64 100644 --- a/src/surf/vm_hl13.hpp +++ b/src/surf/vm_hl13.hpp @@ -48,14 +48,7 @@ public: VMHL13(VMModel *model, const char* name, sg_host_t host_PM); ~VMHL13(); - void suspend() override; - void resume() override; - - void save() override; - void restore() override; - void migrate(sg_host_t ind_dst_pm) override; - void setBound(double bound) override; };