Clear migration_status from a destination volume if migration fails
When some error happens during volume migration, cinder-volume
keeps remaining a destination volume because the volume copy may be
in the completing phase and a source volume may be deleted already.
In this case, the migration_status of the destination volume in
data base should be cleared. As a result, the volume can be handled
properly even if volume migration is failed. If the migration is
in the migrating phase, the volume should be deleted and an entry
of database is also destroyed because the source volume is remaining.
Also there is an another problem that a source volume is remaining
as migrating status if create_export raises exception. In this case,
source volume can't be deleted even if it will be unnecessary.
This change fixes these two problems.
NOTE:
In order to backport test cases, we need to use contextlib.nested
instead of using multiple variables in "with" statement because
it is not supported at python2.6.
Closes-Bug: #1403916
Change-Id: Ie4199bc1e804e5cbbb793f448a99487f9823f1a9
(cherry picked from commit d96c40c0ab85090a83cb532090cc879c27d630d5)
Reviewed: https:/ /review. openstack. org/161328 /git.openstack. org/cgit/ openstack/ cinder/ commit/ ?id=8940579083b f5b572f88bce7d6 4a848ed823f950
Committed: https:/
Submitter: Jenkins
Branch: stable/juno
commit 8940579083bf5b5 72f88bce7d64a84 8ed823f950
Author: Mitsuhiro Tanino <email address hidden>
Date: Mon Feb 9 17:18:31 2015 -0500
Clear migration_status from a destination volume if migration fails
When some error happens during volume migration, cinder-volume
keeps remaining a destination volume because the volume copy may be
in the completing phase and a source volume may be deleted already.
In this case, the migration_status of the destination volume in
data base should be cleared. As a result, the volume can be handled
properly even if volume migration is failed. If the migration is
in the migrating phase, the volume should be deleted and an entry
of database is also destroyed because the source volume is remaining.
Also there is an another problem that a source volume is remaining
as migrating status if create_export raises exception. In this case,
source volume can't be deleted even if it will be unnecessary.
This change fixes these two problems.
NOTE:
In order to backport test cases, we need to use contextlib.nested
instead of using multiple variables in "with" statement because
it is not supported at python2.6.
Closes-Bug: #1403916 cbbb793f448a994 87f9823f1a9 a83cb532090cc87 9c27d630d5)
Change-Id: Ie4199bc1e804e5
(cherry picked from commit d96c40c0ab85090