File 0001-Set-useful-vendor-product-id-in-Cinder-ISCSI-exports.patch of Package openstack-cinder

From ba9a2d3a12ec287ada256fddee21c6850bd4290a Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Mon, 16 Dec 2013 14:49:37 +0100
Subject: [PATCH] Set useful vendor/product id in Cinder ISCSI exports

This can be very useful for debugging and can be used
to filter out access from tenant volumes within compute
hosts.

Change-Id: Ib7ddb824043536a92024ada30476d00fd171e800
---
 cinder/brick/iscsi/iscsi.py | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py
index 103014e..0a778e3 100644
--- a/cinder/brick/iscsi/iscsi.py
+++ b/cinder/brick/iscsi/iscsi.py
@@ -155,19 +155,30 @@ class TgtAdm(TargetAdmin):
         fileutils.ensure_tree(self.volumes_dir)
 
         vol_id = name.split(':')[1]
+        scsi_prod_id = vol_id[:15]
+
+        conf_variables = {
+            'name': name, 'path': path,
+            'prod_id': scsi_prod_id,
+            'chap_auth': chap_auth}
+
         if chap_auth is None:
             volume_conf = """
-                <target %s>
-                    backing-store %s
+                <target %(name)s>
+                    backing-store %(path)s
+                    vendor_id cinder
+                    product_id %(prod_id)s
                 </target>
-            """ % (name, path)
+            """ % conf_variables
         else:
             volume_conf = """
-                <target %s>
-                    backing-store %s
-                    %s
+                <target %(name)s>
+                    backing-store %(path)s
+                    vendor_id cinder
+                    product_id %(prod_id)s
+                    %(chap_auth)s
                 </target>
-            """ % (name, path, chap_auth)
+            """ % conf_variables
 
         LOG.info(_('Creating iscsi_target for: %s') % vol_id)
         volumes_dir = self.volumes_dir
-- 
1.8.4.1

openSUSE Build Service is sponsored by