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/osdc/error_code.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2019 Red Hat <contact@redhat.com>
* Author: Adam C. Emerson <aemerson@redhat.com>
*
* This is free software; you can redistribute it and/or
* modify it ... | 4,476 | 25.808383 | 83 | cc |
null | ceph-main/src/osdc/error_code.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2019 Red Hat <contact@redhat.com>
* Author: Adam C. Emerson <aemerson@redhat.com>
*
* This is free software; you can redistribute it and/or
* modify it ... | 1,363 | 22.929825 | 82 | h |
null | ceph-main/src/perfglue/cpu_profiler.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License ... | 1,143 | 26.238095 | 70 | cc |
null | ceph-main/src/perfglue/cpu_profiler.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License ... | 642 | 23.730769 | 70 | h |
null | ceph-main/src/perfglue/disabled_heap_profiler.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network/Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Le... | 1,322 | 26.5625 | 75 | cc |
null | ceph-main/src/perfglue/disabled_stubs.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License ... | 657 | 24.307692 | 70 | cc |
null | ceph-main/src/perfglue/heap_profiler.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network/Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Le... | 5,121 | 26.100529 | 75 | cc |
null | ceph-main/src/perfglue/heap_profiler.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network/Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Les... | 1,468 | 24.327586 | 75 | h |
null | ceph-main/src/powerdns/README.md | # PowerDNS RADOS Gateway backend
A backend for PowerDNS to direct RADOS Gateway bucket traffic to the correct regions.
For example, two regions exist, US and EU.
EU: o.myobjects.eu
US: o.myobjects.us
A global domain o.myobjects.com exists.
Bucket 'foo' exists in the region EU and 'bar' in US.
foo.o.my... | 1,671 | 25.967742 | 117 | md |
null | ceph-main/src/powerdns/pdns-backend-rgw.py | #!/usr/bin/python
'''
A backend for PowerDNS to direct RADOS Gateway bucket traffic to the correct regions.
For example, two regions exist, US and EU.
EU: o.myobjects.eu
US: o.myobjects.us
A global domain o.myobjects.com exists.
Bucket 'foo' exists in the region EU and 'bar' in US.
foo.o.myobjects.com will return ... | 8,790 | 29.845614 | 113 | py |
null | ceph-main/src/pybind/ceph_argparse.py | """
Types and routines used by the ceph CLI as well as the RESTful
interface. These have to do with querying the daemons for
command-description information, validating user command input against
those descriptions, and submitting the command to the appropriate
daemon.
Copyright (C) 2013 Inktank Storage, Inc.
LGPL-2... | 58,341 | 32.900058 | 169 | py |
null | ceph-main/src/pybind/ceph_daemon.py | # -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
"""
Copyright (C) 2015 Red Hat
This is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License version 2, as published by the Free Software
Foundation. See file COPYING.
"""
import sys
import json
import sock... | 15,462 | 34.793981 | 97 | py |
null | ceph-main/src/pybind/ceph_mgr_repl.py | #!/usr/bin/python3
# -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
__all__ = ['ConsoleOptions', 'MgrModuleInterpreter']
import readline
import sys
from code import InteractiveConsole
from collections import namedtuple
from pathlib import Path
from ceph_argparse import json_command
ConsoleOptions = namedt... | 4,538 | 33.12782 | 78 | py |
null | ceph-main/src/pybind/cephfs/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,227 | 32.462963 | 99 | py |
null | ceph-main/src/pybind/mgr/mgr_module.py | import ceph_module # noqa
from typing import cast, Tuple, Any, Dict, Generic, Optional, Callable, List, \
Mapping, NamedTuple, Sequence, Union, Set, TYPE_CHECKING
if TYPE_CHECKING:
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import ... | 84,022 | 34.274139 | 130 | py |
null | ceph-main/src/pybind/mgr/mgr_util.py | import os
if 'UNITTEST' in os.environ:
import tests
import bcrypt
import cephfs
import contextlib
import datetime
import errno
import socket
import time
import logging
import sys
from threading import Lock, Condition, Event
from typing import no_type_check, NewType
import urllib
from functools import wraps
if sys... | 31,250 | 34.633979 | 127 | py |
null | ceph-main/src/pybind/mgr/object_format.py | # object_format.py provides types and functions for working with
# requested output formats such as JSON, YAML, etc.
"""tools for writing formatting-friendly mgr module functions
Currently, the ceph mgr code in python is most commonly written by adding mgr
modules and corresponding classes and then adding methods to t... | 23,307 | 37.022838 | 90 | py |
null | ceph-main/src/pybind/mgr/alerts/__init__.py | # flake8: noqa
from .module import Alerts
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/alerts/module.py |
"""
A simple cluster health alerting module.
"""
from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option
from email.utils import formatdate, make_msgid
from threading import Event
from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union
import json
import smtplib
class Alerts(MgrModu... | 9,169 | 34.405405 | 85 | py |
null | ceph-main/src/pybind/mgr/balancer/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/balancer/module.py | """
Balance PG distribution across OSDs.
"""
import copy
import enum
import errno
import json
import math
import random
import time
from mgr_module import CLIReadCommand, CLICommand, CommandResult, MgrModule, Option, OSDMap
from threading import Event
from typing import cast, Any, Dict, List, Optional, Sequence, Tuple... | 59,565 | 41.24539 | 150 | py |
null | ceph-main/src/pybind/mgr/cephadm/__init__.py | from .module import CephadmOrchestrator
__all__ = [
"CephadmOrchestrator",
]
import os
if 'UNITTEST' in os.environ:
import tests
__all__.append(tests.__name__)
| 174 | 14.909091 | 39 | py |
null | ceph-main/src/pybind/mgr/cephadm/agent.py | try:
import cherrypy
from cherrypy._cpserver import Server
except ImportError:
# to avoid sphinx build crash
class Server: # type: ignore
pass
import json
import logging
import socket
import ssl
import tempfile
import threading
import time
from orchestrator import DaemonDescriptionStatus
from... | 22,515 | 46.70339 | 158 | py |
null | ceph-main/src/pybind/mgr/cephadm/autotune.py | import logging
from typing import List, Optional, Callable, Any, Tuple
from orchestrator._interface import DaemonDescription
logger = logging.getLogger(__name__)
class MemoryAutotuner(object):
min_size_by_type = {
'mds': 4096 * 1048576,
'mgr': 4096 * 1048576,
'mon': 1024 * 1048576,
... | 1,688 | 29.709091 | 80 | py |
null | ceph-main/src/pybind/mgr/cephadm/configchecks.py | import json
import ipaddress
import logging
from mgr_module import ServiceInfoT
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast, Tuple, Callable
if TYPE_CHECKING:
from cephadm.module import CephadmOrchestrator
logger = logging.getLogger(__name__)
class HostFacts:
def __init__(self) -> N... | 30,108 | 41.647309 | 144 | py |
null | ceph-main/src/pybind/mgr/cephadm/exchange.py | # Data exchange formats for communicating more
# complex data structures between the cephadm binary
# an the mgr module.
import json
from typing import (
Any,
Callable,
Dict,
List,
Optional,
TypeVar,
Union,
cast,
)
FuncT = TypeVar("FuncT", bound=Callable)
class _DataField:
"""A... | 4,757 | 27.836364 | 81 | py |
null | ceph-main/src/pybind/mgr/cephadm/http_server.py | import cherrypy
import threading
import logging
from typing import TYPE_CHECKING
from cephadm.agent import AgentEndpoint
from cephadm.service_discovery import ServiceDiscovery
from mgr_util import test_port_allocation, PortAlreadyInUse
from orchestrator import OrchestratorError
if TYPE_CHECKING:
from cephadm.modu... | 3,761 | 35.882353 | 143 | py |
null | ceph-main/src/pybind/mgr/cephadm/inventory.py | import datetime
import enum
from copy import copy
import ipaddress
import itertools
import json
import logging
import math
import socket
from typing import TYPE_CHECKING, Dict, List, Iterator, Optional, Any, Tuple, Set, Mapping, cast, \
NamedTuple, Type
import orchestrator
from ceph.deployment import inventory
fro... | 64,211 | 40.831922 | 137 | py |
null | ceph-main/src/pybind/mgr/cephadm/migrations.py | import json
import re
import logging
from typing import TYPE_CHECKING, Iterator, Optional, Dict, Any, List
from ceph.deployment.service_spec import PlacementSpec, ServiceSpec, HostPlacementSpec, RGWSpec
from cephadm.schedule import HostAssignment
import rados
from mgr_module import NFS_POOL_NAME
from orchestrator imp... | 17,995 | 39.807256 | 124 | py |
null | ceph-main/src/pybind/mgr/cephadm/module.py | import asyncio
import json
import errno
import ipaddress
import logging
import re
import shlex
from collections import defaultdict
from configparser import ConfigParser
from contextlib import contextmanager
from functools import wraps
from tempfile import TemporaryDirectory, NamedTemporaryFile
from threading import Eve... | 144,483 | 42.16821 | 183 | py |
null | ceph-main/src/pybind/mgr/cephadm/offline_watcher.py | import logging
from typing import List, Optional, TYPE_CHECKING
import multiprocessing as mp
import threading
if TYPE_CHECKING:
from cephadm.module import CephadmOrchestrator
logger = logging.getLogger(__name__)
class OfflineHostWatcher(threading.Thread):
def __init__(self, mgr: "CephadmOrchestrator") -> N... | 2,182 | 34.786885 | 109 | py |
null | ceph-main/src/pybind/mgr/cephadm/registry.py | import requests
from typing import List, Dict, Tuple
from requests import Response
class Registry:
def __init__(self, url: str):
self._url: str = url
@property
def api_domain(self) -> str:
if self._url == 'docker.io':
return 'registry-1.docker.io'
return self._url
... | 2,256 | 33.19697 | 138 | py |
null | ceph-main/src/pybind/mgr/cephadm/schedule.py | import ipaddress
import hashlib
import logging
import random
from typing import List, Optional, Callable, TypeVar, Tuple, NamedTuple, Dict
import orchestrator
from ceph.deployment.service_spec import ServiceSpec
from orchestrator._interface import DaemonDescription
from orchestrator import OrchestratorValidationError
... | 19,833 | 40.149378 | 139 | py |
null | ceph-main/src/pybind/mgr/cephadm/serve.py | import ipaddress
import hashlib
import json
import logging
import uuid
import os
from collections import defaultdict
from typing import TYPE_CHECKING, Optional, List, cast, Dict, Any, Union, Tuple, Set, \
DefaultDict
from ceph.deployment import inventory
from ceph.deployment.drive_group import DriveGroupSpec
from ... | 75,754 | 45.39008 | 166 | py |
null | ceph-main/src/pybind/mgr/cephadm/service_discovery.py | try:
import cherrypy
from cherrypy._cpserver import Server
except ImportError:
# to avoid sphinx build crash
class Server: # type: ignore
pass
import logging
import socket
import orchestrator # noqa
from mgr_module import ServiceInfoT
from mgr_util import build_url
from typing import Dict, L... | 10,202 | 41.5125 | 99 | py |
null | ceph-main/src/pybind/mgr/cephadm/ssh.py | import logging
import os
import asyncio
from tempfile import NamedTemporaryFile
from threading import Thread
from contextlib import contextmanager
from io import StringIO
from shlex import quote
from typing import TYPE_CHECKING, Optional, List, Tuple, Dict, Iterator, TypeVar, Awaitable, Union
from orchestrator import O... | 15,239 | 41.333333 | 158 | py |
null | ceph-main/src/pybind/mgr/cephadm/ssl_cert_utils.py |
from typing import Any, Tuple, IO
import ipaddress
import tempfile
import logging
from datetime import datetime, timedelta
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes, serialization
... | 6,362 | 39.528662 | 100 | py |
null | ceph-main/src/pybind/mgr/cephadm/template.py | import copy
from typing import Optional, TYPE_CHECKING
from jinja2 import Environment, PackageLoader, select_autoescape, StrictUndefined
from jinja2 import exceptions as j2_exceptions
if TYPE_CHECKING:
from cephadm.module import CephadmOrchestrator
class TemplateError(Exception):
pass
class UndefinedError... | 3,731 | 32.927273 | 94 | py |
null | ceph-main/src/pybind/mgr/cephadm/tuned_profiles.py | import logging
from typing import Dict, List, TYPE_CHECKING
from ceph.utils import datetime_now
from .schedule import HostAssignment
from ceph.deployment.service_spec import ServiceSpec, TunedProfileSpec
if TYPE_CHECKING:
from cephadm.module import CephadmOrchestrator
logger = logging.getLogger(__name__)
SYSCTL_... | 4,875 | 45.884615 | 122 | py |
null | ceph-main/src/pybind/mgr/cephadm/upgrade.py | import json
import logging
import time
import uuid
from typing import TYPE_CHECKING, Optional, Dict, List, Tuple, Any, cast
import orchestrator
from cephadm.registry import Registry
from cephadm.serve import CephadmServe
from cephadm.services.cephadmservice import CephadmDaemonDeploySpec
from cephadm.utils import ceph... | 61,030 | 46.237616 | 244 | py |
null | ceph-main/src/pybind/mgr/cephadm/utils.py | import logging
import json
import socket
from enum import Enum
from functools import wraps
from typing import Optional, Callable, TypeVar, List, NewType, TYPE_CHECKING, Any, NamedTuple
from orchestrator import OrchestratorError
if TYPE_CHECKING:
from cephadm import CephadmOrchestrator
T = TypeVar('T')
logger = lo... | 4,208 | 29.280576 | 93 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/cephadm/services/cephadmservice.py | import errno
import json
import logging
import re
import socket
import time
from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING, List, Callable, TypeVar, \
Optional, Dict, Any, Tuple, NewType, cast
from mgr_module import HandleCommandResult, MonCommandFailed
from ceph.deployment.service_spec ... | 51,165 | 39.672496 | 150 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/container.py | import logging
from typing import List, Any, Tuple, Dict, cast
from ceph.deployment.service_spec import CustomContainerSpec
from .cephadmservice import CephadmService, CephadmDaemonDeploySpec
logger = logging.getLogger(__name__)
class CustomContainerService(CephadmService):
TYPE = 'container'
def prepare_... | 1,106 | 35.9 | 92 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/ingress.py | import ipaddress
import logging
import random
import string
from typing import List, Dict, Any, Tuple, cast, Optional
from ceph.deployment.service_spec import ServiceSpec, IngressSpec
from mgr_util import build_url
from cephadm import utils
from orchestrator import OrchestratorError, DaemonDescription
from cephadm.ser... | 15,448 | 40.754054 | 116 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/iscsi.py | import errno
import json
import logging
import subprocess
from typing import List, cast, Optional
from ipaddress import ip_address, IPv6Address
from mgr_module import HandleCommandResult
from ceph.deployment.service_spec import IscsiServiceSpec
from orchestrator import DaemonDescription, DaemonDescriptionStatus
from ... | 9,381 | 43.046948 | 114 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/jaeger.py | from typing import List, cast
from cephadm.services.cephadmservice import CephadmService, CephadmDaemonDeploySpec
from ceph.deployment.service_spec import TracingSpec
from mgr_util import build_url
class ElasticSearchService(CephadmService):
TYPE = 'elasticsearch'
DEFAULT_SERVICE_PORT = 9200
def prepare_... | 3,052 | 40.256757 | 104 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/monitoring.py | import errno
import ipaddress
import logging
import os
import socket
from typing import List, Any, Tuple, Dict, Optional, cast
from urllib.parse import urlparse
from mgr_module import HandleCommandResult
from orchestrator import DaemonDescription
from ceph.deployment.service_spec import AlertManagerSpec, GrafanaSpec,... | 30,702 | 44.284661 | 127 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/nfs.py | import errno
import logging
import os
import subprocess
import tempfile
from typing import Dict, Tuple, Any, List, cast, Optional
from mgr_module import HandleCommandResult
from mgr_module import NFS_POOL_NAME as POOL_NAME
from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec
from orchestrator import ... | 12,841 | 39.898089 | 111 | py |
null | ceph-main/src/pybind/mgr/cephadm/services/osd.py | import json
import logging
from asyncio import gather
from threading import Lock
from typing import List, Dict, Any, Set, Tuple, cast, Optional, TYPE_CHECKING
from ceph.deployment import translate
from ceph.deployment.drive_group import DriveGroupSpec
from ceph.deployment.drive_selection import DriveSelection
from cep... | 39,465 | 39.602881 | 159 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/cephadm/tests/conftest.py | import pytest
from cephadm.services.osd import RemoveUtil, OSD
from tests import mock
from .fixtures import with_cephadm_module
@pytest.fixture()
def cephadm_module():
with with_cephadm_module({}) as m:
yield m
@pytest.fixture()
def rm_util():
with with_cephadm_module({}) as m:
r = RemoveU... | 526 | 17.821429 | 55 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/fixtures.py | import fnmatch
import asyncio
import sys
from tempfile import NamedTemporaryFile
from contextlib import contextmanager
from ceph.deployment.service_spec import PlacementSpec, ServiceSpec
from ceph.utils import datetime_to_str, datetime_now
from cephadm.serve import CephadmServe, cephadmNoImage
try:
from typing im... | 7,395 | 35.79602 | 145 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_autotune.py | # Disable autopep8 for this file:
# fmt: off
import pytest
from cephadm.autotune import MemoryAutotuner
from orchestrator import DaemonDescription
@pytest.mark.parametrize("total,daemons,config,result",
[ # noqa: E128
(
128 * 1024 * 1024 * 1024,
[],
{},
... | 1,862 | 25.614286 | 58 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_cephadm.py | import asyncio
import json
import logging
from contextlib import contextmanager
import pytest
from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection
from cephadm.serve import CephadmServe
from cephadm.inventory import HostCacheStatus
from cephadm.services.osd import OSD, OSDRemovalQueue, OsdIdClaims... | 123,456 | 48.146895 | 266 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_completion.py | import pytest
from ..module import forall_hosts
class TestCompletion(object):
@pytest.mark.parametrize("input,expected", [
([], []),
([1], ["(1,)"]),
(["hallo"], ["('hallo',)"]),
("hi", ["('h',)", "('i',)"]),
(list(range(5)), [str((x, )) for x in range(5)]),
([(1,... | 1,185 | 27.926829 | 67 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_configchecks.py | import copy
import json
import logging
import ipaddress
import pytest
import uuid
from time import time as now
from ..configchecks import CephadmConfigChecks
from ..inventory import HostCache
from ..upgrade import CephadmUpgrade, UpgradeState
from orchestrator import DaemonDescription
from typing import List, Dict, ... | 24,133 | 35.074738 | 116 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_facts.py | from ..import CephadmOrchestrator
from .fixtures import wait
from tests import mock
def test_facts(cephadm_module: CephadmOrchestrator):
facts = {'node-1.ceph.com': {'bios_version': 'F2', 'cpu_cores': 16}}
cephadm_module.cache.facts = facts
ret_facts = cephadm_module.get_facts('node-1.ceph.com')
ass... | 1,273 | 38.8125 | 87 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_migration.py | import json
import pytest
from ceph.deployment.service_spec import PlacementSpec, ServiceSpec, HostPlacementSpec
from ceph.utils import datetime_to_str, datetime_now
from cephadm import CephadmOrchestrator
from cephadm.inventory import SPEC_STORE_PREFIX
from cephadm.migrations import LAST_MIGRATION
from cephadm.tests.... | 13,871 | 39.680352 | 140 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_osd_removal.py | import json
from cephadm.services.osd import OSDRemovalQueue, OSD
import pytest
from tests import mock
from .fixtures import with_cephadm_module
from datetime import datetime
class MockOSD:
def __init__(self, osd_id):
self.osd_id = osd_id
class TestOSDRemoval:
@pytest.mark.parametrize(
"o... | 11,377 | 37.053512 | 113 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_scheduling.py | # Disable autopep8 for this file:
# fmt: off
from typing import NamedTuple, List, Dict, Optional
import pytest
from ceph.deployment.hostspec import HostSpec
from ceph.deployment.service_spec import ServiceSpec, PlacementSpec, IngressSpec
from ceph.deployment.hostspec import SpecValidationError
from cephadm.module i... | 64,084 | 36.697059 | 160 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_service_discovery.py | from unittest.mock import MagicMock
from cephadm.service_discovery import Root
class FakeDaemonDescription:
def __init__(self, ip, ports, hostname, service_name='', daemon_type=''):
self.ip = ip
self.ports = ports
self.hostname = hostname
self._service_name = service_name
s... | 5,265 | 28.418994 | 88 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_services.py | from textwrap import dedent
import json
import urllib.parse
import yaml
from mgr_util import build_url
import pytest
from unittest.mock import MagicMock, call, patch, ANY
from cephadm.serve import CephadmServe
from cephadm.services.cephadmservice import MonService, MgrService, MdsService, RgwService, \
RbdMirror... | 110,236 | 45.279177 | 1,752 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_spec.py | # Disable autopep8 for this file:
# fmt: off
import json
import pytest
from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, \
IscsiServiceSpec, HostPlacementSpec, CustomContainerSpec
from orchestrator import DaemonDescription, OrchestratorError
@pytest.mark.parametrize(
"spec_jso... | 15,705 | 25.575296 | 97 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_ssh.py | import asyncssh
from asyncssh.process import SSHCompletedProcess
from unittest import mock
try:
# AsyncMock was not added until python 3.8
from unittest.mock import AsyncMock
except ImportError:
from asyncmock import AsyncMock
except ImportError:
AsyncMock = None
import pytest
try:
from asyncssh.m... | 4,598 | 42.386792 | 121 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_template.py | import pathlib
import pytest
from cephadm.template import TemplateMgr, UndefinedError, TemplateNotFoundError
def test_render(cephadm_module, fs):
template_base = (pathlib.Path(__file__).parent / '../templates').resolve()
fake_template = template_base / 'foo/bar'
fs.create_file(fake_template, contents='{... | 1,056 | 30.088235 | 86 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py | import pytest
import json
from tests import mock
from cephadm.tuned_profiles import TunedProfileUtils, SYSCTL_DIR
from cephadm.inventory import TunedProfileStore
from ceph.utils import datetime_now
from ceph.deployment.service_spec import TunedProfileSpec, PlacementSpec
from cephadm.ssh import SSHManager
from orchestra... | 11,918 | 45.377432 | 113 | py |
null | ceph-main/src/pybind/mgr/cephadm/tests/test_upgrade.py | import json
from unittest import mock
import pytest
from ceph.deployment.service_spec import PlacementSpec, ServiceSpec
from cephadm import CephadmOrchestrator
from cephadm.upgrade import CephadmUpgrade, UpgradeState
from cephadm.ssh import HostConnectionError
from orchestrator import OrchestratorError, DaemonDescrip... | 20,771 | 44.452954 | 159 | py |
null | ceph-main/src/pybind/mgr/cli_api/__init__.py | from .module import CLI
__all__ = [
"CLI",
]
import os
if 'UNITTEST' in os.environ:
import tests # noqa # pylint: disable=unused-import
__all__.append(tests.__name__)
| 182 | 15.636364 | 56 | py |
null | ceph-main/src/pybind/mgr/cli_api/module.py | import concurrent.futures
import functools
import inspect
import logging
import time
import errno
from typing import Any, Callable, Dict, List
from mgr_module import MgrModule, HandleCommandResult, CLICommand, API
logger = logging.getLogger()
get_time = time.perf_counter
def pretty_json(obj: Any) -> Any:
import... | 3,987 | 31.958678 | 96 | py |
null | ceph-main/src/pybind/mgr/cli_api/tests/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/cli_api/tests/test_cli_api.py | import unittest
from ..module import CLI, BenchmarkException, HandleCommandResult
class BenchmarkRunnerTest(unittest.TestCase):
def setUp(self):
self.cli = CLI('CLI', 0, 0)
def test_number_of_calls_on_start_fails(self):
with self.assertRaises(BenchmarkException) as ctx:
self.cli.... | 1,718 | 40.926829 | 81 | py |
null | ceph-main/src/pybind/mgr/crash/__init__.py | # flake8: noqa
from .module import Module
| 42 | 13.333333 | 26 | py |
null | ceph-main/src/pybind/mgr/crash/module.py | import hashlib
from mgr_module import CLICommand, CLIReadCommand, CLIWriteCommand, MgrModule, Option
import datetime
import errno
import functools
import inspect
import json
from collections import defaultdict
from prettytable import PrettyTable
import re
from threading import Event, Lock
from typing import cast, Any, ... | 16,375 | 35.553571 | 103 | py |
null | ceph-main/src/pybind/mgr/dashboard/__init__.py | # -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position,global-statement,protected-access
"""
ceph dashboard module
"""
import os
import cherrypy
if 'COVERAGE_ENABLED' in os.environ:
import coverage # pylint: disable=import-error
__cov = coverage.Coverage(config_file="{}/.coveragerc".format(os.path.... | 1,814 | 28.754098 | 93 | py |
null | ceph-main/src/pybind/mgr/dashboard/awsauth.py | # -*- coding: utf-8 -*-
# pylint: disable-all
#
# Copyright (c) 2012-2013 Paul Tax <paultax@gmail.com> All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must ... | 6,732 | 38.605882 | 94 | py |
null | ceph-main/src/pybind/mgr/dashboard/cherrypy_backports.py | # -*- coding: utf-8 -*-
"""
Copyright © 2004-2019, CherryPy Team (team@cherrypy.org)
All rights reserved.
* * *
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyri... | 8,331 | 40.66 | 99 | py |
null | ceph-main/src/pybind/mgr/dashboard/exceptions.py | # -*- coding: utf-8 -*-
class ViewCacheNoDataException(Exception):
def __init__(self):
self.status = 200
super(ViewCacheNoDataException, self).__init__('ViewCache: unable to retrieve data')
class DashboardException(Exception):
"""
Used for exceptions that are already handled and should e... | 3,521 | 27.403226 | 92 | py |
null | ceph-main/src/pybind/mgr/dashboard/grafana.py | # -*- coding: utf-8 -*-
import json
import logging
import os
import time
import requests
from .exceptions import GrafanaError
from .settings import Settings
logger = logging.getLogger('grafana')
class GrafanaRestClient(object):
@staticmethod
def url_validation(method, path):
response = requests.r... | 4,443 | 31.437956 | 79 | py |
null | ceph-main/src/pybind/mgr/dashboard/module.py | # -*- coding: utf-8 -*-
"""
ceph dashboard mgr plugin (based on CherryPy)
"""
import collections
import errno
import logging
import os
import socket
import ssl
import sys
import tempfile
import threading
import time
from typing import TYPE_CHECKING, Optional
from urllib.parse import urlparse
if TYPE_CHECKING:
if s... | 24,245 | 36.649068 | 123 | py |
null | ceph-main/src/pybind/mgr/dashboard/openapi.yaml | basePath: /
components:
securitySchemes:
jwt:
bearerFormat: JWT
scheme: bearer
type: http
host: example.com
info:
description: This is the official Ceph REST API
title: Ceph REST API
version: v1
openapi: 3.0.0
paths:
/api/auth:
post:
parameters: []
requestBody:
co... | 396,556 | 31.528669 | 137 | yaml |
null | ceph-main/src/pybind/mgr/dashboard/rest_client.py | # -*- coding: utf-8 -*-
"""
* Copyright (c) 2017 SUSE LLC
*
* openATTIC is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
*
* This package is distributed in the hope that it will be usefu... | 21,375 | 36.700176 | 95 | py |
null | ceph-main/src/pybind/mgr/dashboard/run-backend-api-request.sh | #!/bin/bash
CURR_DIR=`pwd`
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
cd ../../../../${BUILD_DIR}
API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
if [ "$API_URL" = "null" ]; then
echo "Couldn't retrieve API URL, exiting..." >&2
exit 1
fi
cd $CURR_DIR
TOKEN=`curl --insecure -... | 700 | 27.04 | 92 | sh |
null | ceph-main/src/pybind/mgr/dashboard/run-backend-api-tests.sh | #!/usr/bin/env bash
# SHELL_TRACE=true ./run-backend-api-tests.sh to enable debugging
[ -v SHELL_TRACE ] && set -x
# cross shell: Are we sourced?
# Source: https://stackoverflow.com/a/28776166/3185053
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
... | 5,466 | 28.874317 | 159 | sh |
null | ceph-main/src/pybind/mgr/dashboard/run-backend-rook-api-request.sh | #!/bin/bash
#
# Query k8s to determine where the mgr is running and how to reach the
# dashboard from the local machine. This assumes that the dashboard is being
# exposed via a nodePort service
CURR_DIR=`pwd`
K8S_NAMESPACE='rook-ceph'
HOST=$(kubectl get pods -n $K8S_NAMESPACE -l "app=rook-ceph-mgr" -o json | jq .ite... | 1,350 | 31.95122 | 139 | sh |
null | ceph-main/src/pybind/mgr/dashboard/run-frontend-e2e-tests.sh | #!/usr/bin/env bash
set -e
CLUSTERS=("1" "2")
ceph() {
${FULL_PATH_BUILD_DIR}/../src/mrun 1 ceph $@
}
ceph2() {
${FULL_PATH_BUILD_DIR}/../src/mrun 2 ceph $@
}
ceph_all() {
ceph $@
ceph2 $@
}
start_ceph() {
cd $FULL_PATH_BUILD_DIR
for cluster in ${CLUSTERS[@]}; do
export CEPH_OUT_C... | 3,748 | 24.503401 | 122 | sh |
null | ceph-main/src/pybind/mgr/dashboard/run-frontend-unittests.sh | #!/usr/bin/env bash
failed=false
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
: ${CEPH_ROOT:=$SCRIPTPATH/../../../../}
cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ `uname` != "FreeBSD" ]; then
. $CEPH_ROOT/${BUILD_DIR}/src/pybind/mgr/dashboard/frontend/node-env/bin... | 1,367 | 25.823529 | 125 | sh |
null | ceph-main/src/pybind/mgr/dashboard/security.py | # -*- coding: utf-8 -*-
import inspect
class Scope(object):
"""
List of Dashboard Security Scopes.
If you need another security scope, please add it here.
"""
HOSTS = "hosts"
CONFIG_OPT = "config-opt"
POOL = "pool"
OSD = "osd"
MONITOR = "monitor"
RBD_IMAGE = "rbd-image"
I... | 1,458 | 22.918033 | 76 | py |
null | ceph-main/src/pybind/mgr/dashboard/settings.py | # -*- coding: utf-8 -*-
import errno
import inspect
from ast import literal_eval
from typing import Any
from mgr_module import CLICheckNonemptyFileInput
from . import mgr
class Setting:
"""
Setting representation that allows to set a default value and a list of allowed data types.
:param default_value: ... | 9,107 | 34.439689 | 95 | py |
null | ceph-main/src/pybind/mgr/dashboard/tools.py | # -*- coding: utf-8 -*-
import collections
import fnmatch
import inspect
import json
import logging
import threading
import time
import urllib
from datetime import datetime, timedelta
from distutils.util import strtobool
import cherrypy
from mgr_util import build_url
from . import mgr
from .exceptions import ViewCac... | 29,378 | 33.933413 | 100 | py |
null | ceph-main/src/pybind/mgr/dashboard/api/__init__.py | 0 | 0 | 0 | py | |
null | ceph-main/src/pybind/mgr/dashboard/api/doc.py | from enum import Enum
from typing import Any, Dict, List, Optional
class SchemaType(Enum):
"""
Representation of the type property of a schema object:
http://spec.openapis.org/oas/v3.0.3.html#schema-object
"""
ARRAY = 'array'
BOOLEAN = 'boolean'
INTEGER = 'integer'
NUMBER = 'number'
... | 1,426 | 25.425926 | 85 | py |
null | ceph-main/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py | # -*- coding: utf-8 -*-
# pylint: disable=F0401
"""
This script does:
* Scan through Angular html templates and extract <cd-grafana> tags
* Check if every tag has a corresponding Grafana dashboard by `uid`
Usage:
python <script> <angular_app_dir> <grafana_dashboard_dir>
e.g.
cd /ceph/src/pybind/mgr/dashboard
... | 6,136 | 33.094444 | 98 | py |
null | ceph-main/src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh | #!/usr/bin/env bash
set -x
export PATH=/root/bin:$PATH
mkdir /root/bin
export CEPHADM_IMAGE='quay.ceph.io/ceph-ci/ceph:main'
CEPHADM="/root/bin/cephadm"
/mnt/{{ ceph_dev_folder }}/src/cephadm/build.sh $CEPHADM
mkdir -p /etc/ceph
mon_ip=$(ifconfig eth0 | grep 'inet ' | awk '{ print $2}')
bootstrap_extra_options='... | 1,366 | 33.175 | 160 | sh |
null | ceph-main/src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml | parameters:
nodes: 4
node_ip_offset: 100
pool: ceph-dashboard
network: ceph-dashboard
gateway: 192.168.100.1
netmask: 255.255.255.0
prefix: ceph
numcpus: 1
memory: 2048
image: fedora36
notify: false
admin_password: password
disks:
- 15
- 5
- 5
{% for number in range(0, nodes) %}
{{ prefix }}-node-0{{ n... | 937 | 19.391304 | 71 | yml |
null | ceph-main/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh | #!/usr/bin/env bash
set -ex
: ${CYPRESS_BASE_URL:=''}
: ${CYPRESS_LOGIN_USER:='admin'}
: ${CYPRESS_LOGIN_PWD:='password'}
: ${CYPRESS_ARGS:=''}
: ${DASHBOARD_PORT:='8443'}
get_vm_ip () {
local ip=$(kcli info vm "$1" -f ip -v | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
echo -n $ip
}
if [[ -n... | 2,417 | 39.3 | 164 | sh |
null | ceph-main/src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh | #!/usr/bin/env bash
set -eEx
on_error() {
set +x
if [ "$1" != "0" ]; then
echo "ERROR $1 thrown on line $2"
echo
echo "Collecting info..."
echo
echo "Saving MGR logs:"
echo
mkdir -p ${CEPH_DEV_FOLDER}/logs
kcli ssh -u root -- ceph-node-00 'cephad... | 2,802 | 33.604938 | 185 | sh |
null | ceph-main/src/pybind/mgr/dashboard/controllers/__init__.py | from ._api_router import APIRouter
from ._auth import ControllerAuthMixin
from ._base_controller import BaseController
from ._crud import CRUDCollectionMethod, CRUDEndpoint, CRUDResourceMethod, SecretStr
from ._docs import APIDoc, EndpointDoc
from ._endpoint import Endpoint, Proxy
from ._helpers import ENDPOINT_MAP, al... | 1,150 | 27.073171 | 94 | py |
null | ceph-main/src/pybind/mgr/dashboard/controllers/_api_router.py | from ._router import Router
class APIRouter(Router):
def __init__(self, path, security_scope=None, secure=True):
super().__init__(path, base_url="/api",
security_scope=security_scope,
secure=secure)
def __call__(self, cls):
cls = super().__cal... | 381 | 26.285714 | 63 | py |
null | ceph-main/src/pybind/mgr/dashboard/controllers/_auth.py | import cherrypy
class ControllerAuthMixin:
@staticmethod
def _delete_token_cookie(token):
cherrypy.response.cookie['token'] = token
cherrypy.response.cookie['token']['expires'] = 0
cherrypy.response.cookie['token']['max-age'] = 0
@staticmethod
def _set_token_cookie(url_prefix,... | 658 | 33.684211 | 64 | py |