From: Anirudha Bose Date: Wed, 17 Aug 2016 06:45:25 +0000 (+0530) Subject: ceph-disk: Set space_symlink to the path, not file object X-Git-Tag: v11.0.1~300^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d290454cf5f660c1681eefd70a38e79da683525f;p=ceph-ci.git ceph-disk: Set space_symlink to the path, not file object Signed-off-by: Anirudha Bose --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 7bc1aaf1b8e..a252cb48be2 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -1975,21 +1975,22 @@ class PrepareSpace(object): raise Error('unexpected type ', self.type) def prepare_file(self): - if not os.path.exists(getattr(self.args, self.name)): + space_filename = getattr(self.args, self.name) + if not os.path.exists(space_filename): LOG.debug('Creating %s file %s with size 0' ' (ceph-osd will resize and allocate)', self.name, - getattr(self.args, self.name)) - with open(getattr(self.args, self.name), 'wb') as space_file: - pass + space_filename) + space_file = open(space_filename, 'wb') + space_file.close() LOG.debug('%s is file %s', self.name.capitalize(), - getattr(self.args, self.name)) + space_filename) LOG.warning('OSD will not be hot-swappable if %s is ' 'not the same device as the osd data' % self.name) - self.space_symlink = space_file + self.space_symlink = space_filename def prepare_device(self): reusing_partition = False