Skip to content

Commit 0f9fc70

Browse files
authored
Merge pull request ceph#61258 from guits/cv-hints
ceph-volume: type annotations
2 parents 0b9d3d2 + d602c8d commit 0f9fc70

File tree

24 files changed

+514
-483
lines changed

24 files changed

+514
-483
lines changed

src/ceph-volume/ceph_volume/api/lvm.py

Lines changed: 125 additions & 104 deletions
Large diffs are not rendered by default.

src/ceph-volume/ceph_volume/devices/lvm/activate.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22
import argparse
33
import logging
44
from textwrap import dedent
5-
from ceph_volume import objectstore
5+
from ceph_volume import objectstore, terminal
6+
from typing import List, Optional
67

78

89
logger = logging.getLogger(__name__)
9-
10+
mlogger = terminal.MultiLogger(__name__)
1011

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

14-
def __init__(self, argv, args=None):
15-
self.objectstore = None
15+
def __init__(self,
16+
argv: Optional[List[str]] = None,
17+
args: Optional[argparse.Namespace] = None) -> None:
18+
self.objectstore: Optional[objectstore.baseobjectstore.BaseObjectStore] = None
1619
self.argv = argv
1720
self.args = args
1821

19-
def main(self):
22+
def main(self) -> None:
2023
sub_command_help = dedent("""
2124
Activate OSDs by discovering them with LVM and mounting them in their
2225
appropriate destination:
@@ -85,6 +88,8 @@ def main(self):
8588
action='store_true',
8689
help='Do not use a tmpfs mount for OSD data dir'
8790
)
91+
if self.argv is None:
92+
self.argv = []
8893
if len(self.argv) == 0 and self.args is None:
8994
print(sub_command_help)
9095
return
@@ -93,7 +98,11 @@ def main(self):
9398
if self.args.bluestore:
9499
self.args.objectstore = 'bluestore'
95100
self.objectstore = objectstore.mapping['LVM'][self.args.objectstore](args=self.args)
96-
if self.args.activate_all:
97-
self.objectstore.activate_all()
101+
if self.objectstore is not None:
102+
if self.args.activate_all:
103+
self.objectstore.activate_all()
104+
else:
105+
self.objectstore.activate()
98106
else:
99-
self.objectstore.activate()
107+
mlogger.error('Unexpected error while setting objectstore backend.')
108+
return

0 commit comments

Comments
 (0)