Make disk size check output handling consistent
The output handling for the _is_disk_larger_than_max_size helper method was treating a tuple as an array, and requesting the first item in the array. Ideally we should be recording stdout and stderr to separate variables and working with them in that fashion. Changed helper method to record the output separately, and evaluate what should be a string for the size comparison. Change-Id: Icf612789e0e216528d12f11733380a1399c629e1
This commit is contained in:
parent
ccfb67bb82
commit
da0524dcbd
|
@ -578,9 +578,10 @@ def _is_disk_larger_than_max_size(device, node_uuid):
|
|||
:returns: True if total disk size exceeds 2TB. Returns False otherwise.
|
||||
"""
|
||||
try:
|
||||
disksize_bytes = utils.execute('blockdev', '--getsize64', device,
|
||||
use_standard_locale=True,
|
||||
run_as_root=True)
|
||||
disksize_bytes, err = utils.execute('blockdev', '--getsize64',
|
||||
device,
|
||||
use_standard_locale=True,
|
||||
run_as_root=True)
|
||||
except (processutils.UnknownArgumentError,
|
||||
processutils.ProcessExecutionError, OSError) as e:
|
||||
msg = (_('Failed to get size of disk %(disk)s for node %(node)s. '
|
||||
|
@ -589,7 +590,7 @@ def _is_disk_larger_than_max_size(device, node_uuid):
|
|||
LOG.error(msg)
|
||||
raise exception.InstanceDeployFailure(msg)
|
||||
|
||||
disksize_mb = int(disksize_bytes[0].strip()) // 1024 // 1024
|
||||
disksize_mb = int(disksize_bytes.strip()) // 1024 // 1024
|
||||
|
||||
return disksize_mb > MAX_DISK_SIZE_MB_SUPPORTED_BY_MBR
|
||||
|
||||
|
|
Loading…
Reference in New Issue