Export cinder volumes only if the status is 'in-use'
Currently, cinder volumes are exported both 'in-use' and 'available' after restarting cinder-volume service. This behavior was introduced following commit. commitffefe18334
Author: Zhiteng Huang <zhithuang@ebaysf.com> Date: Sat Aug 23 18:32:57 2014 +0000 If the volumes are attached to nova instances, they should be exported via tgtd after restarting cinder-volume. But the volumes which are not attached to instances must not be exported because everyone can connect these volumes. This patch changes volume export behavior that exports a volume only if the volume status is 'in-use'. Change-Id: I4c598c240b9290c81bd8001e5a0720c8c329aeb9 Signed-off-by: Mitsuhiro Tanino <mitsuhiro.tanino@hds.com> Closes-bug: #1381106 (cherry picked from commite2f28b9679
)
This commit is contained in:
parent
01e7c51685
commit
f7ee62cc58
@ -272,6 +272,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
self._count_allocated_capacity(ctxt, volume)
|
self._count_allocated_capacity(ctxt, volume)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if volume['status'] in ['in-use']:
|
||||||
self.driver.ensure_export(ctxt, volume)
|
self.driver.ensure_export(ctxt, volume)
|
||||||
except Exception as export_ex:
|
except Exception as export_ex:
|
||||||
LOG.error(_("Failed to re-export volume %s: "
|
LOG.error(_("Failed to re-export volume %s: "
|
||||||
|
Loading…
Reference in New Issue
Block a user