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 @@ -425,7 +425,14 @@ def get_pool_info(self):
425425 # MAX_AVAIL stat will divide by the replication size when doing the
426426 # calculation.
427427 args = ['ceph' , 'df' , '--format=json' ] + self .ceph_args ()
428- out , _ = processutils .execute (* args )
428+
429+ try :
430+ out , _ = processutils .execute (* args )
431+ except processutils .ProcessExecutionError :
432+ LOG .exception ('Could not determine disk usage' )
433+ raise exception .StorageError (
434+ reason = 'Could not determine disk usage' )
435+
429436 stats = jsonutils .loads (out )
430437
431438 # 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