Handle return code 2 from blkid calls
blkid returns code 2 if the requested TYPE key is not found for the specified device. Ensure that this situation is handled correctly; blkid will not return any data, so the return value will be empty. Change-Id: I38cd7b53cdfd694c0eba1b6054d8e4c33759b0b8 Closes-Bug: #1426324
This commit is contained in:
parent
df04ec843a
commit
051fced477
@ -416,7 +416,8 @@ class VirtDiskVFSLocalFSTest(test.NoDBTestCase):
|
||||
execute.assert_called_once_with('blkid', '-o',
|
||||
'value', '-s',
|
||||
'TYPE', '/dev/xyz',
|
||||
run_as_root=True)
|
||||
run_as_root=True,
|
||||
check_exit_code=[0, 2])
|
||||
|
||||
@mock.patch.object(tempfile, 'mkdtemp')
|
||||
@mock.patch.object(nova.virt.disk.mount.nbd, 'NbdMount')
|
||||
|
@ -164,6 +164,7 @@ class VFSLocalFS(vfs.VFS):
|
||||
out, err = utils.execute('blkid', '-o',
|
||||
'value', '-s',
|
||||
'TYPE', self.mount.device,
|
||||
run_as_root=True)
|
||||
run_as_root=True,
|
||||
check_exit_code=[0, 2])
|
||||
return out.strip()
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user