Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some placeholder functions from VMHL13 to VirtualMachine
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 29 Aug 2016 09:17:35 +0000 (11:17 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 29 Aug 2016 09:17:35 +0000 (11:17 +0200)
src/surf/virtual_machine.cpp
src/surf/virtual_machine.hpp
src/surf/vm_hl13.cpp
src/surf/vm_hl13.hpp

index fd7317b..3b35bf3 100644 (file)
@@ -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() {
index 9cfdde0..b14a744 100644 (file)
@@ -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;
index 4b7c927..41b183d 100644 (file)
@@ -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)
index 54642d3..e50883a 100644 (file)
@@ -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;
 };