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/rbd_support/perf.py | import errno
import json
import rados
import rbd
import time
import traceback
from datetime import datetime, timedelta
from threading import Condition, Lock, Thread
from typing import cast, Any, Callable, Dict, List, Optional, Set, Tuple, Union
from .common import (GLOBAL_POOL_KEY, authorize_request, extract_pool_key... | 21,941 | 40.874046 | 111 | py |
null | ceph-main/src/pybind/mgr/rbd_support/schedule.py | import datetime
import json
import rados
import rbd
import re
from dateutil.parser import parse
from typing import cast, Any, Callable, Dict, List, Optional, Set, Tuple, TYPE_CHECKING
from .common import get_rbd_pools
if TYPE_CHECKING:
from .module import Module
SCHEDULE_INTERVAL = "interval"
SCHEDULE_START_TIME... | 22,757 | 38.237931 | 87 | py |
null | ceph-main/src/pybind/mgr/rbd_support/task.py | import errno
import json
import rados
import rbd
import re
import traceback
import uuid
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import partial, wraps
from threading import Condition, Lock, Thread
from typing import cast, Any, Callable, Dict, Iterator, List, Optiona... | 33,972 | 38.595571 | 111 | py |
null | ceph-main/src/pybind/mgr/rbd_support/trash_purge_schedule.py | import json
import rados
import rbd
import traceback
from datetime import datetime
from threading import Condition, Lock, Thread
from typing import Any, Dict, List, Optional, Tuple
from .common import get_rbd_pools
from .schedule import LevelSpec, Schedules
class TrashPurgeScheduleHandler:
MODULE_OPTION_NAME = ... | 10,652 | 36.510563 | 107 | py |
null | ceph-main/src/pybind/mgr/restful/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/restful/common.py | # List of valid osd flags
OSD_FLAGS = [
'pause', 'noup', 'nodown', 'noout', 'noin', 'nobackfill',
'norecover', 'noscrub', 'nodeep-scrub',
]
# Implemented osd commands
OSD_IMPLEMENTED_COMMANDS = [
'scrub', 'deep-scrub', 'repair'
]
# Valid values for the 'var' argument to 'ceph osd pool set'
POOL_PROPERTIES... | 4,740 | 29.197452 | 82 | py |
null | ceph-main/src/pybind/mgr/restful/context.py | # Global instance to share
instance = None
| 43 | 13.666667 | 26 | py |
null | ceph-main/src/pybind/mgr/restful/decorators.py |
from pecan import request, response
from base64 import b64decode
from functools import wraps
import traceback
from . import context
# Handle authorization
def auth(f):
@wraps(f)
def decorated(*args, **kwargs):
if not context.instance.enable_auth:
return f(*args, **kwargs)
... | 2,270 | 26.695122 | 91 | py |
null | ceph-main/src/pybind/mgr/restful/hooks.py |
from pecan.hooks import PecanHook
import traceback
from . import context
class ErrorHook(PecanHook):
def on_error(self, stat, exc):
context.instance.log.error(str(traceback.format_exc()))
| 204 | 17.636364 | 63 | py |
null | ceph-main/src/pybind/mgr/restful/module.py | """
A RESTful API for Ceph
"""
import os
import json
import time
import errno
import inspect
import tempfile
import threading
import traceback
import socket
import fcntl
from . import common
from . import context
from uuid import uuid4
from pecan import jsonify, make_app
from OpenSSL import crypto
from pecan.rest im... | 18,203 | 28.648208 | 114 | py |
null | ceph-main/src/pybind/mgr/restful/api/__init__.py | from pecan import expose
from pecan.rest import RestController
from .config import Config
from .crush import Crush
from .doc import Doc
from .mon import Mon
from .osd import Osd
from .pool import Pool
from .perf import Perf
from .request import Request
from .server import Server
class Root(RestController):
confi... | 990 | 23.775 | 76 | py |
null | ceph-main/src/pybind/mgr/restful/api/config.py | from pecan import expose, request
from pecan.rest import RestController
from restful import common, context
from restful.decorators import auth
class ConfigOsd(RestController):
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show OSD configuration options
"""
f... | 1,999 | 21.988506 | 84 | py |
null | ceph-main/src/pybind/mgr/restful/api/crush.py | from pecan import expose
from pecan.rest import RestController
from restful import common, context
from restful.decorators import auth
class CrushRule(RestController):
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show crush rules
"""
crush = context.instanc... | 561 | 20.615385 | 83 | py |
null | ceph-main/src/pybind/mgr/restful/api/doc.py | from pecan import expose
from pecan.rest import RestController
from restful import context
import restful
class Doc(RestController):
@expose(template='json')
def get(self, **kwargs):
"""
Show documentation information
"""
return context.instance.get_doc_api(restful.api.Root)
| 320 | 19.0625 | 61 | py |
null | ceph-main/src/pybind/mgr/restful/api/mon.py | from pecan import expose, response
from pecan.rest import RestController
from restful import context
from restful.decorators import auth
class MonName(RestController):
def __init__(self, name):
self.name = name
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show... | 953 | 22.268293 | 92 | py |
null | ceph-main/src/pybind/mgr/restful/api/osd.py | from pecan import expose, request, response
from pecan.rest import RestController
from restful import common, context
from restful.decorators import auth
class OsdIdCommand(RestController):
def __init__(self, osd_id):
self.osd_id = osd_id
@expose(template='json')
@auth
def get(self, **kwarg... | 3,542 | 25.051471 | 88 | py |
null | ceph-main/src/pybind/mgr/restful/api/perf.py | from pecan import expose, request, response
from pecan.rest import RestController
from restful import context
from restful.decorators import auth, lock, paginate
import re
class Perf(RestController):
@expose(template='json')
@paginate
@auth
def get(self, **kwargs):
"""
List all the av... | 688 | 23.607143 | 74 | py |
null | ceph-main/src/pybind/mgr/restful/api/pool.py | from pecan import expose, request, response
from pecan.rest import RestController
from restful import common, context
from restful.decorators import auth
class PoolId(RestController):
def __init__(self, pool_id):
self.pool_id = pool_id
@expose(template='json')
@auth
def get(self, **kwargs):... | 4,111 | 28.163121 | 110 | py |
null | ceph-main/src/pybind/mgr/restful/api/request.py | from pecan import expose, request, response
from pecan.rest import RestController
from restful import context
from restful.decorators import auth, lock, paginate
class RequestId(RestController):
def __init__(self, request_id):
self.request_id = request_id
@expose(template='json')
@auth
def ... | 2,604 | 26.712766 | 81 | py |
null | ceph-main/src/pybind/mgr/restful/api/server.py | from pecan import expose
from pecan.rest import RestController
from restful import context
from restful.decorators import auth
class ServerFqdn(RestController):
def __init__(self, fqdn):
self.fqdn = fqdn
@expose(template='json')
@auth
def get(self, **kwargs):
"""
Show the in... | 737 | 19.5 | 53 | py |
null | ceph-main/src/pybind/mgr/rgw/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/rgw/module.py | import json
import threading
import yaml
import errno
import base64
import functools
import sys
from mgr_module import MgrModule, CLICommand, HandleCommandResult, Option
import orchestrator
from ceph.deployment.service_spec import RGWSpec, PlacementSpec, SpecValidationError
from typing import Any, Optional, Sequence,... | 17,647 | 45.564644 | 153 | py |
null | ceph-main/src/pybind/mgr/rook/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
from .module import RookOrchestrator
| 94 | 14.833333 | 36 | py |
null | ceph-main/src/pybind/mgr/rook/generate_rook_ceph_client.sh | #!/bin/sh
set -e
script_location="$(dirname "$(readlink -f "$0")")"
cd "$script_location"
rm -rf rook_client
cp -r ./rook-client-python/rook_client .
rm -rf rook_client/cassandra
rm -rf rook_client/edgefs
rm -rf rook_client/tests
| 235 | 14.733333 | 50 | sh |
null | ceph-main/src/pybind/mgr/rook/module.py | import datetime
import logging
import re
import threading
import functools
import os
import json
from ceph.deployment import inventory
from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, PlacementSpec
from ceph.utils import datetime_now
from typing import List, Dict, Optional, Callable, Any... | 29,141 | 39.587744 | 147 | py |
null | ceph-main/src/pybind/mgr/rook/rook_cluster.py | """
This module wrap's Rook + Kubernetes APIs to expose the calls
needed to implement an orchestrator module. While the orchestrator
module exposes an async API, this module simply exposes blocking API
call methods.
This module is runnable outside of ceph-mgr, useful for testing.
"""
import datetime
import threading
... | 69,901 | 43.637292 | 272 | py |
null | ceph-main/src/pybind/mgr/rook/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/rook/tests/test_placement.py | # flake8: noqa
from rook.rook_cluster import placement_spec_to_node_selector, node_selector_to_placement_spec
from rook.rook_client.ceph.cephcluster import MatchExpressionsItem, MatchExpressionsList, NodeSelectorTermsItem
import pytest
from orchestrator import HostSpec
from ceph.deployment.service_spec import Placemen... | 3,800 | 36.633663 | 346 | py |
null | ceph-main/src/pybind/mgr/selftest/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/selftest/module.py |
from mgr_module import MgrModule, CommandResult, HandleCommandResult, CLICommand, Option
import enum
import json
import random
import sys
import threading
from code import InteractiveInterpreter
from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from typing import Any, Dict, List, Optional... | 17,529 | 33.440079 | 113 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/__init__.py | # -*- coding: utf-8 -*-
from os import environ
if 'SNAP_SCHED_UNITTEST' in environ:
import tests
elif 'UNITTEST' in environ:
import tests
from .module import Module
else:
from .module import Module
| 216 | 17.083333 | 36 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/module.py | """
Copyright (C) 2019 SUSE
LGPL2.1. See file COPYING.
"""
import errno
import json
import sqlite3
from typing import Any, Dict, Optional, Tuple
from .fs.schedule_client import SnapSchedClient
from mgr_module import MgrModule, CLIReadCommand, CLIWriteCommand, Option
from mgr_util import CephfsConnectionException
from... | 10,809 | 39.792453 | 89 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/fs/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/snap_schedule/fs/schedule.py | """
Copyright (C) 2020 SUSE
LGPL2.1. See file COPYING.
"""
from datetime import datetime, timezone
import json
import logging
import re
import sqlite3
from typing import cast, Any, Dict, List, Tuple, Optional, Union
log = logging.getLogger(__name__)
# Work around missing datetime.fromisoformat for < python3.7
SNAP_... | 18,445 | 35.671968 | 86 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/fs/schedule_client.py | """
Copyright (C) 2020 SUSE
LGPL2.1. See file COPYING.
"""
import cephfs
import rados
from contextlib import contextmanager
from mgr_util import CephfsClient, open_filesystem
from collections import OrderedDict
from datetime import datetime, timezone
import logging
from threading import Timer, Lock
from typing import... | 19,243 | 42.244944 | 106 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/snap_schedule/tests/conftest.py | import pytest
import sqlite3
from ..fs.schedule import Schedule
# simple_schedule fixture returns schedules without any timing arguments
# the tuple values correspong to ctor args for Schedule
_simple_schedules = [
('/foo', '6h', 'fs_name', '/foo'),
('/foo', '24h', 'fs_name', '/foo'),
('/bar', '1d', 'fs_n... | 859 | 23.571429 | 72 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/tests/fs/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/snap_schedule/tests/fs/test_schedule.py | import datetime
import json
import pytest
import random
import sqlite3
from ...fs.schedule import Schedule, parse_retention
SELECT_ALL = ('select * from schedules s'
' INNER JOIN schedules_meta sm'
' ON sm.schedule_id = s.id')
def assert_updated(new, old, update_expected={}):
'''
... | 9,126 | 34.513619 | 94 | py |
null | ceph-main/src/pybind/mgr/snap_schedule/tests/fs/test_schedule_client.py | from datetime import datetime, timedelta
from unittest.mock import MagicMock
import pytest
from ...fs.schedule_client import get_prune_set, SNAPSHOT_TS_FORMAT
class TestScheduleClient(object):
def test_get_prune_set_empty_retention_no_prune(self):
now = datetime.now()
candidates = set()
f... | 1,459 | 37.421053 | 82 | py |
null | ceph-main/src/pybind/mgr/stats/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/stats/module.py | """
performance stats for ceph filesystem (for now...)
"""
import json
from typing import List, Dict
from mgr_module import MgrModule, Option, NotifyType
from .fs.perf_stats import FSPerfStats
class Module(MgrModule):
COMMANDS = [
{
"cmd": "fs perf stats "
"name=mds_rank,t... | 1,353 | 31.238095 | 63 | py |
null | ceph-main/src/pybind/mgr/stats/fs/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/stats/fs/perf_stats.py | import re
import json
import time
import uuid
import errno
import traceback
import logging
from collections import OrderedDict
from typing import List, Dict, Set
from mgr_module import CommandResult
from datetime import datetime, timedelta
from threading import Lock, Condition, Thread, Timer
from ipaddress import ip_... | 25,764 | 44.360915 | 131 | py |
null | ceph-main/src/pybind/mgr/status/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/status/module.py |
"""
High level status display commands
"""
from collections import defaultdict
from prettytable import PrettyTable
from typing import Any, Dict, List, Optional, Tuple, Union
import errno
import fnmatch
import mgr_util
import json
from mgr_module import CLIReadCommand, MgrModule, HandleCommandResult
class Module(Mg... | 16,519 | 43.053333 | 109 | py |
null | ceph-main/src/pybind/mgr/telegraf/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/telegraf/basesocket.py | import socket
from urllib.parse import ParseResult
from typing import Any, Dict, Optional, Tuple, Union
class BaseSocket(object):
schemes = {
'unixgram': (socket.AF_UNIX, socket.SOCK_DGRAM),
'unix': (socket.AF_UNIX, socket.SOCK_STREAM),
'tcp': (socket.AF_INET, socket.SOCK_STREAM),
... | 1,576 | 30.54 | 78 | py |
null | ceph-main/src/pybind/mgr/telegraf/module.py | import errno
import json
import itertools
import socket
import time
from threading import Event
from telegraf.basesocket import BaseSocket
from telegraf.protocol import Line
from mgr_module import CLICommand, CLIReadCommand, MgrModule, Option, OptionValue, PG_STATES
from typing import cast, Any, Dict, Iterable, Optio... | 9,814 | 33.559859 | 92 | py |
null | ceph-main/src/pybind/mgr/telegraf/protocol.py | from typing import Dict, Optional, Union
from telegraf.utils import format_string, format_value, ValueType
class Line(object):
def __init__(self,
measurement: ValueType,
values: Union[Dict[str, ValueType], ValueType],
tags: Optional[Dict[str, str]] = None,
... | 1,674 | 31.843137 | 102 | py |
null | ceph-main/src/pybind/mgr/telegraf/utils.py | from typing import Union
ValueType = Union[str, bool, int, float]
def format_string(key: ValueType) -> str:
if isinstance(key, str):
return key.replace(',', r'\,') \
.replace(' ', r'\ ') \
.replace('=', r'\=')
else:
return str(key)
def format_value(value:... | 658 | 23.407407 | 42 | py |
null | ceph-main/src/pybind/mgr/telemetry/__init__.py | import os
if 'UNITTEST' in os.environ:
import tests
try:
from .module import Module
except ImportError:
pass
| 123 | 11.4 | 30 | py |
null | ceph-main/src/pybind/mgr/telemetry/module.py | """
Telemetry module for ceph-mgr
Collect statistics from Ceph cluster and send this back to the Ceph project
when user has opted-in
"""
import logging
import numbers
import enum
import errno
import hashlib
import json
import rbd
import requests
import uuid
import time
from datetime import datetime, timedelta
from pre... | 87,530 | 41.183614 | 159 | py |
null | ceph-main/src/pybind/mgr/telemetry/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/telemetry/tests/test_telemetry.py | import json
import pytest
import unittest
from unittest import mock
import telemetry
from typing import cast, Any, DefaultDict, Dict, List, Optional, Tuple, TypeVar, TYPE_CHECKING, Union
OptionValue = Optional[Union[bool, int, float, str]]
Collection = telemetry.module.Collection
ALL_CHANNELS = telemetry.module.ALL_... | 4,223 | 33.622951 | 128 | py |
null | ceph-main/src/pybind/mgr/test_orchestrator/README.md | # Activate module
You can activate the Ceph Manager module by running:
```
$ ceph mgr module enable test_orchestrator
$ ceph orch set backend test_orchestrator
```
# Check status
```
ceph orch status
```
# Import dummy data
```
$ ceph test_orchestrator load_data -i ./dummy_data.json
```
| 290 | 16.117647 | 55 | md |
null | ceph-main/src/pybind/mgr/test_orchestrator/__init__.py | from .module import TestOrchestrator
| 37 | 18 | 36 | py |
null | ceph-main/src/pybind/mgr/test_orchestrator/module.py | import errno
import json
import re
import os
import threading
import functools
import itertools
from subprocess import check_output, CalledProcessError
from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, IscsiServiceSpec
try:
from typing import Callable, List, Sequence, Tuple
except ImportError:... | 11,160 | 35.355049 | 106 | py |
null | ceph-main/src/pybind/mgr/tests/__init__.py | # type: ignore
import json
import logging
import os
if 'UNITTEST' in os.environ:
# Mock ceph_module. Otherwise every module that is involved in a testcase and imports it will
# raise an ImportError
import sys
try:
from unittest import mock
except ImportError:
import mock
M_... | 7,991 | 34.207048 | 97 | py |
null | ceph-main/src/pybind/mgr/tests/test_mgr_util.py | import datetime
import mgr_util
import pytest
@pytest.mark.parametrize(
"delta, out",
[
(datetime.timedelta(minutes=90), '90m'),
(datetime.timedelta(minutes=190), '3h'),
(datetime.timedelta(days=3), '3d'),
(datetime.timedelta(hours=3), '3h'),
(datetime.timedelta(days=3... | 513 | 24.7 | 63 | py |
null | ceph-main/src/pybind/mgr/tests/test_object_format.py | import errno
from typing import (
Any,
Dict,
Optional,
Tuple,
Type,
TypeVar,
)
import pytest
from mgr_module import CLICommand
import object_format
T = TypeVar("T", bound="Parent")
class Simpler:
def __init__(self, name, val=None):
self.name = name
self.val = val or {}
... | 15,575 | 25.716981 | 85 | py |
null | ceph-main/src/pybind/mgr/tests/test_tls.py | from mgr_util import create_self_signed_cert, verify_tls, ServerConfigException, get_cert_issuer_info
from OpenSSL import crypto, SSL
import unittest
valid_ceph_cert = """-----BEGIN CERTIFICATE-----\nMIICxjCCAa4CEQCpHIQuSYhCII1J0SVGYnT1MA0GCSqGSIb3DQEBDQUAMCExDTAL\nBgNVBAoMBENlcGgxEDAOBgNVBAMMB2NlcGhhZG0wHhcNMjIwNzA... | 3,786 | 66.625 | 1,059 | py |
null | ceph-main/src/pybind/mgr/volumes/__init__.py |
from .module import Module
| 28 | 8.666667 | 26 | py |
null | ceph-main/src/pybind/mgr/volumes/module.py | import errno
import logging
import traceback
import threading
from mgr_module import MgrModule, Option
import orchestrator
from .fs.volume import VolumeClient
log = logging.getLogger(__name__)
goodchars = '[A-Za-z0-9-_.]'
class VolumesInfoWrapper():
def __init__(self, f, context):
self.f = f
s... | 38,389 | 44.271226 | 125 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/volumes/fs/async_cloner.py | import os
import stat
import time
import errno
import logging
from contextlib import contextmanager
from typing import Optional
import cephfs
from mgr_util import lock_timeout_log
from .async_job import AsyncJobs
from .exception import IndexException, MetadataMgrException, OpSmException, VolumeException
from .fs_util... | 23,263 | 55.193237 | 163 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/async_job.py | import sys
import time
import logging
import threading
import traceback
from collections import deque
from mgr_util import lock_timeout_log, CephfsClient
from .exception import NotImplementedException
log = logging.getLogger(__name__)
class JobThread(threading.Thread):
# this is "not" configurable and there is ... | 12,384 | 39.740132 | 127 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/exception.py | class VolumeException(Exception):
def __init__(self, error_code, error_message):
self.errno = error_code
self.error_str = error_message
def to_tuple(self):
return self.errno, "", self.error_str
def __str__(self):
return "{0} ({1})".format(self.errno, self.error_str)
class ... | 1,921 | 29.03125 | 80 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/fs_util.py | import os
import errno
import logging
from ceph.deployment.service_spec import ServiceSpec, PlacementSpec
import cephfs
import orchestrator
from .exception import VolumeException
log = logging.getLogger(__name__)
def create_pool(mgr, pool_name):
# create the given pool
command = {'prefix': 'osd pool create... | 7,101 | 32.5 | 93 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/purge_queue.py | import errno
import logging
import os
import stat
import cephfs
from .async_job import AsyncJobs
from .exception import VolumeException
from .operations.resolver import resolve_trash
from .operations.template import SubvolumeOpType
from .operations.group import open_group
from .operations.subvolume import open_subvol... | 5,253 | 45.087719 | 124 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/vol_spec.py | from .operations.index import Index
from .operations.group import Group
from .operations.trash import Trash
from .operations.versions.subvolume_base import SubvolumeBase
class VolSpec(object):
"""
specification of a "volume" -- base directory and various prefixes.
"""
# where shall we (by default) cr... | 1,511 | 31.869565 | 108 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/volume.py | import json
import errno
import logging
import os
import mgr_util
from typing import TYPE_CHECKING
import cephfs
from mgr_util import CephfsClient
from .fs_util import listdir, has_subdir
from .operations.group import open_group, create_group, remove_group, \
open_group_unique, set_group_attrs
from .operations.... | 45,005 | 43.871386 | 142 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/access.py | import errno
import json
from typing import List
def prepare_updated_caps_list(existing_caps, mds_cap_str, osd_cap_str, authorize=True):
caps_list = [] # type: List[str]
for k, v in existing_caps['caps'].items():
if k == 'mds' or k == 'osd':
continue
elif k == 'mon':
i... | 4,551 | 31.056338 | 89 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/clone_index.py | import os
import uuid
import stat
import logging
from contextlib import contextmanager
import cephfs
from .index import Index
from ..exception import IndexException, VolumeException
from ..fs_util import list_one_entry_at_a_time
log = logging.getLogger(__name__)
class CloneIndex(Index):
SUB_GROUP_NAME = "clone... | 3,541 | 34.069307 | 110 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/group.py | import os
import errno
import logging
from contextlib import contextmanager
import cephfs
from .snapshot_util import mksnap, rmsnap
from .pin_util import pin
from .template import GroupTemplate
from ..fs_util import listdir, listsnaps, get_ancestor_xattr, create_base_dir, has_subdir
from ..exception import VolumeExce... | 10,815 | 34.346405 | 136 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/index.py | import errno
import os
from ..exception import VolumeException
from .template import GroupTemplate
class Index(GroupTemplate):
GROUP_NAME = "_index"
def __init__(self, fs, vol_spec):
self.fs = fs
self.vol_spec = vol_spec
self.groupname = Index.GROUP_NAME
@property
def path(se... | 637 | 25.583333 | 99 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/lock.py | from contextlib import contextmanager
import logging
from threading import Lock
from typing import Dict
log = logging.getLogger(__name__)
# singleton design pattern taken from http://www.aleax.it/5ep.html
class GlobalLock(object):
"""
Global lock to serialize operations in mgr/volumes. This lock
is curre... | 1,524 | 33.659091 | 107 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/pin_util.py | import os
import errno
import cephfs
from ..exception import VolumeException
from distutils.util import strtobool
_pin_value = {
"export": lambda x: int(x),
"distributed": lambda x: int(strtobool(x)),
"random": lambda x: float(x),
}
_pin_xattr = {
"export": "ceph.dir.pin",
"distributed": "ceph.di... | 859 | 23.571429 | 84 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/rankevicter.py | import errno
import json
import logging
import threading
import time
from .volume import get_mds_map
from ..exception import ClusterTimeout, ClusterError
log = logging.getLogger(__name__)
class RankEvicter(threading.Thread):
"""
Thread for evicting client(s) from a particular MDS daemon instance.
This i... | 3,879 | 32.73913 | 99 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/resolver.py | import os
from .group import Group
def splitall(path):
if path == "/":
return ["/"]
s = os.path.split(path)
return splitall(s[0]) + [s[1]]
def resolve(vol_spec, path):
parts = splitall(path)
if len(parts) != 4 or os.path.join(parts[0], parts[1]) != vol_spec.subvolume_prefix:
ret... | 797 | 25.6 | 92 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/snapshot_util.py | import os
import errno
import cephfs
from ..exception import VolumeException
def mksnap(fs, snappath):
"""
Create a snapshot, or do nothing if it already exists.
"""
try:
# snap create does not accept mode -- use default
fs.mkdir(snappath, 0o755)
except cephfs.ObjectExists:
... | 779 | 22.636364 | 112 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/subvolume.py | from contextlib import contextmanager
from .template import SubvolumeOpType
from .versions import loaded_subvolumes
def create_subvol(mgr, fs, vol_spec, group, subvolname, size, isolate_nspace, pool, mode, uid, gid):
"""
create a subvolume (create a subvolume with the max known version).
:param fs: ceph... | 2,905 | 37.746667 | 104 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/template.py | import errno
from enum import Enum, unique
from ..exception import VolumeException
class GroupTemplate(object):
def list_subvolumes(self):
raise VolumeException(-errno.ENOTSUP, "operation not supported.")
def create_snapshot(self, snapname):
"""
create a subvolume group snapshot.
... | 6,234 | 31.473958 | 97 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/trash.py | import os
import uuid
import logging
from contextlib import contextmanager
import cephfs
from .template import GroupTemplate
from ..fs_util import listdir
from ..exception import VolumeException
log = logging.getLogger(__name__)
class Trash(GroupTemplate):
GROUP_NAME = "_deleting"
def __init__(self, fs, vo... | 4,512 | 29.910959 | 99 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/volume.py | import errno
import logging
import os
from typing import List, Tuple
from contextlib import contextmanager
import orchestrator
from .lock import GlobalLock
from ..exception import VolumeException
from ..fs_util import create_pool, remove_pool, rename_pool, create_filesystem, \
remove_filesystem, rename_filesyst... | 10,509 | 34.627119 | 102 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/__init__.py | import errno
import logging
import importlib
import cephfs
from .subvolume_base import SubvolumeBase
from .subvolume_attrs import SubvolumeTypes
from .subvolume_v1 import SubvolumeV1
from .subvolume_v2 import SubvolumeV2
from .metadata_manager import MetadataManager
from .op_sm import SubvolumeOpSm
from ..template im... | 4,982 | 43.097345 | 147 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/auth_metadata.py | from contextlib import contextmanager
import os
import fcntl
import json
import logging
import struct
import uuid
import cephfs
from ..group import Group
log = logging.getLogger(__name__)
class AuthMetadataError(Exception):
pass
class AuthMetadataManager(object):
# Current version
version = 6
#... | 7,199 | 33.123223 | 103 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py | import os
import errno
import logging
import sys
import threading
import configparser
import re
import cephfs
from ...exception import MetadataMgrException
log = logging.getLogger(__name__)
# _lock needs to be shared across all instances of MetadataManager.
# that is why we have a file level instance
_lock = thread... | 7,554 | 36.587065 | 113 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/op_sm.py | import errno
from typing import Dict
from ...exception import OpSmException
from .subvolume_attrs import SubvolumeTypes, SubvolumeStates, SubvolumeActions
class TransitionKey(object):
def __init__(self, subvol_type, state, action_type):
self.transition_key = [subvol_type, state, action_type]
def __h... | 4,959 | 42.130435 | 155 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/subvolume_attrs.py | import errno
from enum import Enum, unique
from ...exception import VolumeException
@unique
class SubvolumeTypes(Enum):
TYPE_NORMAL = "subvolume"
TYPE_CLONE = "clone"
@staticmethod
def from_value(value):
if value == "subvolume":
return SubvolumeTypes.TYPE_NORMAL
if value ... | 1,788 | 26.106061 | 90 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/subvolume_base.py | import os
import stat
import errno
import logging
import hashlib
from typing import Dict, Union
from pathlib import Path
import cephfs
from ..pin_util import pin
from .subvolume_attrs import SubvolumeTypes
from .metadata_manager import MetadataManager
from ..trash import create_trashcan, open_trashcan
from ...fs_uti... | 20,763 | 39.084942 | 129 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/subvolume_v1.py | import os
import sys
import stat
import uuid
import errno
import logging
import json
from datetime import datetime
from typing import Any, List, Dict
from pathlib import Path
import cephfs
from .metadata_manager import MetadataManager
from .subvolume_attrs import SubvolumeTypes, SubvolumeStates, SubvolumeFeatures
fro... | 41,080 | 44.39337 | 144 | py |
null | ceph-main/src/pybind/mgr/volumes/fs/operations/versions/subvolume_v2.py | import os
import stat
import uuid
import errno
import logging
import cephfs
from .metadata_manager import MetadataManager
from .subvolume_attrs import SubvolumeTypes, SubvolumeStates, SubvolumeFeatures
from .op_sm import SubvolumeOpSm
from .subvolume_v1 import SubvolumeV1
from ..template import SubvolumeTemplate
from... | 18,707 | 46.362025 | 149 | py |
null | ceph-main/src/pybind/mgr/zabbix/__init__.py | from .module import Module
| 27 | 13 | 26 | py |
null | ceph-main/src/pybind/mgr/zabbix/module.py | """
Zabbix module for ceph-mgr
Collect statistics from Ceph cluster and every X seconds send data to a Zabbix
server using the zabbix_sender executable.
"""
import logging
import json
import errno
import re
from subprocess import Popen, PIPE
from threading import Event
from mgr_module import CLIReadCommand, CLIWriteCo... | 17,629 | 35.960168 | 108 | py |
null | ceph-main/src/pybind/rados/setup.py | import pkgutil
if not pkgutil.find_loader('setuptools'):
from distutils.core import setup
from distutils.extension import Extension
else:
from setuptools import setup
from setuptools.extension import Extension
import distutils.sysconfig
from distutils.errors import CompileError, LinkError
from distutils... | 6,854 | 32.115942 | 98 | py |
null | ceph-main/src/pybind/rbd/setup.py | import os
import pkgutil
import shutil
import subprocess
import sys
import tempfile
import textwrap
if not pkgutil.find_loader('setuptools'):
from distutils.core import setup
from distutils.extension import Extension
else:
from setuptools import setup
from setuptools.extension import Extension
from dist... | 7,202 | 32.658879 | 96 | py |
null | ceph-main/src/pybind/rgw/setup.py | import pkgutil
if not pkgutil.find_loader('setuptools'):
from distutils.core import setup
from distutils.extension import Extension
else:
from setuptools import setup
from setuptools.extension import Extension
import distutils.core
import os
import shutil
import sys
import tempfile
import textwrap
from... | 7,007 | 31.747664 | 96 | py |
null | ceph-main/src/python-common/setup.py | from setuptools import setup, find_packages
with open("README.rst", "r") as fh:
long_description = fh.read()
setup(
name='ceph',
version='1.0.0',
packages=find_packages(),
author='',
author_email='dev@ceph.io',
description='Ceph common library',
long_description=long_description,
... | 872 | 25.454545 | 93 | py |