@@ -32,12 +32,9 @@ class CephNvmeof(ContainerDaemonForm):
3232 def for_daemon_type (cls , daemon_type : str ) -> bool :
3333 return cls .daemon_type == daemon_type
3434
35- def __init__ (self ,
36- ctx ,
37- fsid ,
38- daemon_id ,
39- config_json ,
40- image = DEFAULT_NVMEOF_IMAGE ):
35+ def __init__ (
36+ self , ctx , fsid , daemon_id , config_json , image = DEFAULT_NVMEOF_IMAGE
37+ ):
4138 # type: (CephadmContext, str, Union[int, str], Dict, str) -> None
4239 self .ctx = ctx
4340 self .fsid = fsid
@@ -53,11 +50,12 @@ def __init__(self,
5350 @classmethod
5451 def init (cls , ctx , fsid , daemon_id ):
5552 # type: (CephadmContext, str, Union[int, str]) -> CephNvmeof
56- return cls (ctx , fsid , daemon_id ,
57- fetch_configs (ctx ), ctx .image )
53+ return cls (ctx , fsid , daemon_id , fetch_configs (ctx ), ctx .image )
5854
5955 @classmethod
60- def create (cls , ctx : CephadmContext , ident : DaemonIdentity ) -> 'CephNvmeof' :
56+ def create (
57+ cls , ctx : CephadmContext , ident : DaemonIdentity
58+ ) -> 'CephNvmeof' :
6159 return cls .init (ctx , ident .fsid , ident .daemon_id )
6260
6361 @property
@@ -69,7 +67,9 @@ def _get_container_mounts(data_dir: str) -> Dict[str, str]:
6967 mounts = dict ()
7068 mounts [os .path .join (data_dir , 'config' )] = '/etc/ceph/ceph.conf:z'
7169 mounts [os .path .join (data_dir , 'keyring' )] = '/etc/ceph/keyring:z'
72- mounts [os .path .join (data_dir , 'ceph-nvmeof.conf' )] = '/src/ceph-nvmeof.conf:z'
70+ mounts [
71+ os .path .join (data_dir , 'ceph-nvmeof.conf' )
72+ ] = '/src/ceph-nvmeof.conf:z'
7373 mounts [os .path .join (data_dir , 'configfs' )] = '/sys/kernel/config'
7474 mounts ['/dev/hugepages' ] = '/dev/hugepages'
7575 mounts ['/dev/vfio/vfio' ] = '/dev/vfio/vfio'
@@ -94,10 +94,16 @@ def customize_container_binds(
9494
9595 @staticmethod
9696 def get_version (ctx : CephadmContext , container_id : str ) -> Optional [str ]:
97- out , err , ret = call (ctx ,
98- [ctx .container_engine .path , 'inspect' ,
99- '--format' , '{{index .Config.Labels "io.ceph.version"}}' ,
100- ctx .image ])
97+ out , err , ret = call (
98+ ctx ,
99+ [
100+ ctx .container_engine .path ,
101+ 'inspect' ,
102+ '--format' ,
103+ '{{index .Config.Labels "io.ceph.version"}}' ,
104+ ctx .image ,
105+ ],
106+ )
101107 version = None
102108 if ret == 0 :
103109 version = out .strip ()
@@ -116,7 +122,9 @@ def validate(self):
116122 if self .required_files :
117123 for fname in self .required_files :
118124 if fname not in self .files :
119- raise Error ('required file missing from config-json: %s' % fname )
125+ raise Error (
126+ 'required file missing from config-json: %s' % fname
127+ )
120128
121129 def get_daemon_name (self ):
122130 # type: () -> str
@@ -147,11 +155,15 @@ def configfs_mount_umount(data_dir, mount=True):
147155 # type: (str, bool) -> List[str]
148156 mount_path = os .path .join (data_dir , 'configfs' )
149157 if mount :
150- cmd = 'if ! grep -qs {0} /proc/mounts; then ' \
151- 'mount -t configfs none {0}; fi' .format (mount_path )
158+ cmd = (
159+ 'if ! grep -qs {0} /proc/mounts; then '
160+ 'mount -t configfs none {0}; fi' .format (mount_path )
161+ )
152162 else :
153- cmd = 'if grep -qs {0} /proc/mounts; then ' \
154- 'umount {0}; fi' .format (mount_path )
163+ cmd = (
164+ 'if grep -qs {0} /proc/mounts; then '
165+ 'umount {0}; fi' .format (mount_path )
166+ )
155167 return cmd .split ()
156168
157169 @staticmethod
0 commit comments