mypy: Annotate utils.get_device_size
Add annotations for parameters of this method. Change-Id: I3149e0067f97d373333e0901e49725401fc6c068changes/88/864288/1
parent
0639af4fc8
commit
dc953012b7
|
@ -1195,7 +1195,11 @@ class NVMeOFConnector(base.BaseLinuxConnector):
|
|||
LOG.info('Wait 5 seconds and return whatever size is present')
|
||||
time.sleep(5)
|
||||
|
||||
return utils.get_device_size(self, device_path)
|
||||
size = utils.get_device_size(self, device_path)
|
||||
if size is None:
|
||||
raise exception.BrickException(
|
||||
'get_device_size returned non-numeric size')
|
||||
return size
|
||||
|
||||
# ####### RAID methods ########
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ from oslo_concurrency import processutils
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
|
||||
from os_brick import executor
|
||||
from os_brick.i18n import _
|
||||
from os_brick.privileged import nvmeof as priv_nvme
|
||||
from os_brick.privileged import rootwrap as priv_rootwrap
|
||||
|
@ -400,7 +401,7 @@ def connect_volume_undo_prepare_result(
|
|||
return decorator
|
||||
|
||||
|
||||
def get_device_size(executor, device):
|
||||
def get_device_size(executor: executor.Executor, device: str) -> Optional[int]:
|
||||
"""Get the size in bytes of a volume."""
|
||||
(out, _err) = executor._execute('blockdev', '--getsize64',
|
||||
device, run_as_root=True,
|
||||
|
|
Loading…
Reference in New Issue