/* -------------------------------------------------------------------------- */ /* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); you may */ /* not use this file except in compliance with the License. You may obtain */ /* a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ #ifndef LIFE_CYCLE_MANAGER_H_ #define LIFE_CYCLE_MANAGER_H_ #include "ActionManager.h" #include "VirtualMachinePool.h" #include "HostPool.h" #include "ImagePool.h" using namespace std; extern "C" void * lcm_action_loop(void *arg); //Forward definitions class TransferManager; class DispatchManager; class VirtualMachineManager; class ImageManager; /** * The Virtual Machine Life-cycle Manager module. This class is responsible for * managing the life-cycle of a Virtual Machine. */ class LifeCycleManager : public ActionListener { public: LifeCycleManager(): vmpool(0), hpool(0), ipool(0), tm(0), vmm(0), dm(0), imagem(0) { am.addListener(this); }; ~LifeCycleManager(){}; enum Actions { SAVE_SUCCESS, /**< Sent by the VMM when a save action succeeds */ SAVE_FAILURE, /**< Sent by the VMM when a save action fails */ DEPLOY_SUCCESS, /**< Sent by the VMM when a deploy/restore/migrate action succeeds */ DEPLOY_FAILURE, /**< Sent by the VMM when a deploy/restore/migrate action fails */ SHUTDOWN_SUCCESS, /**< Sent by the VMM when a shutdown action succeeds*/ SHUTDOWN_FAILURE, /**< Sent by the VMM when a shutdown action fails */ CANCEL_SUCCESS, /**< Sent by the VMM when a cancel action succeeds */ CANCEL_FAILURE, /**< Sent by the VMM when a cancel action fails */ MONITOR_SUSPEND, /**< Sent by the VMM when a VM is paused while active */ MONITOR_DONE, /**< Sent by the VMM when a Host cannot be monitored*/ MONITOR_POWEROFF, /**< Sent by the VMM when a VM is not found */ MONITOR_POWERON, /**< Sent by the VMM when a VM is found again */ PROLOG_SUCCESS, /**< Sent by the TM when the prolog phase succeeds */ PROLOG_FAILURE, /**< Sent by the TM when the prolog phase fails */ EPILOG_SUCCESS, /**< Sent by the TM when the epilog phase succeeds */ EPILOG_FAILURE, /**< Sent by the TM when the epilog phase fails */ ATTACH_SUCCESS, /**< Sent by the VMM when an attach action succeeds */ ATTACH_FAILURE, /**< Sent by the VMM when an attach action fails */ DETACH_SUCCESS, /**< Sent by the VMM when a detach action succeeds */ DETACH_FAILURE, /**< Sent by the VMM when a detach action fails */ ATTACH_NIC_SUCCESS,/**< Sent by the VMM when an attach nic action succeeds */ ATTACH_NIC_FAILURE,/**< Sent by the VMM when an attach nic action fails */ DETACH_NIC_SUCCESS,/**< Sent by the VMM when a detach nic action succeeds */ DETACH_NIC_FAILURE,/**< Sent by the VMM when a detach nic action fails */ CLEANUP_SUCCESS, /**< Sent by the VMM when a cleanup action succeeds */ CLEANUP_FAILURE, /**< Sent by the VMM when a cleanup action fails */ SAVEAS_SUCCESS, /**< Sent by the VMM when saveas succeeds */ SAVEAS_FAILURE, /**< Sent by the VMM when saveas fails */ SNAPSHOT_CREATE_SUCCESS, /**< Sent by the VMM on snap. create success */ SNAPSHOT_CREATE_FAILURE, /**< Sent by the VMM on snap. create failure */ SNAPSHOT_REVERT_SUCCESS, /**< Sent by the VMM on snap. revert success */ SNAPSHOT_REVERT_FAILURE, /**< Sent by the VMM on snap. revert failure */ SNAPSHOT_DELETE_SUCCESS, /**< Sent by the VMM on snap. revert success */ SNAPSHOT_DELETE_FAILURE, /**< Sent by the VMM on snap. revert failure */ DISK_SNAPSHOT_SUCCESS, /**