diff --git a/nova_powervm/tests/virt/powervm/tasks/test_storage.py b/nova_powervm/tests/virt/powervm/tasks/test_storage.py index e128a3f4..25c86bc7 100644 --- a/nova_powervm/tests/virt/powervm/tasks/test_storage.py +++ b/nova_powervm/tests/virt/powervm/tasks/test_storage.py @@ -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', diff --git a/nova_powervm/virt/powervm/tasks/storage.py b/nova_powervm/virt/powervm/tasks/storage.py index ad35c2bb..bc020b8a 100644 --- a/nova_powervm/virt/powervm/tasks/storage.py +++ b/nova_powervm/virt/powervm/tasks/storage.py @@ -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 - self.mb.dlt_vopt(lpar_wrap.uuid) + # 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):