Skip to content

Commit 960b0d1

Browse files
committed
Set default value for partition available parameter
While testing NFS storage pool with invalid host and path, partition information will be empty and it was raising an exception. Fix it by adding a default value for partition 'available' parameter. Signed-off-by: Aline Manera <[email protected]>
1 parent f2299e7 commit 960b0d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

control/host.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(self, model):
9696
# sorted by their path
9797
def _get_resources(self, flag_filter):
9898
res_list = super(Partitions, self)._get_resources(flag_filter)
99-
res_list = list(filter(lambda x: x.info['available'], res_list))
99+
res_list = list(filter(lambda x: x.info.get('available', False), res_list))
100100
if is_s390x():
101101
# On s390x arch filter out the DASD block devices which
102102
# don't have any partition(s). This is necessary because
@@ -123,7 +123,7 @@ def __init__(self, model, id):
123123

124124
@property
125125
def data(self):
126-
if not self.info['available']:
126+
if not self.info.get('available', False):
127127
raise NotFoundError('KCHPART0001E', {'name': self.info['name']})
128128

129129
return self.info

0 commit comments

Comments
 (0)