From d873538ec84d9c9cea8b0564b2a9cfed3ece048f Mon Sep 17 00:00:00 2001 From: Vincent Hou Date: Mon, 13 Apr 2015 11:20:35 +0800 Subject: [PATCH] Remove the export creation during volume creation for migration Since create_export was moved from create_volume to initialize_connection, the migrate_volume part should change accordingly. Change-Id: I42637c5d861670fb125e78918c2b5b2b13ea43d4 Closes-bug: #1278289 --- cinder/volume/drivers/lvm.py | 4 +--- cinder/volume/manager.py | 22 ++-------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 9b4d0465e..6208fbab4 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -557,7 +557,6 @@ class LVMVolumeDriver(driver.VolumeDriver): executor=self._execute, lvm_conf=lvm_conf_file) - self.remove_export(ctxt, volume) self._create_volume(volume['name'], self._sizestr(volume['size']), lvm_type, @@ -570,9 +569,8 @@ class LVMVolumeDriver(driver.VolumeDriver): self.configuration.volume_dd_blocksize, execute=self._execute) self._delete_volume(volume) - model_update = self.create_export(ctxt, volume, vg=dest_vg) - return (True, model_update) + return (True, None) else: message = (_("Refusing to migrate volume ID: %(id)s. Please " "check your configuration because source and " diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 3adfa8c83..cf43b6518 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -1449,16 +1449,7 @@ class VolumeManager(manager.SchedulerDependentManager): updates = {'migration_status': None} if status_update: updates.update(status_update) - try: - model_update = self.driver.create_export(ctxt, - volume_ref) - if model_update: - updates.update(model_update) - except Exception: - LOG.exception(_LE("Failed to create export for " - "volume: %s"), volume_ref['id']) - finally: - self.db.volume_update(ctxt, volume_ref['id'], updates) + self.db.volume_update(ctxt, volume_ref['id'], updates) if not moved: try: self._migrate_volume_generic(ctxt, volume_ref, host, @@ -1468,16 +1459,7 @@ class VolumeManager(manager.SchedulerDependentManager): updates = {'migration_status': None} if status_update: updates.update(status_update) - try: - model_update = self.driver.create_export(ctxt, - volume_ref) - if model_update: - updates.update(model_update) - except Exception: - LOG.exception(_LE("Failed to create export for " - "volume: %s"), volume_ref['id']) - finally: - self.db.volume_update(ctxt, volume_ref['id'], updates) + self.db.volume_update(ctxt, volume_ref['id'], updates) @periodic_task.periodic_task def _report_driver_status(self, context): -- 2.45.2