upload-to-image does not report notimplemented error

Bug #1116077 reported by Mate Lakat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Invalid
Undecided
Unassigned

Bug Description

Given your cinder driver does not implement the copy_volume_to_image function.

If you use the cli to do the copy:

    cinder upload-to-image $VOLID imagefromvolume

The operation will not report any errors, just carry on. The image's status is queued.

+ cinder upload-to-image f1aab857-2459-419a-b7d2-527458f5a9ef imagefromvolume
+ grep imagefromvolume
+ glance image-list
| 51ae0b7f-3d6a-4b22-9a31-23b658ff7a91 | imagefromvolume | raw | bare | | queued |

I would expect to get back some error message, saying that the given operation is not implemented.

Revision history for this message
Avishay Traeger (avishay-il) wrote :

What driver are you using? What version of the code? The current code in the upcoming Grizzly release should handle that properly. I need more information to continue.

Changed in cinder:
assignee: nobody → Avishay Traeger (avishay-il)
status: New → Incomplete
Revision history for this message
Mate Lakat (mate-lakat) wrote :
Download full text (3.8 KiB)

To clarify my comment, I add the logs, and the process. Please note, that in the meanwhile, I implemented the copy_volume_to_image method in the XenAPINFS driver, and hopefully it will hit the trunk. My problem, is that when I executed the copy command, from the user's perspective, it was not visible, that the driver didn't implement this functionality. So I am not pointing to the driver, I am missing the NotImplementedError to "Bubble up to the user" (Or maybe NotImplementedError will never be visible, I should have used another exception?)

So, here is the log:

stack@DevStackOSDomU:~$ grep -e "^volume_driver" /etc/cinder/cinder.conf
volume_driver = cinder.volume.drivers.xenapi.sm.XenAPINFSDriver

stack@DevStackOSDomU:~$ grep -A 2 "copy_volume_to_image" cinder/cinder/volume/drivers/xenapi/sm.py
    def copy_volume_to_image(self, context, volume, image_service, image_meta):
        raise NotImplementedError()

grep NotImplementedError /tmp/devstack/log/screen-c-vol.log

cd devstack
. openrc admin

cinder create 1
cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 307aac80-ebe2-4afb-bcc7-56a56cc602f5 | available | None | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

cinder upload-to-image 307aac80-ebe2-4afb-bcc7-56a56cc602f5 imagefromvolume
# NOTE: I would expect some error messages here, as this operation is not imlemented (see driver)

grep -B13 -A2 NotImplementedError /tmp/devstack/log/screen-c-vol.log
2013-02-07 16:49:40.687 ERROR cinder.openstack.common.rpc.amqp [-] Exception during message handling
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp Traceback (most recent call last):
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/amqp.py", line 276, in _process_data
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp rval = self.proxy.dispatch(ctxt, version, method, **args)
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/dispatcher.py", line 145, in dispatch
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 448, in copy_volume_to_image
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp payload['message'] = unicode(error)
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp self.gen.next()
2013-02-07 16:49:40.687 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 443, in c...

Read more...

Revision history for this message
Avishay Traeger (avishay-il) wrote :

The problem here is that there is no way right now for the error to be returned. This is because the Cinder API queues a request and returns a response. Only after that does the volume manager begin to handle the request and find out that the function is not implemented. Right now, users will need to check glance for the status of the image. This is on the list of things to fix for Havana, but is part of a larger problem that will not be handled for Grizzly.

Changed in cinder:
status: Incomplete → Confirmed
Changed in cinder:
assignee: Avishay Traeger (avishay-il) → nobody
Revision history for this message
Avishay Traeger (avishay-il) wrote :

I misunderstood before - I guess you meant that it isn't clear enough in the logs. That should be fixed.

Revision history for this message
Swapnil Kulkarni (coolsvap-deactivatedaccount) wrote :

I tried to reproduce the issue on devstack/master by adding raise NotImplementedError() in lvm.py#288 and I am getting the error message in c-vol logs.

2014-01-07 13:11:19.823 ERROR cinder.openstack.common.rpc.amqp [req-c447b00e-4422-4994-88f9-9d395a033d86 742926b4656342d1a17e2169f0d443d5 7444434cde464
84ba02c9a502e2175a8] Exception during message handling
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp Traceback (most recent call last):
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/amqp.py", line 441, in _process_da
ta
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp **args)
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/dispatcher.py", line 148, in dispatch
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/utils.py", line 818, in wrapper
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp return func(self, *args, **kwargs)
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 668, in copy_volume_to_image
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp payload['message'] = unicode(error)
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp self.gen.next()
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 662, in copy_volume_to_image
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp image_meta)
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/drivers/lvm.py", line 288, in copy_volume_to_image
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp raise NotImplementedError()
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp NotImplementedError
2014-01-07 13:11:19.823 TRACE cinder.openstack.common.rpc.amqp

I think it would be driver owner who should log any appropriate message before raising NotImplementedError.

Revision history for this message
Swapnil Kulkarni (coolsvap-deactivatedaccount) wrote :

This is no longer an issue with code, being said that raising "NotImplementedError()" on a core api function is typiclly not allowed. The reason to this is the manager and api (or taskflow at this point) should be looking for a handful of exceptions, rather than add every possible exception imaginable. VolumeBackend and VolumeBackendAPI should be two parent class exceptions that all drivers exceptions are inherrited from and are recommended to be used throughout.

Changed in cinder:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.