Remove check_detach

As part of cleaning up the Nova code base around the Cinder
interaction snippets check_attach was recently removed as Cinder
keeps track of the volume state and performs the necessary checks.
To move forward with the code clean up the other half of these checks
check_detach is proposed for removal due to the same reason.

As we are now introducing the new Cinder attach/detach API in Nova
it is important to make it as straight forward as possible and use
this as an opportunity to clean up the code and remove the parts we
don't need anymore. As part of this activity we are working on to
be able to support volume multi-attach, which will be easier if each
service has their own set of responsibilities.

This patch also handles error translation by catching
InvalidInput exception and raising InvalidVolume to match the former
error handling.

check_detach could also raise VolumeUnattached exception which was
added in preparation to multi-attach support. In case of normal
attach we will hit InvalidVolume before VolumeUnattached, therefore
it is safe to remove that for now. VolumeUnattached is also fully
removed from the code now to stop the status check on volumes
on the Nova side completely.

Change-Id: If63dbd236ce0970ea245707cacb2664e3fdbdfd1
This commit is contained in:
Ildiko Vancsa 2017-03-16 15:37:58 +01:00
parent 3abbfa54c2
commit 9267767311

@ -1351,10 +1351,6 @@ class CinderFixture(fixtures.Fixture):
self.test.stub_out('nova.volume.cinder.API.begin_detaching',
lambda *args, **kwargs: None)
self.test.stub_out('nova.volume.cinder.API.check_attach',
lambda *args, **kwargs: None)
self.test.stub_out('nova.volume.cinder.API.check_detach',
lambda *args, **kwargs: None)
self.test.stub_out('nova.volume.cinder.API.get',
fake_get)
self.test.stub_out('nova.volume.cinder.API.initialize_connection',