Beispiel #1
0
    def __init__(self, persister, eventer, requests):
        super(ServerMonitor, self).__init__()

        # FQDN to ServerState
        self.servers = {}

        # Hostname to ServerState
        self.hostname_to_server = {}

        # FSID to ServiceState list
        self.fsid_services = defaultdict(list)

        # Service (fsid, type, id) to ServiceState
        self.services = {}

        self._complete = event.Event()

        self._eventer = eventer
        self._persister = persister
        self._requests = requests

        # Cache things we look up from pillar to avoid hitting disk repeatedly
        self._contact_period_cache = {}

        self.remote = get_remote()
    def __init__(self, persister, eventer, requests):
        super(ServerMonitor, self).__init__()

        # FQDN to ServerState
        self.servers = {}

        # Hostname to ServerState
        self.hostname_to_server = {}

        # FSID to ServiceState list
        self.fsid_services = defaultdict(list)

        # Service (fsid, type, id) to ServiceState
        self.services = {}

        self._complete = event.Event()

        self._eventer = eventer
        self._persister = persister
        self._requests = requests

        # Cache things we look up from pillar to avoid hitting disk repeatedly
        self._contact_period_cache = {}

        self.remote = get_remote()
Beispiel #3
0
    def _run(self):
        log.info("%s running" % self.__class__.__name__)

        remote = get_remote()
        remote.listen(self._complete,
                      on_heartbeat=self.on_heartbeat,
                      on_job=self.on_job,
                      on_running_jobs=self._manager.requests.on_tick_response)

        log.info("%s complete" % self.__class__.__name__)
    def __init__(self, manager):
        super(RequestCollection, self).__init__()

        self._by_request_id = {}
        self._by_jid = {}
        self._lock = RLock()

        self._remote = get_remote()

        self._manager = manager
Beispiel #5
0
    def __init__(self, manager):
        super(RequestCollection, self).__init__()

        self._by_request_id = {}
        self._by_jid = {}
        self._lock = RLock()

        self._remote = get_remote()

        self._manager = manager
Beispiel #6
0
    def _run(self):
        log.info("%s running" % self.__class__.__name__)

        remote = get_remote()
        remote.listen(self._complete,
                      on_heartbeat=self.on_heartbeat,
                      on_job=self.on_job,
                      on_running_jobs=self._manager.requests.on_tick_response)

        log.info("%s complete" % self.__class__.__name__)
from calamari_common.remote import get_remote, Unavailable

from cthulhu.manager import config
from cthulhu.gevent_util import nosleep, nosleep_mgr
from cthulhu.log import log
from cthulhu.manager.crush_node_request_factory import CrushNodeRequestFactory
from cthulhu.manager.crush_rule_request_factory import CrushRuleRequestFactory
from cthulhu.manager.crush_request_factory import CrushRequestFactory
from cthulhu.manager.osd_request_factory import OsdRequestFactory
from cthulhu.manager.pool_request_factory import PoolRequestFactory
from cthulhu.manager.plugin_monitor import PluginMonitor
from calamari_common.types import CRUSH_NODE, CRUSH_RULE, CRUSH_MAP, SYNC_OBJECT_STR_TYPE, SYNC_OBJECT_TYPES, OSD, POOL, OsdMap, MdsMap, MonMap, MonStatus
from cthulhu.util import now

remote = get_remote()

FAVORITE_TIMEOUT_FACTOR = int(config.get('cthulhu', 'favorite_timeout_factor'))


class ClusterUnavailable(Exception):
    pass


class SyncObjects(object):
    """
    A collection of versioned objects, keyed by their class (which
    must be a SyncObject subclass).

    The objects are immutable, so it is safe to hand out references: new
    versions are new objects.
Beispiel #8
0
 def __init__(self, manager):
     self._manager = manager
     self._remote = get_remote()
Beispiel #9
0
import logging
import uuid

from calamari_common.remote import get_remote
from cthulhu.log import log
from calamari_common.types import OsdMap, PgSummary, USER_REQUEST_COMPLETE, USER_REQUEST_SUBMITTED
from cthulhu.util import now

remote = get_remote()


class UserRequestBase(object):
    """
    A request acts on one or more Ceph-managed objects, i.e.
    mon, mds, osd, pg.

    Amidst the terminology mess of 'jobs', 'commands', 'operations', this class
    is named for clarity: it's an operation at an end-user level of
    granularity, something that might be a button in the UI.

    UserRequests are usually remotely executed on a mon.  However, there
    may be a final step of updating the state of ClusterMonitor in order
    that subsequent REST API consumer reads return values consistent with
    the job having completed, e.g. waiting for the OSD map to be up
    to date before calling a pool creation complete.  For this reason,
    UserRequests have a local ID and completion state that is independent
    of their remote ID (salt jid).  UserRequests may also execute more than
    one JID in the course of their lifetime.

    Requests have the following lifecycle:
     NEW object is created, it has all the information needed to do its job
Beispiel #10
0
 def __init__(self, manager):
     self._manager = manager
     self._remote = get_remote()