]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Storwize SVC driver hostname can't start with number
authorAlan Jiang <ajiang@us.ibm.com>
Tue, 1 Oct 2013 05:38:03 +0000 (00:38 -0500)
committerAlan Jiang <ajiang@us.ibm.com>
Wed, 2 Oct 2013 03:15:41 +0000 (22:15 -0500)
Storwize family storage does not allow host identifier start with
a numeric number. Otherwise cinder initialize_connection() API will
throw exception due to such invalid host name in the connector. The fix
is to add a '_' symbol as prefix if the host identifier in connector
starts with non-alphabet letters.

Closes-Bug: #1233952
Change-Id: Ia88afc373e2635c10c3f6256331a4fd90f51f4b8

cinder/volume/drivers/storwize_svc.py

index ef6cb3d417f1461cbc7b085122b38b1093ad0478..16a458b83ce8e0ed4365d093ad25d481007ca2ca 100644 (file)
@@ -482,6 +482,11 @@ class StorwizeSVCDriver(san.SanDriver):
             raise exception.NoValidHost(reason=msg)
 
         host_name = str(host_name)
+
+        # Storwize family doesn't like hostname that starts with number.
+        if not re.match('^[A-Za-z]', host_name):
+            host_name = '_' + host_name
+
         return host_name[:55]
 
     def _find_host_from_wwpn(self, connector):