Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | ceph-main/src/pybind/mgr/dashboard/tests/test_host.py | import unittest
from unittest import mock
from orchestrator import DaemonDescription, HostSpec
from .. import mgr
from ..controllers._version import APIVersion
from ..controllers.host import Host, HostUi, get_device_osd_map, get_hosts, get_inventories
from ..tests import ControllerTestCase, patch_orch
from ..tools im... | 21,103 | 34.173333 | 97 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_iscsi.py | # pylint: disable=too-many-public-methods, too-many-lines
import copy
import errno
import json
import unittest
try:
import mock
except ImportError:
import unittest.mock as mock
from mgr_module import ERROR_MSG_NO_INPUT_FILE
from .. import mgr
from ..controllers.iscsi import Iscsi, IscsiTarget, IscsiUi
from ... | 53,551 | 40.935787 | 99 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_nfs.py | # -*- coding: utf-8 -*-
# pylint: disable=too-many-lines
from copy import deepcopy
from unittest.mock import Mock, patch
from urllib.parse import urlencode
from nfs.export import AppliedExportResults
from .. import mgr
from ..controllers._version import APIVersion
from ..controllers.nfs import NFSGaneshaExports, NFSG... | 8,762 | 34.334677 | 84 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_notification.py | # -*- coding: utf-8 -*-
import random
import time
import unittest
from ..tools import NotificationQueue
class Listener(object):
# pylint: disable=too-many-instance-attributes
def __init__(self):
self.type1 = []
self.type1_ts = []
self.type2 = []
self.type2_ts = []
sel... | 4,800 | 34.043796 | 82 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_orchestrator.py | import inspect
import unittest
from unittest import mock
from orchestrator import Orchestrator as OrchestratorBase
from ..controllers.orchestrator import Orchestrator
from ..services.orchestrator import OrchFeature
from ..tests import ControllerTestCase
class OrchestratorControllerTest(ControllerTestCase):
URL_... | 1,363 | 32.268293 | 86 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_osd.py | # -*- coding: utf-8 -*-
import uuid
from contextlib import contextmanager
from typing import Any, Dict, List, Optional
from unittest import mock
from ceph.deployment.drive_group import DeviceSelection, DriveGroupSpec # type: ignore
from ceph.deployment.service_spec import PlacementSpec
from .. import mgr
from ..cont... | 19,388 | 38.3286 | 100 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_plugin_debug.py | # -*- coding: utf-8 -*-
from ..tests import CLICommandTestMixin, ControllerTestCase
class TestPluginDebug(ControllerTestCase, CLICommandTestMixin):
@classmethod
def setup_server(cls):
# pylint: disable=protected-access
cls.setup_controllers([])
def setUp(self):
self.mock_kv_store... | 1,049 | 26.631579 | 63 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_pool.py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
import time
try:
import mock
except ImportError:
import unittest.mock as mock
from .. import mgr
from ..controllers.pool import Pool
from ..controllers.task import Task
from ..tests import ControllerTestCase
from ..tools import NotificationQueue, Task... | 6,012 | 32.220994 | 81 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_prometheus.py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from .. import mgr
from ..controllers.prometheus import Prometheus, PrometheusNotifications, PrometheusReceiver
from ..tests import ControllerTestCase
class PrometheusCon... | 6,563 | 46.565217 | 94 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py |
import json
import unittest
import rbd
try:
import mock
except ImportError:
import unittest.mock as mock
from .. import mgr
from ..controllers.orchestrator import Orchestrator
from ..controllers.rbd_mirroring import RbdMirroring, \
RbdMirroringPoolBootstrap, RbdMirroringStatus, RbdMirroringSummary, \
... | 10,907 | 33.194357 | 89 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rbd_service.py | # -*- coding: utf-8 -*-
# pylint: disable=dangerous-default-value,too-many-public-methods
import unittest
from datetime import datetime
from unittest.mock import MagicMock
try:
import mock
except ImportError:
import unittest.mock as mock
from .. import mgr
from ..services.rbd import RbdConfiguration, RBDSche... | 6,939 | 37.555556 | 100 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rest_client.py | # -*- coding: utf-8 -*-
import unittest
import requests.exceptions
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from urllib3.exceptions import MaxRetryError, ProtocolError
from .. import mgr
from ..rest_client import RequestException, RestClient
class RestClientTestClass... | 4,871 | 42.891892 | 87 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rest_tasks.py | # -*- coding: utf-8 -*-
import time
try:
import mock
except ImportError:
import unittest.mock as mock
from ..controllers import RESTController, Router, Task
from ..controllers.task import Task as TaskController
from ..services import progress
from ..tests import ControllerTestCase
from ..tools import Notific... | 2,790 | 29.010753 | 62 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rgw.py | from unittest.mock import Mock, call, patch
from .. import mgr
from ..controllers.rgw import Rgw, RgwDaemon, RgwUser
from ..rest_client import RequestException
from ..services.rgw_client import RgwClient
from ..tests import ControllerTestCase, RgwStub
class RgwControllerTestCase(ControllerTestCase):
@classmethod... | 8,268 | 34.952174 | 100 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_rgw_client.py | # -*- coding: utf-8 -*-
# pylint: disable=too-many-public-methods
import errno
from unittest import TestCase
from unittest.mock import Mock, patch
from .. import mgr
from ..exceptions import DashboardException
from ..services.rgw_client import NoCredentialsException, \
NoRgwDaemonsException, RgwClient, _parse_fron... | 14,602 | 40.019663 | 100 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_settings.py | # -*- coding: utf-8 -*-
import errno
import unittest
from mgr_module import ERROR_MSG_EMPTY_INPUT_FILE
from .. import settings
from ..controllers.settings import Settings as SettingsController
from ..settings import Settings, handle_option_command
from ..tests import ControllerTestCase, KVStoreMockMixin
class Sett... | 7,147 | 33.365385 | 91 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_ssl.py | import errno
import unittest
from ..tests import CLICommandTestMixin, CmdException
class SslTest(unittest.TestCase, CLICommandTestMixin):
def test_ssl_certificate_and_key(self):
with self.assertRaises(CmdException) as ctx:
self.exec_cmd('set-ssl-certificate', inbuf='', mgr_id='x')
se... | 1,237 | 41.689655 | 99 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_sso.py | # -*- coding: utf-8 -*-
# pylint: disable=dangerous-default-value,too-many-public-methods
import errno
import tempfile
import unittest
from ..services.sso import load_sso_db
from ..tests import CLICommandTestMixin, CmdException
class AccessControlTest(unittest.TestCase, CLICommandTestMixin):
IDP_METADATA = '''<... | 8,867 | 45.429319 | 113 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_task.py | # -*- coding: utf-8 -*-
import json
import threading
import time
import unittest
from collections import defaultdict
from functools import partial
from ..services.exception import serialize_dashboard_exception
from ..tools import NotificationQueue, TaskExecutor, TaskManager
class MyTask(object):
class CallbackE... | 16,715 | 37.605081 | 80 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_tools.py | # -*- coding: utf-8 -*-
import unittest
import cherrypy
from cherrypy.lib.sessions import RamSession
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from ..controllers import APIRouter, BaseController, Proxy, RESTController, Router
from ..controllers._version import APIVersio... | 7,442 | 34.274882 | 93 | py |
null | ceph-main/src/pybind/mgr/dashboard/tests/test_versioning.py | # -*- coding: utf-8 -*-
import unittest
from ..controllers._api_router import APIRouter
from ..controllers._rest_controller import RESTController
from ..controllers._version import APIVersion
from ..tests import ControllerTestCase
@APIRouter("/vtest", secure=False)
class VTest(RESTController):
RESOURCE_ID = "vi... | 2,450 | 30.025316 | 79 | py |
null | ceph-main/src/pybind/mgr/devicehealth/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/devicehealth/module.py | """
Device health monitoring
"""
import errno
import json
from mgr_module import MgrModule, CommandResult, MgrModuleRecoverDB, CLIRequiresDB, CLICommand, CLIReadCommand, Option, MgrDBNotReady
import operator
import rados
import re
from threading import Event
from datetime import datetime, timedelta, timezone
from typi... | 29,158 | 36.335467 | 133 | py |
null | ceph-main/src/pybind/mgr/diskprediction_local/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/diskprediction_local/module.py | """
diskprediction with local predictor
"""
import json
import datetime
from threading import Event
import time
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING
from mgr_module import CommandResult, MgrModule, Option
# Importing scipy early appears to avoid a future deadlock when
# we try to do
#
# f... | 12,787 | 40.79085 | 102 | py |
null | ceph-main/src/pybind/mgr/diskprediction_local/predictor.py | """Machine learning model for disk failure prediction.
This classes defined here provide the disk failure prediction module.
RHDiskFailurePredictor uses the models developed at the AICoE in the
Office of the CTO at Red Hat. These models were built using the open
source Backblaze SMART metrics dataset.
PSDiskFailurePre... | 17,526 | 35.138144 | 114 | py |
null | ceph-main/src/pybind/mgr/feedback/__init__.py | # flake8: noqa
from .module import FeedbackModule | 49 | 24 | 34 | py |
null | ceph-main/src/pybind/mgr/feedback/model.py | # # -*- coding: utf-8 -*-
from enum import Enum
class Feedback:
project_id: int
tracker_id: int
subject: str
description: str
status: int
class Project(Enum):
dashboard = 46
block = 9 # rbd
object = 10 # rgw
file_system = 13 # cephfs
ceph_manager = 4... | 1,138 | 22.729167 | 69 | py |
null | ceph-main/src/pybind/mgr/feedback/module.py |
"""
Feedback module
See doc/mgr/feedback.rst for more info.
"""
from requests.exceptions import RequestException
from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule
import errno
from .service import CephTrackerClient
from .model import Feedback
class FeedbackModule(MgrModule):
# there are ... | 5,337 | 37.128571 | 134 | py |
null | ceph-main/src/pybind/mgr/feedback/service.py | # -*- coding: utf-8 -*-
import json
import requests
from requests.exceptions import RequestException
from .model import Feedback
class config:
url = 'tracker.ceph.com'
port = 443
class CephTrackerClient():
def list_issues(self):
'''
Fetch an issue from the Ceph Issue tracker
'''... | 1,536 | 29.74 | 85 | py |
null | ceph-main/src/pybind/mgr/hello/__init__.py | # flake8: noqa
from .module import Hello
| 41 | 13 | 25 | py |
null | ceph-main/src/pybind/mgr/hello/module.py |
"""
A hello world module
See doc/mgr/hello.rst for more info.
"""
from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option
from threading import Event
from typing import cast, Any, Optional, TYPE_CHECKING
import errno
class Hello(MgrModule):
# These are module options we understand. These... | 4,515 | 31.724638 | 78 | py |
null | ceph-main/src/pybind/mgr/influx/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/influx/module.py | from contextlib import contextmanager
from datetime import datetime
from threading import Event, Thread
from itertools import chain
import queue
import json
import errno
import time
from typing import cast, Any, Dict, Iterator, List, Optional, Tuple, Union
from mgr_module import CLICommand, CLIReadCommand, CLIWriteCom... | 18,317 | 37.004149 | 99 | py |
null | ceph-main/src/pybind/mgr/insights/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
from .module import Module
| 85 | 11.285714 | 28 | py |
null | ceph-main/src/pybind/mgr/insights/health.py | import json
from collections import defaultdict
import datetime
# freq to write cached state to disk
PERSIST_PERIOD = datetime.timedelta(seconds=10)
# on disk key prefix
HEALTH_HISTORY_KEY_PREFIX = "health_history/"
# apply on offset to "now": used for testing
NOW_OFFSET = None
class HealthEncoder(json.JSONEncoder):... | 6,282 | 31.056122 | 80 | py |
null | ceph-main/src/pybind/mgr/insights/module.py | import datetime
import json
import re
import threading
from mgr_module import CLICommand, CLIReadCommand, HandleCommandResult
from mgr_module import MgrModule, CommandResult, NotifyType
from . import health as health_util
# hours of crash history to report
CRASH_HISTORY_HOURS = 24
# hours of health history to report
... | 11,800 | 35.649068 | 90 | py |
null | ceph-main/src/pybind/mgr/insights/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/insights/tests/test_health.py | import unittest
from tests import mock
from ..health import *
class HealthChecksTest(unittest.TestCase):
def test_check_accum_empty(self):
# health checks accum initially empty reports empty
h = HealthCheckAccumulator()
self.assertEqual(h.checks(), {})
h = HealthCheckAccumulator({... | 8,146 | 28.518116 | 80 | py |
null | ceph-main/src/pybind/mgr/iostat/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/iostat/module.py | from typing import Any
from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule
class Module(MgrModule):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
def self_test(self) -> None:
r = self.get('io_rate')
assert 'pg_stats_delta' ... | 2,145 | 33.063492 | 89 | py |
null | ceph-main/src/pybind/mgr/k8sevents/README.md | # Testing
## To test the k8sevents module
enable the module with `ceph mgr module enable k8sevents`
check that it's working `ceph k8sevents status`, you should see something like this;
```
[root@ceph-mgr ~]# ceph k8sevents status
Kubernetes
- Hostname : https://localhost:30443
- Namespace: ceph
Tracker Health
- ... | 4,591 | 55 | 314 | md |
null | ceph-main/src/pybind/mgr/k8sevents/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/k8sevents/module.py | # Integrate with the kubernetes events API.
# This module sends events to Kubernetes, and also captures/tracks all events
# in the rook-ceph namespace so kubernetes activity like pod restarts,
# imagepulls etc can be seen from within the ceph cluster itself.
#
# To interact with the events API, the mgr service to acce... | 55,816 | 37.335852 | 172 | py |
null | ceph-main/src/pybind/mgr/k8sevents/rbac_sample.yaml | ---
# Create a namespace to receive our test events
apiVersion: v1
kind: Namespace
metadata:
name: ceph
---
# Define the access rules to open the events API to k8sevents
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ceph-mgr-events-rules
rules:
- apiGroups:
- ""
resources:
- ... | 871 | 17.956522 | 61 | yaml |
null | ceph-main/src/pybind/mgr/localpool/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/localpool/module.py | from mgr_module import MgrModule, CommandResult, Option, NotifyType
import json
import threading
from typing import cast, Any
class Module(MgrModule):
MODULE_OPTIONS = [
Option(
name='subtree',
type='str',
default='rack',
desc='CRUSH level for which to crea... | 5,082 | 36.10219 | 108 | py |
null | ceph-main/src/pybind/mgr/mds_autoscaler/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
from .module import MDSAutoscaler
| 92 | 12.285714 | 33 | py |
null | ceph-main/src/pybind/mgr/mds_autoscaler/module.py | """
Automatically scale MDSs based on status of the file-system using the FSMap
"""
import logging
from typing import Any, Optional
from mgr_module import MgrModule, NotifyType
from orchestrator._interface import MDSSpec, ServiceSpec
import orchestrator
import copy
log = logging.getLogger(__name__)
class MDSAutosca... | 3,748 | 36.49 | 108 | py |
null | ceph-main/src/pybind/mgr/mds_autoscaler/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/mds_autoscaler/tests/test_autoscaler.py | import pytest
from unittest import mock
from ceph.deployment.service_spec import ServiceSpec, PlacementSpec
from orchestrator import DaemonDescription, OrchResult, ServiceDescription
try:
from typing import Any, List
except ImportError:
pass
from mds_autoscaler.module import MDSAutoscaler
@pytest.fixture()... | 2,566 | 27.842697 | 118 | py |
null | ceph-main/src/pybind/mgr/mirroring/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/mirroring/module.py | from typing import List, Optional
from mgr_module import MgrModule, CLIReadCommand, CLIWriteCommand, Option, NotifyType
from .fs.snapshot_mirror import FSSnapshotMirror
class Module(MgrModule):
MODULE_OPTIONS: List[Option] = []
NOTIFY_TYPES = [NotifyType.fs_map]
def __init__(self, *args, **kwargs):
... | 4,530 | 42.567308 | 93 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/mirroring/fs/blocklist.py | import logging
log = logging.getLogger(__name__)
def blocklist(mgr, addr):
cmd = {'prefix': 'osd blocklist', 'blocklistop': 'add', 'addr': str(addr)}
r, outs, err = mgr.mon_command(cmd)
if r != 0:
log.error(f'blocklist error: {err}')
return r
| 269 | 23.545455 | 78 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/exception.py | class MirrorException(Exception):
def __init__(self, error_code, error_msg=''):
super().__init__(error_code, error_msg)
| 132 | 32.25 | 49 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/notify.py | import errno
import json
import logging
import threading
import time
import rados
from .utils import MIRROR_OBJECT_PREFIX, AsyncOpTracker
log = logging.getLogger(__name__)
class Notifier:
def __init__(self, ioctx):
self.ioctx = ioctx
@staticmethod
def instance_object(instance_id):
retur... | 4,607 | 36.770492 | 95 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/snapshot_mirror.py | import base64
import errno
import json
import logging
import os
import pickle
import re
import stat
import threading
import uuid
from typing import Dict, Any
import cephfs
import rados
from mgr_util import RTimer, CephfsClient, open_filesystem,\
CephfsConnectionException
from mgr_module import NotifyType
from .bl... | 36,865 | 45.489281 | 126 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/utils.py | import errno
import logging
import threading
import rados
import cephfs
from .exception import MirrorException
MIRROR_OBJECT_PREFIX = 'cephfs_mirror'
MIRROR_OBJECT_NAME = MIRROR_OBJECT_PREFIX
INSTANCE_ID_PREFIX = "instance_"
DIRECTORY_MAP_PREFIX = "dir_map_"
log = logging.getLogger(__name__)
def connect_to_cluste... | 5,418 | 34.418301 | 85 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/create.py | import errno
import logging
import rados
from ..exception import MirrorException
from ..utils import MIRROR_OBJECT_NAME
log = logging.getLogger(__name__)
def create_mirror_object(rados_inst, pool_id):
log.info(f'creating mirror object: {MIRROR_OBJECT_NAME}')
try:
with rados_inst.open_ioctx2(pool_id)... | 724 | 29.208333 | 68 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/load.py | import errno
import pickle
import logging
from typing import Dict
import rados
from ..exception import MirrorException
from ..utils import MIRROR_OBJECT_NAME, DIRECTORY_MAP_PREFIX, \
INSTANCE_ID_PREFIX
log = logging.getLogger(__name__)
MAX_RETURN = 256
def handle_dir_load(dir_mapping, dir_map):
for directo... | 2,809 | 36.466667 | 97 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/policy.py | import os
import errno
import logging
import time
from threading import Lock
from typing import Dict
from .state_transition import ActionType, PolicyAction, Transition, \
State, StateTransition
from ..exception import MirrorException
log = logging.getLogger(__name__)
class DirectoryState:
def __init__(self, ... | 17,256 | 44.293963 | 114 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/state_transition.py | import logging
from enum import Enum, unique
from typing import Dict
log = logging.getLogger(__name__)
@unique
class State(Enum):
UNASSOCIATED = 0
INITIALIZING = 1
ASSOCIATING = 2
ASSOCIATED = 3
SHUFFLING = 4
DISASSOCIATING = 5
@unique
class ActionType(Enum):
NONE = ... | 3,884 | 39.894737 | 115 | py |
null | ceph-main/src/pybind/mgr/mirroring/fs/dir_map/update.py | import errno
import pickle
import logging
import rados
from ..utils import MIRROR_OBJECT_NAME, DIRECTORY_MAP_PREFIX, \
INSTANCE_ID_PREFIX, MIRROR_OBJECT_PREFIX
log = logging.getLogger(__name__)
MAX_UPDATE = 256
class UpdateDirMapRequest:
def __init__(self, ioctx, update_mapping, removals, on_finish_callbac... | 5,996 | 38.453947 | 108 | py |
null | ceph-main/src/pybind/mgr/nfs/__init__.py | # flake8: noqa
import os
if 'UNITTEST' in os.environ:
import tests
from .module import Module
| 100 | 11.625 | 28 | py |
null | ceph-main/src/pybind/mgr/nfs/cluster.py | import ipaddress
import logging
import re
import socket
from typing import cast, Dict, List, Any, Union, Optional, TYPE_CHECKING
from mgr_module import NFS_POOL_NAME as POOL_NAME
from ceph.deployment.service_spec import NFSServiceSpec, PlacementSpec, IngressSpec
from object_format import ErrorResponse
import orchestr... | 13,463 | 42.432258 | 97 | py |
null | ceph-main/src/pybind/mgr/nfs/exception.py | import errno
from typing import Optional
class NFSException(Exception):
def __init__(self, err_msg: str, errno: int = -1) -> None:
super(NFSException, self).__init__(errno, err_msg)
self.errno = errno
self.err_msg = err_msg
def __str__(self) -> str:
return self.err_msg
class... | 954 | 27.939394 | 75 | py |
null | ceph-main/src/pybind/mgr/nfs/export.py | import errno
import json
import logging
from typing import (
List,
Any,
Dict,
Optional,
TYPE_CHECKING,
TypeVar,
Callable,
Set,
cast)
from os.path import normpath
import cephfs
from rados import TimedOut, ObjectNotFound, Rados, LIBRADOS_ALL_NSPACES
from object_format import ErrorRes... | 33,797 | 38.437573 | 103 | py |
null | ceph-main/src/pybind/mgr/nfs/ganesha_conf.py | from typing import cast, List, Dict, Any, Optional, TYPE_CHECKING
from os.path import isabs
from mgr_module import NFS_GANESHA_SUPPORTED_FSALS
from .exception import NFSInvalidOperation, FSNotFound
from .utils import check_fs
if TYPE_CHECKING:
from nfs.module import Module
def _indentation(depth: int, size: in... | 19,920 | 35.285974 | 100 | py |
null | ceph-main/src/pybind/mgr/nfs/module.py | import logging
import threading
from typing import Tuple, Optional, List, Dict, Any
from mgr_module import MgrModule, CLICommand, Option, CLICheckNonemptyFileInput
import object_format
import orchestrator
from orchestrator.module import IngressType
from .export import ExportMgr, AppliedExportResults
from .cluster imp... | 7,831 | 40.221053 | 92 | py |
null | ceph-main/src/pybind/mgr/nfs/utils.py | import functools
import logging
import stat
from typing import List, Tuple, TYPE_CHECKING
from object_format import ErrorResponseBase
import orchestrator
import cephfs
from mgr_util import CephfsClient, open_filesystem
if TYPE_CHECKING:
from nfs.module import Module
EXPORT_PREFIX: str = "export-"
CONF_PREFIX: st... | 3,382 | 31.219048 | 82 | py |
null | ceph-main/src/pybind/mgr/nfs/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/nfs/tests/test_nfs.py | # flake8: noqa
import json
import pytest
from typing import Optional, Tuple, Iterator, List, Any
from contextlib import contextmanager
from unittest import mock
from unittest.mock import MagicMock
from mgr_module import MgrModule, NFS_POOL_NAME
from rados import ObjectNotFound
from ceph.deployment.service_spec impor... | 41,758 | 35.092481 | 107 | py |
null | ceph-main/src/pybind/mgr/orchestrator/README.md | # Orchestrator CLI
See also [orchestrator cli doc](https://docs.ceph.com/en/latest/mgr/orchestrator/).
## Running the Teuthology tests
To run the API tests against a real Ceph cluster, we leverage the Teuthology
framework and the `test_orchestrator` backend.
``source`` the script and run the tests manually::
$... | 467 | 30.2 | 83 | md |
null | ceph-main/src/pybind/mgr/orchestrator/__init__.py | # flake8: noqa
from .module import OrchestratorCli
# usage: E.g. `from orchestrator import StatelessServiceSpec`
from ._interface import \
OrchResult, raise_if_exception, handle_orch_error, \
CLICommand, _cli_write_command, _cli_read_command, CLICommandMeta, \
Orchestrator, OrchestratorClientMixin, \
... | 723 | 33.47619 | 90 | py |
null | ceph-main/src/pybind/mgr/orchestrator/_interface.py |
"""
ceph-mgr orchestrator interface
Please see the ceph-mgr module developer's guide for more information.
"""
import copy
import datetime
import enum
import errno
import logging
import pickle
import re
from collections import namedtuple, OrderedDict
from contextlib import contextmanager
from functools import wraps... | 61,137 | 35.874548 | 223 | py |
null | ceph-main/src/pybind/mgr/orchestrator/module.py | import enum
import errno
import json
from typing import List, Set, Optional, Iterator, cast, Dict, Any, Union, Sequence, Mapping
import re
import datetime
import math
import yaml
from prettytable import PrettyTable
try:
from natsort import natsorted
except ImportError:
# fallback to normal sort
natsorted ... | 73,342 | 40.36661 | 138 | py |
null | ceph-main/src/pybind/mgr/orchestrator/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/orchestrator/tests/test_orchestrator.py |
import json
import textwrap
import pytest
import yaml
from ceph.deployment.hostspec import HostSpec
from ceph.deployment.inventory import Devices, Device
from ceph.deployment.service_spec import ServiceSpec
from ceph.deployment import inventory
from ceph.utils import datetime_now
from mgr_module import HandleCommand... | 10,480 | 34.771331 | 117 | py |
null | ceph-main/src/pybind/mgr/osd_perf_query/__init__.py | from .module import OSDPerfQuery
| 33 | 16 | 32 | py |
null | ceph-main/src/pybind/mgr/osd_perf_query/module.py |
"""
osd_perf_query module
"""
from itertools import groupby
from time import time
import errno
import prettytable
from mgr_module import MgrModule
def get_human_readable(bytes, precision=2):
suffixes = ['', 'Ki', 'Mi', 'Gi', 'Ti']
suffix_index = 0
while bytes > 1024 and suffix_index < 4:
# incre... | 7,796 | 38.57868 | 96 | py |
null | ceph-main/src/pybind/mgr/osd_support/__init__.py | from .module import OSDSupport
| 31 | 15 | 30 | py |
null | ceph-main/src/pybind/mgr/osd_support/module.py | from mgr_module import MgrModule
class OSDSupport(MgrModule):
# Kept to keep upgrades from older point releases working.
# This module can be removed as soon as we no longer
# support upgrades from old octopus point releases.
# On the other hand, if you find a use for this module,
# Feel free to ... | 495 | 23.8 | 62 | py |
null | ceph-main/src/pybind/mgr/pg_autoscaler/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
from .module import PgAutoscaler, effective_target_ratio
| 115 | 15.571429 | 56 | py |
null | ceph-main/src/pybind/mgr/pg_autoscaler/module.py | """
Automatically scale pg_num based on how much data is stored in each pool.
"""
import json
import mgr_util
import threading
from typing import Any, Dict, List, Optional, Set, Tuple, TYPE_CHECKING, Union
import uuid
from prettytable import PrettyTable
from mgr_module import HealthChecksT, CLIReadCommand, CLIWriteCom... | 33,980 | 40.289186 | 119 | py |
null | ceph-main/src/pybind/mgr/pg_autoscaler/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/pg_autoscaler/tests/test_cal_final_pg_target.py | # python unit test
import unittest
from tests import mock
import pytest
import json
from pg_autoscaler import module
class RootMapItem:
def __init__(self, pool_count, pg_target, pg_left):
self.pool_count = pool_count
self.pg_target = pg_target
self.pg_left = pg_left
self.pool_use... | 19,491 | 27.791728 | 97 | py |
null | ceph-main/src/pybind/mgr/pg_autoscaler/tests/test_cal_ratio.py | from pg_autoscaler import effective_target_ratio
from pytest import approx
def check_simple_ratio(target_ratio, tot_ratio):
etr = effective_target_ratio(target_ratio, tot_ratio, 0, 0)
assert (target_ratio / tot_ratio) == approx(etr)
return etr
def test_simple():
etr1 = check_simple_ratio(0.2, 0.9)
... | 1,123 | 28.578947 | 63 | py |
null | ceph-main/src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py | # python unit test
import unittest
from tests import mock
import pytest
import json
from pg_autoscaler import module
class OSDMAP:
def __init__(self, pools):
self.pools = pools
def get_pools(self):
return self.pools
def pool_raw_used_rate(pool_id):
return 1
class CRUSH:
def... | 15,051 | 30.358333 | 120 | py |
null | ceph-main/src/pybind/mgr/progress/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
from .module import Module
| 86 | 9.875 | 28 | py |
null | ceph-main/src/pybind/mgr/progress/module.py | try:
from typing import List, Dict, Union, Any, Optional
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False
from mgr_module import MgrModule, OSDMap, Option
from mgr_util import to_pretty_timedelta
from datetime import timedelta
import os
import threading
import datetime
import uuid... | 30,853 | 33.942242 | 104 | py |
null | ceph-main/src/pybind/mgr/progress/test_progress.py | #python unit test
import unittest
import os
import sys
from tests import mock
import pytest
import json
os.environ['UNITTEST'] = "1"
sys.path.insert(0, "../../pybind/mgr")
from progress import module
class TestPgRecoveryEvent(object):
# Testing PgRecoveryEvent class
def setup_method(self):
# Creating... | 5,364 | 29.657143 | 114 | py |
null | ceph-main/src/pybind/mgr/prometheus/__init__.py | # flake8: noqa
from .module import Module, StandbyModule
| 57 | 18.333333 | 41 | py |
null | ceph-main/src/pybind/mgr/prometheus/module.py | import cherrypy
import yaml
from collections import defaultdict
from pkg_resources import packaging # type: ignore
import json
import math
import os
import re
import threading
import time
import enum
from collections import namedtuple
from mgr_module import CLIReadCommand, MgrModule, MgrStandbyModule, PG_STATES, Opti... | 78,062 | 37.740943 | 295 | py |
null | ceph-main/src/pybind/mgr/prometheus/test_module.py | from typing import Dict
from unittest import TestCase
from prometheus.module import Metric, LabelValues, Number
class MetricGroupTest(TestCase):
def setUp(self):
self.DISK_OCCUPATION = (
"ceph_daemon",
"device",
"db_device",
"wal_device",
"insta... | 3,979 | 41.340426 | 113 | py |
null | ceph-main/src/pybind/mgr/rbd_support/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/rbd_support/common.py | import re
from typing import Dict, Optional, Tuple, TYPE_CHECKING, Union
GLOBAL_POOL_KEY = (None, None)
class NotAuthorizedError(Exception):
pass
if TYPE_CHECKING:
from rbd_support.module import Module
def is_authorized(module: 'Module',
pool: Optional[str],
namespac... | 1,364 | 26.857143 | 82 | py |
null | ceph-main/src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py | import errno
import json
import rados
import rbd
import traceback
from datetime import datetime
from threading import Condition, Lock, Thread
from typing import Any, Dict, List, NamedTuple, Optional, Set, Tuple, Union
from .common import get_rbd_pools
from .schedule import LevelSpec, Schedules
def namespace_validat... | 24,356 | 38.033654 | 111 | py |
null | ceph-main/src/pybind/mgr/rbd_support/module.py | """
RBD support module
"""
import enum
import errno
import functools
import inspect
import rados
import rbd
import traceback
from typing import cast, Any, Callable, Optional, Tuple, TypeVar
from mgr_module import CLIReadCommand, CLIWriteCommand, MgrModule, Option
from threading import Thread, Event
from .common impo... | 12,491 | 37.795031 | 98 | py |