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):
425
425
# MAX_AVAIL stat will divide by the replication size when doing the
426
426
# calculation.
427
427
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
+
429
436
stats = jsonutils .loads (out )
430
437
431
438
# Find the pool for which we are configured.
Original file line number Diff line number Diff line change 13
13
14
14
from eventlet import tpool
15
15
import mock
16
+ from oslo_concurrency import processutils
16
17
from oslo_serialization import jsonutils
17
18
from oslo_utils .fixture import uuidsentinel as uuids
18
19
@@ -653,6 +654,11 @@ def test_get_pool_info(self, mock_execute):
653
654
'used' : ceph_df_json ['pools' ][1 ]['stats' ]['bytes_used' ]}
654
655
self .assertDictEqual (expected , self .driver .get_pool_info ())
655
656
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
+
656
662
@mock .patch ('oslo_concurrency.processutils.execute' )
657
663
def test_get_pool_info_not_found (self , mock_execute ):
658
664
# 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