Fix vmware migrate available volume bug

The 'pass' statement in initiator/connectors/vmware.py:
def check_valid_device() causes the method to return a
false value, and the 'cinder migrate' process will fail.
This patch implements the check_valid_device() method,
not just 'pass' or returns something directly.

Change-Id: Ifb3ecd3eb5a3fbbc35f38e4ffddbd7144965aab1
Closes-bug: #1704695
This commit is contained in:
lihaijing 2017-07-17 13:01:47 +08:00
parent 1d617b2adb
commit e4908345b5
1 changed files with 10 additions and 2 deletions

View File

@ -68,8 +68,16 @@ class VmdkConnector(initiator_connector.InitiatorConnector):
def get_connector_properties(root_helper, *args, **kwargs):
return {}
def check_valid_device(self, path, run_as_root=True):
pass
def check_valid_device(self, path, *args, **kwargs):
try:
with open(path, 'r') as dev:
dev.read(1)
except IOError:
LOG.exception(
"Failed to access the device on the path "
"%(path)s", {"path": path})
return False
return True
def get_volume_paths(self, connection_properties):
return []