Example #1
0
    def __init__(self, methodName='runTest'):
        unittest.TestCase.__init__(self, methodName=methodName)
        self.info = system.SystemAPI()
        with open(DISKSTATS, 'w+') as fp:
            fp.writelines(DISKSTATS_)
        with open(CPUINFO, 'w+') as fp:
            fp.writelines(CPUINFO_)
        with open(NETSTATS, 'w+') as fp:
            fp.writelines(NETSTAT_)

        self.info._DISKSTATS = DISKSTATS
        self.info._CPUINFO = CPUINFO
        self.info._NETSTATS = NETSTATS
Example #2
0
    def __init__(self):
        super(LifeCycleHandler, self).__init__()
        self._logger = logging.getLogger(__name__)
        self._op_api = operation.OperationAPI()
        self._system_api = system_api.SystemAPI()
        self._hostname_assigned = False
        self._reboot_finish_lock = threading.Lock()

        bus.define_events(
            # Fires before HostInit message is sent
            # @param msg
            "before_host_init",

            # Fires after HostInit message is sent
            "host_init",

            # Fires when HostInitResponse received
            # @param msg
            "host_init_response",

            # Fires before HostUp message is sent
            # @param msg
            "before_host_up",

            # Fires after HostUp message is sent
            "host_up",

            # Fires before RebootStart message is sent
            # @param msg
            "before_reboot_start",

            # Fires after RebootStart message is sent
            "reboot_start",

            # Fires before RebootFinish message is sent
            # @param msg
            "before_reboot_finish",

            # Fires after RebootFinish message is sent
            "reboot_finish",

            # Fires before Restart message is sent
            # @param msg: Restart message
            "before_restart",

            # Fires after Restart message is sent
            "restart",

            # Fires before Hello message is sent
            # @param msg
            "before_hello",

            # Fires after Hello message is sent
            "hello",

            # Fires after HostDown message is sent
            # @param msg
            "before_host_down",

            # Fires after HostDown message is sent
            "host_down",

            #
            # Service events
            #

            # Fires when behaviour is configured
            # @param service_name: Service name. Ex: mysql
            "service_configured")
        bus.on(init=self.on_init,
               start=self.on_start,
               reload=self.on_reload,
               shutdown=self.on_shutdown)
        self.on_reload()