File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,14 @@ def get_pool_info(self):
405405 # MAX_AVAIL stat will divide by the replication size when doing the
406406 # calculation.
407407 args = ['ceph' , 'df' , '--format=json' ] + self .ceph_args ()
408- out , _ = processutils .execute (* args )
408+
409+ try :
410+ out , _ = processutils .execute (* args )
411+ except processutils .ProcessExecutionError :
412+ LOG .exception ('Could not determine disk usage' )
413+ raise exception .StorageError (
414+ reason = 'Could not determine disk usage' )
415+
409416 stats = jsonutils .loads (out )
410417
411418 # Find the pool for which we are configured.
Original file line number Diff line number Diff line change 1313
1414from eventlet import tpool
1515import mock
16+ from oslo_concurrency import processutils
1617from oslo_serialization import jsonutils
1718from oslo_utils .fixture import uuidsentinel as uuids
1819
@@ -653,6 +654,11 @@ def test_get_pool_info(self, mock_execute):
653654 'used' : ceph_df_json ['pools' ][1 ]['stats' ]['bytes_used' ]}
654655 self .assertDictEqual (expected , self .driver .get_pool_info ())
655656
657+ @mock .patch ('oslo_concurrency.processutils.execute' , autospec = True ,
658+ side_effect = processutils .ProcessExecutionError ("failed" ))
659+ def test_get_pool_info_execute_failed (self , mock_execute ):
660+ self .assertRaises (exception .StorageError , self .driver .get_pool_info )
661+
656662 @mock .patch ('oslo_concurrency.processutils.execute' )
657663 def test_get_pool_info_not_found (self , mock_execute ):
658664 # Make the pool something other than self.rbd_pool so it won't be found
You can’t perform that action at this time.
0 commit comments