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

Subscribers

People subscribed via source and target branches