Shares should always be of the form address:/volume. If they are
not (i.e., are missing the '/'), then skip them and issue a warning
message. This will prevent us from sending incorrect connection_info
dicts to Nova.
Closes-Bug: #
1267253
Change-Id: Ic40cd0cdc862b44b0a7d3e5b1d7c4fee8ea1b28d
config_data.append(self.TEST_EXPORT1)
config_data.append('#' + self.TEST_EXPORT2)
config_data.append(self.TEST_EXPORT2 + ' ' + self.TEST_EXPORT2_OPTIONS)
+ config_data.append('broken:share_format')
config_data.append('')
drv._read_config_file(self.TEST_SHARES_CONFIG_FILE).\
AndReturn(config_data)
config_data.append('')
config_data.append(self.TEST_NFS_EXPORT2 + ' ' +
self.TEST_NFS_EXPORT2_OPTIONS)
+ config_data.append('broken:share_format')
drv._read_config_file(self.TEST_SHARES_CONFIG_FILE).\
AndReturn(config_data)
mox.ReplayAll()
import errno
import os
+import re
from oslo.config import cfg
share_address = share_info[0].strip().decode('unicode_escape')
share_opts = share_info[1].strip() if len(share_info) > 1 else None
+ if not re.match(r'.+:/.+', share_address):
+ LOG.warn("Share %s ignored due to invalid format. Must be of "
+ "form address:/export." % share_address)
+ continue
+
self.shares[share_address] = share_opts
LOG.debug("shares loaded: %s", self.shares)