読者です 読者をやめる 読者になる 読者になる

Cinderで管理しているVolumeが削除できない(RDO版 python-cinder-2014.1-2.el7.noarch)

ボリュームが消せない...

cinderコマンドやhorizonからボリュームを削除しようとするとerror_deletingのまま削除できない現象に当たったので調べてみた。

エラーメッセージ(/var/log/cinder/volume.log)

cinderのボリュームノードでは以下のログが出力されている。

2014-09-04 13:40:57.017 18535 WARNING cinder.context [-] Arguments dropped when creating context: {'user': u'299a108b970b4407af22
b8da11ad3e6c', 'tenant': u'f537390fb838414082c266d476897231', 'user_identity': u'299a108b970b4407af22b8da11ad3e6c f537390fb838414
082c266d476897231 - - -'}
2014-09-04 13:40:57.084 18535 ERROR oslo.messaging.rpc.dispatcher [req-a7d9b1b8-19b5-4fc2-9ee3-3172c862acde 299a108b970b4407af22b
8da11ad3e6c f537390fb838414082c266d476897231 - - -] Exception during message handling: No target id found for volume 5f3e641b-a7b
2-407f-a239-cf63d1124106.
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dis
patcher.py", line 133, in _dispatch_and_reply
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     incoming.message))
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dis
patcher.py", line 176, in _dispatch
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     return self._do_dispatch(endpoint, method, ctxt, args)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dis
patcher.py", line 122, in _do_dispatch
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     result = getattr(endpoint, method)(ctxt, **new_args)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 144, in lvo_inner1
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     return lvo_inner2(inst, context, volume_id, **kwargs)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/openstack/common/lockutils.py", line 233, in inner
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     retval = f(*args, **kwargs)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 143, in lvo_inner2
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     return f(*_args, **_kwargs)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 416, in delete_volume
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     {'status': 'error_deleting'})
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/openstack/common/excutils.py", line 68, in __exit__
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     six.reraise(self.type_, self.value, self.tb)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 400, in delete_volume
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     self.driver.remove_export(context, volume_ref)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py", line 540, in remove_export
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     self.target_helper.remove_export(context, volume)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/iscsi.py", line 232, in remove_export
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     volume['id'])
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/db/api.py", line 234, in volume_get_iscsi_target_num
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     return IMPL.volume_get_iscsi_target_num(context, volume_id)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 119, in wrapper
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     return f(*args, **kwargs)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 1344, in volume_get_iscsi_target_num
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher     raise exception.ISCSITargetNotFoundForVolume(volume_id=volume_id)
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher ISCSITargetNotFoundForVolume: No target id found for volume 5f3e641b-a7b2-407f-a239-cf63d1124106.
2014-09-04 13:40:57.084 18535 TRACE oslo.messaging.rpc.dispatcher
2014-09-04 13:40:57.089 18535 ERROR oslo.messaging._drivers.common [req-a7d9b1b8-19b5-4fc2-9ee3-3172c862acde 299a108b970b4407af22b8da11ad3e6c f537390fb838414082c266d476897231 - - -] Returning exception No target id found for volume 5f3e641b-a7b2-407f-a239-cf63d1124106. to caller
2014-09-04 13:40:57.090 18535 ERROR oslo.messaging._drivers.common [req-a7d9b1b8-19b5-4fc2-9ee3-3172c862acde 299a108b970b4407af22b8da11ad3e6c f537390fb838414082c266d476897231 - - -] ['Traceback (most recent call last):\n', '  File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply\n    incoming.message))\n', '  File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch\n    return self._do_dispatch(endpoint, method, ctxt, args)\n', '  File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 122, in _do_dispatch\n    result = getattr(endpoint, method)(ctxt, **new_args)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 144, in lvo_inner1\n    return lvo_inner2(inst, context, volume_id, **kwargs)\n', '  File "/usr/lib/python2.7/site-packages/cinder/openstack/common/lockutils.py", line 233, in inner\n    retval = f(*args, **kwargs)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 143, in lvo_inner2\n    return f(*_args, **_kwargs)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 416, in delete_volume\n    {\'status\': \'error_deleting\'})\n', '  File "/usr/lib/python2.7/site-packages/cinder/openstack/common/excutils.py", line 68, in __exit__\n    six.reraise(self.type_, self.value, self.tb)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 400, in delete_volume\n    self.driver.remove_export(context, volume_ref)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py", line 540, in remove_export\n    self.target_helper.remove_export(context, volume)\n', '  File "/usr/lib/python2.7/site-packages/cinder/volume/iscsi.py", line 232, in remove_export\n    volume[\'id\'])\n', '  File "/usr/lib/python2.7/site-packages/cinder/db/api.py", line 234, in volume_get_iscsi_target_num\n    return IMPL.volume_get_iscsi_target_num(context, volume_id)\n', '  File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 119, in wrapper\n    return f(*args, **kwargs)\n', '  File "/usr/lib/python2.7/site-packages/cinder/db/sqlalchemy/api.py", line 1344, in volume_get_iscsi_target_num\n    raise exception.ISCSITargetNotFoundForVolume(volume_id=volume_id)\n', 'ISCSITargetNotFoundForVolume: No target id found for volume 5f3e641b-a7b2-407f-a239-cf63d1124106.\n']

調べてみる...

どうやらコレを引き当てている様子

1084046 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1084046
  cinder: can't delete a volume (raise exception.ISCSITargetNotFoundForVolume)

launchpadでも報告されている

cinder-2014.1.1では修正されるみたい ということで、

にある通り、パッチを当てて無事削除できるようになりました

--- /usr/lib/python2.7/site-packages/cinder/volume/iscsi.py.org  2014-04-22 05:09:40.000000000 +0900
+++ /usr/lib/python2.7/site-packages/cinder/volume/iscsi.py 2014-09-04 15:29:37.916931574 +0900
@@ -19,6 +19,7 @@
 from oslo.config import cfg

 from cinder.brick import exception
+from cinder import exception
 from cinder.brick.iscsi import iscsi
 from cinder.openstack.common.gettextutils import _
 from cinder.openstack.common import log as logging