Don't let dlt_vopt exceptions bubble up in CreateAndConnectCfgDrive reversion
If dlt_vopt raises an exception in the reversion flow, it will mask the original error in spawn which prompted the reversion. Closes-Bug: #1674383 Change-Id: I6206e891c6a1df142f4438bef6776b01bd72e2dc
This commit is contained in:
parent
1219c8a4a4
commit
59d3164bd8
@ -58,6 +58,13 @@ class TestStorage(test.TestCase):
|
||||
|
||||
self.mock_mb.reset_mock()
|
||||
|
||||
# Revert when dlt_vopt fails
|
||||
self.mock_mb.dlt_vopt.side_effect = Exception('fake-exc')
|
||||
task.revert(lpar_w, 'mgmt_cna', 'result', 'flow_failures')
|
||||
self.mock_mb.dlt_vopt.assert_called_once_with(lpar_w.uuid)
|
||||
|
||||
self.mock_mb.reset_mock()
|
||||
|
||||
# With a specified FeedTask
|
||||
task = tf_stg.CreateAndConnectCfgDrive(
|
||||
self.adapter, 'host_uuid', self.instance, 'injected_files',
|
||||
|
@ -14,6 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from pypowervm.tasks import scsi_mapper as pvm_smap
|
||||
|
||||
from oslo_log import log as logging
|
||||
@ -394,8 +396,13 @@ class CreateAndConnectCfgDrive(pvm_task.PowerVMTask):
|
||||
if self.mb is None:
|
||||
return
|
||||
|
||||
# Delete the virtual optical media
|
||||
# Delete the virtual optical media. If it fails we don't care.
|
||||
try:
|
||||
self.mb.dlt_vopt(lpar_wrap.uuid)
|
||||
except Exception as e:
|
||||
LOG.warning(_LW('Vopt removal as part of spawn reversion failed '
|
||||
'with: %(exc)s'), {'exc': six.text_type(e)},
|
||||
instance=self.instance)
|
||||
|
||||
|
||||
class DeleteVOpt(pvm_task.PowerVMTask):
|
||||
|
Loading…
Reference in New Issue
Block a user