Fix ceph incremental backup fail

Cinder _rbd_diff_transfer() uses "import-diff" and "export-diff" cmdline
to do a incremental backup, it will fail without a ceph-conf file. Delay
to delete temporary ceph-conf file in class RBDConnector during ceph
volume backup.

Change-Id: Ib74c85266b8c812f7a40dac293847a28768eae9a
Partial-Bug: #1578036
This commit is contained in:
Xiaojun Liao 2017-06-22 19:54:01 +08:00
parent 455acbbcf1
commit 1fe844efaf

View File

@ -120,8 +120,9 @@ class RBDConnector(base.BaseLinuxConnector):
rbd_volume = linuxrbd.RBDVolume(rbd_client, volume) rbd_volume = linuxrbd.RBDVolume(rbd_client, volume)
rbd_handle = linuxrbd.RBDVolumeIOWrapper( rbd_handle = linuxrbd.RBDVolumeIOWrapper(
linuxrbd.RBDImageMetadata(rbd_volume, pool, user, conf)) linuxrbd.RBDImageMetadata(rbd_volume, pool, user, conf))
finally: except Exception:
fileutils.delete_if_exists(conf) fileutils.delete_if_exists(conf)
raise
return rbd_handle return rbd_handle
@ -223,6 +224,7 @@ class RBDConnector(base.BaseLinuxConnector):
if device_info: if device_info:
rbd_handle = device_info.get('path', None) rbd_handle = device_info.get('path', None)
if rbd_handle is not None: if rbd_handle is not None:
fileutils.delete_if_exists(rbd_handle.rbd_conf)
rbd_handle.close() rbd_handle.close()
def check_valid_device(self, path, run_as_root=True): def check_valid_device(self, path, run_as_root=True):