Retry lvm volume and volume group query

We observed that the vgs and lvs queries the our lvm driver uses can
intermittently fail with error code 11 (EAGAIN). So this patch enabled
the retry in oslo_concurrency.processutils for these calls.

Change-Id: I93da6cb1675d77bcdcd1075641dea9e2afc0ee1a
Closes-Bug: #1931710
This commit is contained in:
Balazs Gibizer 2021-06-14 14:05:05 +02:00
parent 052cf96358
commit e59fc77c3d
2 changed files with 15 additions and 6 deletions

View File

@ -57,14 +57,21 @@ def lvcreate(size, lv, vg, preallocated=None):
@nova.privsep.sys_admin_pctxt.entrypoint
def vginfo(vg):
return processutils.execute('vgs', '--noheadings', '--nosuffix',
'--separator', '|', '--units', 'b',
'-o', 'vg_size,vg_free', vg)
# NOTE(gibi): We see intermittent faults querying volume groups failing
# with error code -11, hence the retry. See bug 1931710
return processutils.execute(
'vgs', '--noheadings', '--nosuffix',
'--separator', '|', '--units', 'b',
'-o', 'vg_size,vg_free', vg,
attempts=3, delay_on_retry=True,
)
@nova.privsep.sys_admin_pctxt.entrypoint
def lvlist(vg):
return processutils.execute('lvs', '--noheadings', '-o', 'lv_name', vg)
return processutils.execute(
'lvs', '--noheadings', '-o', 'lv_name', vg,
attempts=3, delay_on_retry=True)
@nova.privsep.sys_admin_pctxt.entrypoint

View File

@ -65,13 +65,15 @@ class PrivsepFilesystemHelpersTestCase(test.NoDBTestCase):
nova.privsep.fs.vginfo('vg')
mock_execute.assert_called_with('vgs', '--noheadings', '--nosuffix',
'--separator', '|', '--units', 'b',
'-o', 'vg_size,vg_free', 'vg')
'-o', 'vg_size,vg_free', 'vg',
attempts=3, delay_on_retry=True)
@mock.patch('oslo_concurrency.processutils.execute')
def test_lvlist(self, mock_execute):
nova.privsep.fs.lvlist('vg')
mock_execute.assert_called_with('lvs', '--noheadings', '-o',
'lv_name', 'vg')
'lv_name', 'vg',
attempts=3, delay_on_retry=True)
@mock.patch('oslo_concurrency.processutils.execute')
def test_lvinfo(self, mock_execute):