Merge lp:~billy-olsen/cinder/icehouse-1336568 into lp:~ubuntu-server-dev/cinder/icehouse

Proposed by Billy Olsen
Status: Merged
Merged at revision: 190
Proposed branch: lp:~billy-olsen/cinder/icehouse-1336568
Merge into: lp:~ubuntu-server-dev/cinder/icehouse
Diff against target: 208 lines (+190/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/tgtadmin-iscsi-write-cache-config.patch (+180/-0)
To merge this branch: bzr merge lp:~billy-olsen/cinder/icehouse-1336568
Reviewer Review Type Date Requested Status
Corey Bryant Approve
Review via email: mp+267424@code.launchpad.net

Description of the change

This change includes the option to specify the iscsi_write_cache behavior, which is a backport of LP: #1336568

To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Looks good, thanks! I had to make a very minor tweak by moving the asterisk in d/changelog right by one space in order for the merge to work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-06-23 00:11:54 +0000
+++ debian/changelog 2015-08-07 22:28:11 +0000
@@ -1,3 +1,12 @@
1cinder (1:2014.1.5-0ubuntu2) trusty; urgency=medium
2
3 * Enable iscsi_write_cache option for tgtadm backends (LP: #1336568):
4 - d/p/tgtadmin-iscsi-write-cache-config.patch - Includes backport of
5 change from the juno release for enabling iscsi write cache policy
6 for tgtadm.
7
8 -- Billy Olsen <billy.olsen@canonical.com> Mon, 27 Jul 2015 17:35:57 -0700
9
1cinder (1:2014.1.5-0ubuntu1) trusty; urgency=medium10cinder (1:2014.1.5-0ubuntu1) trusty; urgency=medium
211
3 * Resynchronize with stable/icehouse (d03ca5d) (LP: #1467533):12 * Resynchronize with stable/icehouse (d03ca5d) (LP: #1467533):
413
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-03-17 17:37:44 +0000
+++ debian/patches/series 2015-08-07 22:28:11 +0000
@@ -1,1 +1,2 @@
1fix-requirements.patch1fix-requirements.patch
2tgtadmin-iscsi-write-cache-config.patch
23
=== added file 'debian/patches/tgtadmin-iscsi-write-cache-config.patch'
--- debian/patches/tgtadmin-iscsi-write-cache-config.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/tgtadmin-iscsi-write-cache-config.patch 2015-08-07 22:28:11 +0000
@@ -0,0 +1,180 @@
1From fb077f5fe2d64c8c75ff4b507ab56b16c722ef77 Mon Sep 17 00:00:00 2001
2From: Mitsuhiro Tanino <mitsuhiro.tanino@hds.com>
3Date: Tue, 8 Jul 2014 15:52:11 -0400
4Subject: [PATCH 1/1] Configure write cache option of tgtd iscsi driver
5
6Cinder LVMiSCSI driver is using default value of write-cache parameter
7of tgtd iscsi driver. In this setting, write I/O from guest instance is
8cached on dirty cache of a host.(write-back mode)
9
10In this case, data lost may be occurred if the host crashes before
11flushing dirty cache. This may cause a lot of instances to lose
12their data.
13
14In order to avoid this issue, it is better to turn off the write cache.
15(write-through mode)
16
17This patch adds "iscsi_write_cache" parameter to configure a behavior of
18write cache. The default value is "iscsi_write_cache=on".(write-back mode)
19
20Closes-Bug: 1336568
21DocImpact
22
23Change-Id: I7a495bc6118d4254576bdf1620a04ac537b3078d
24Signed-off-by: Mitsuhiro Tanino <mitsuhiro.tanino@hds.com>
25(cherry picked from commit 617e59bde660f919df0818611b911ae35f8b7247)
26
27The following conflicts were due to local vs global config changes
28from upstream commit (1b21d499bb3bb1e94e2815cbada86db8e8e21406), which
29is not needed in order for change in icehouse. Will not include changes
30from this commit in order to avoid changing the API.
31
32Conflicts:
33 cinder/volume/driver.py
34 cinder/volume/drivers/lvm.py
35 cinder/volume/iscsi.py
36 etc/cinder/cinder.conf.sample
37---
38 cinder/brick/iscsi/iscsi.py | 10 ++++++++--
39 cinder/tests/test_iscsi.py | 4 +++-
40 cinder/volume/driver.py | 6 ++++++
41 cinder/volume/iscsi.py | 7 +++++--
42 etc/cinder/cinder.conf.sample | 6 ++++++
43 5 files changed, 28 insertions(+), 5 deletions(-)
44
45diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py
46index e5ae6ce..ab0caa6 100644
47--- a/cinder/brick/iscsi/iscsi.py
48+++ b/cinder/brick/iscsi/iscsi.py
49@@ -83,6 +83,7 @@ class TgtAdm(TargetAdmin):
50 <target %s>
51 backing-store %s
52 lld iscsi
53+ write-cache %s
54 </target>
55 """
56 VOLUME_CONF_WITH_CHAP_AUTH = """
57@@ -90,6 +91,7 @@ class TgtAdm(TargetAdmin):
58 backing-store %s
59 lld iscsi
60 %s
61+ write-cache %s
62 </target>
63 """
64
65@@ -165,11 +167,13 @@ class TgtAdm(TargetAdmin):
66 fileutils.ensure_tree(self.volumes_dir)
67
68 vol_id = name.split(':')[1]
69+ write_cache = kwargs.get('write_cache', 'on')
70 if chap_auth is None:
71- volume_conf = self.VOLUME_CONF % (name, path)
72+ volume_conf = self.VOLUME_CONF % (name, path, write_cache)
73 else:
74 volume_conf = self.VOLUME_CONF_WITH_CHAP_AUTH % (name,
75- path, chap_auth)
76+ path, chap_auth,
77+ write_cache)
78
79 LOG.info(_('Creating iscsi_target for: %s') % vol_id)
80 volumes_dir = self.volumes_dir
81@@ -600,6 +604,7 @@ class ISERTgtAdm(TgtAdm):
82 <target %s>
83 driver iser
84 backing-store %s
85+ write_cache %s
86 </target>
87 """
88 VOLUME_CONF_WITH_CHAP_AUTH = """
89@@ -607,6 +612,7 @@ class ISERTgtAdm(TgtAdm):
90 driver iser
91 backing-store %s
92 %s
93+ write_cache %s
94 </target>
95 """
96
97diff --git a/cinder/tests/test_iscsi.py b/cinder/tests/test_iscsi.py
98index d24989b..74e40f1 100644
99--- a/cinder/tests/test_iscsi.py
100+++ b/cinder/tests/test_iscsi.py
101@@ -34,6 +34,7 @@ class TargetAdminTestCase(object):
102 self.path = '/foo'
103 self.vol_id = 'blaa'
104 self.vol_name = 'volume-blaa'
105+ self.write_cache = 'off'
106 self.db = {}
107
108 self.script_template = None
109@@ -93,7 +94,8 @@ class TargetAdminTestCase(object):
110 target_helper = self.driver.get_target_helper(self.db)
111 target_helper.set_execute(self.fake_execute)
112 target_helper.create_iscsi_target(self.target_name, self.tid,
113- self.lun, self.path)
114+ self.lun, self.path,
115+ write_cache=self.write_cache)
116 target_helper.show_target(self.tid, iqn=self.target_name)
117 target_helper.remove_iscsi_target(self.tid, self.lun, self.vol_id,
118 self.vol_name)
119diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py
120index aa0fb20..1f08dc3 100644
121--- a/cinder/volume/driver.py
122+++ b/cinder/volume/driver.py
123@@ -103,6 +103,12 @@ volume_opts = [
124 default='1M',
125 help='The default block size used when copying/clearing '
126 'volumes'),
127+ cfg.StrOpt('iscsi_write_cache',
128+ default='on',
129+ help='Sets the behavior of the iSCSI target to either '
130+ 'perform write-back(on) or write-through(off). '
131+ 'This parameter is valid if iscsi_helper is set '
132+ 'to tgtadm or iseradm.'),
133 ]
134
135 # for backward compatibility
136diff --git a/cinder/volume/iscsi.py b/cinder/volume/iscsi.py
137index 7ba7aad..70fd695 100644
138--- a/cinder/volume/iscsi.py
139+++ b/cinder/volume/iscsi.py
140@@ -50,7 +50,9 @@ class _ExportMixin(object):
141 iscsi_target,
142 0,
143 volume_path,
144- chap_auth)
145+ chap_auth,
146+ write_cache=
147+ CONF.iscsi_write_cache)
148 data = {}
149 data['location'] = self._iscsi_location(
150 CONF.iscsi_ip_address, tid, iscsi_name, lun)
151@@ -104,7 +106,8 @@ class _ExportMixin(object):
152 old_name = None
153 self.create_iscsi_target(iscsi_name, iscsi_target, 0, volume_path,
154 chap_auth, check_exit_code=False,
155- old_name=old_name)
156+ old_name=old_name,
157+ write_cache=CONF.iscsi_write_cache)
158
159 def _ensure_iscsi_targets(self, context, host):
160 """Ensure that target ids have been created in datastore."""
161diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample
162index 22404f4..f1e9f9f 100644
163--- a/etc/cinder/cinder.conf.sample
164+++ b/etc/cinder/cinder.conf.sample
165@@ -1009,6 +1009,12 @@
166 # (string value)
167 #volume_dd_blocksize=1M
168
169+# Sets the behavior of the iSCSI target to either perform
170+# write-back(on) or write-through(off). This parameter is
171+# valid if iscsi_helper is set to tgtadm or iseradm. (string
172+# value)
173+#iscsi_write_cache=on
174+
175
176 #
177 # Options defined in cinder.volume.drivers.block_device
178--
1792.1.4
180

Subscribers

People subscribed via source and target branches