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() {
~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;
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)
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;
};