Skip to content

Commit

Permalink
Merge pull request ceph#61258 from guits/cv-hints
Browse files Browse the repository at this point in the history
ceph-volume: type annotations
  • Loading branch information
guits authored Jan 23, 2025
2 parents 0b9d3d2 + d602c8d commit 0f9fc70
Show file tree
Hide file tree
Showing 24 changed files with 514 additions and 483 deletions.
229 changes: 125 additions & 104 deletions src/ceph-volume/ceph_volume/api/lvm.py

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions src/ceph-volume/ceph_volume/devices/lvm/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
import argparse
import logging
from textwrap import dedent
from ceph_volume import objectstore
from ceph_volume import objectstore, terminal
from typing import List, Optional


logger = logging.getLogger(__name__)

mlogger = terminal.MultiLogger(__name__)

class Activate(object):
help = 'Discover and mount the LVM device associated with an OSD ID and start the Ceph OSD'

def __init__(self, argv, args=None):
self.objectstore = None
def __init__(self,
argv: Optional[List[str]] = None,
args: Optional[argparse.Namespace] = None) -> None:
self.objectstore: Optional[objectstore.baseobjectstore.BaseObjectStore] = None
self.argv = argv
self.args = args

def main(self):
def main(self) -> None:
sub_command_help = dedent("""
Activate OSDs by discovering them with LVM and mounting them in their
appropriate destination:
Expand Down Expand Up @@ -85,6 +88,8 @@ def main(self):
action='store_true',
help='Do not use a tmpfs mount for OSD data dir'
)
if self.argv is None:
self.argv = []
if len(self.argv) == 0 and self.args is None:
print(sub_command_help)
return
Expand All @@ -93,7 +98,11 @@ def main(self):
if self.args.bluestore:
self.args.objectstore = 'bluestore'
self.objectstore = objectstore.mapping['LVM'][self.args.objectstore](args=self.args)
if self.args.activate_all:
self.objectstore.activate_all()
if self.objectstore is not None:
if self.args.activate_all:
self.objectstore.activate_all()
else:
self.objectstore.activate()
else:
self.objectstore.activate()
mlogger.error('Unexpected error while setting objectstore backend.')
return
Loading

0 comments on commit 0f9fc70

Please sign in to comment.