Can the "sg_scan" command be added to cinder/etc/cinder/rootwrap.d/volume.filters?
When writing a FibreChannel driver based off FibreChannelDriver (cinder/cinder/volume/driver.py), we have noticed that its FibreChannelConnector (cinder/cinder/brick/initiator/connector.py) requires the command 'sg_scan' to be run under rootwrap - please see LinuxSCSI.get_device_info() in cinder/cinder/brick/initiator/linuxscsi.py. However, the "sg_scan" command is not currently included in cinder/etc/cinder/rootwrap.d/volume.filters.
We're running on Ubuntu 12.04.2 LTS. We're able to work around this by adding the following line in volume.filters:
sg_scan: CommandFilter, sg_scan, root
Or otherwise copy-image-to-volume will fail with the following exception in c-vol:
2013-09-12 15:08:53.128 ERROR cinder.volume.flows.create_volume [req-90f8046b-1172-487c-be80-e1c8c9a3b83c 58e14aa35101428fbc5db095a3739ac1 a454d1b3093e40e6ac74975a31c84a8c] Failed to copy image 357
fa7ae-65df-4a91-9864-4e2117b43ca1 to volume: add3ec29-93fa-45f1-ae76-c618a9934b91, error:
...
2013-09-12 15:08:53.165 ERROR cinder.volume.flows.create_volume [req-90f8046b-1172-487c-be80-e1c8c9a3b83c 58e14aa35101428fbc5db095a3739ac1 a454d1b3093e40e6ac74975a31c84a8c] Volume add3ec29-93fa-45f
1-ae76-c618a9934b91: create failed
2013-09-12 15:08:53.166 ERROR cinder.volume.flows.create_volume [req-90f8046b-1172-487c-be80-e1c8c9a3b83c 58e14aa35101428fbc5db095a3739ac1 a454d1b3093e40e6ac74975a31c84a8c] Unexpected build error:
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume Traceback (most recent call last):
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume File "/opt/stack/cinder/cinder/taskflow/patterns/linear_flow.py", line 172, in run_it
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume result = runner(context, *args, **kwargs)
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume File "/opt/stack/cinder/cinder/taskflow/utils.py", line 260, in __call__
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume self.result = self.task(*args, **kwargs)
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1441, in __call__
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume **volume_spec)
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1410, in _create_from_image
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume image_id, image_location, image_service)
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1315, in _copy_image_to_volume
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume raise exception.ImageCopyFailure(reason=ex.stderr)
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume ImageCopyFailure: Failed to copy image to volume:
2013-09-12 15:08:53.166 TRACE cinder.volume.flows.create_volume
2013-09-12 15:08:53.167 DEBUG cinder.taskflow.utils [-] Calling rollback 5: cinder.volume.flows.base.InjectTask;volume:create==1.0 from (pid=13183) rollback /opt/stack/cinder/cinder/taskflow/utils.
py:351
2013-09-12 15:08:53.167 DEBUG cinder.volume.flows.utils [req-90f8046b-1172-487c-be80-e1c8c9a3b83c 58e14aa35101428fbc5db095a3739ac1 a454d1b3093e40e6ac74975a31c84a8c] LinearFlow: volume_create_manage
r; f-99160f90-8220-48a3-8045-8a2ca0b59469; 6; 0; FAILURE has moved into state FAILURE from state REVERTING from (pid=13183) flow_log_change /opt/stack/cinder/cinder/volume/flows/utils.py:41
2013-09-12 15:08:53.168 ERROR cinder.openstack.common.rpc.amqp [req-90f8046b-1172-487c-be80-e1c8c9a3b83c 58e14aa35101428fbc5db095a3739ac1 a454d1b3093e40e6ac74975a31c84a8c] Exception during message handling
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp Traceback (most recent call last):
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/amqp.py", line 441, in _process_data
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp **args)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/dispatcher.py", line 148, in dispatch
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 222, in create_volume
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp flow.run(context.elevated())
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/taskflow/decorators.py", line 105, in wrapper
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp return f(self, *args, **kwargs)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/taskflow/patterns/linear_flow.py", line 232, in run
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp run_it(r)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/taskflow/patterns/linear_flow.py", line 212, in run_it
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp self.rollback(context, cause)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp self.gen.next()
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/taskflow/patterns/linear_flow.py", line 172, in run_it
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp result = runner(context, *args, **kwargs)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/taskflow/utils.py", line 260, in __call__
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp self.result = self.task(*args, **kwargs)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1441, in __call__
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp **volume_spec)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1410, in _create_from_image
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp image_id, image_location, image_service)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/flows/create_volume/__init__.py", line 1315, in _copy_image_to_volume
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp raise exception.ImageCopyFailure(reason=ex.stderr)
2013-09-12 15:08:53.168 TRACE cinder.openstack.common.rpc.amqp ImageCopyFailure: Failed to copy image to volume:
Fix proposed to branch: master /review. openstack. org/47741
Review: https:/