Check RBDConnector.disconnect_volume device_info argument

device_info is optional and in some cases could be None.
We should check it and don't fail in case if it is None.

Change-Id: Ib970eebc7c57216fd5008ec35b8165d8633de809
changes/62/232062/2
Ivan Kolodyazhny 7 years ago committed by Walter A. Boring IV (hemna)
parent 90c285704f
commit 782c10207c
  1. 7
      os_brick/initiator/connector.py

@ -1425,9 +1425,10 @@ class RBDConnector(InitiatorConnector):
def disconnect_volume(self, connection_properties, device_info):
"""Disconnect a volume."""
rbd_handle = device_info.get('path', None)
if rbd_handle is not None:
rbd_handle.close()
if device_info:
rbd_handle = device_info.get('path', None)
if rbd_handle is not None:
rbd_handle.close()
def check_valid_device(self, path, run_as_root=True):
"""Verify an existing RBD handle is connected and valid."""

Loading…
Cancel
Save