]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-disk: Set space_symlink to the path, not file object
authorAnirudha Bose <ani07nov@gmail.com>
Wed, 17 Aug 2016 06:45:25 +0000 (12:15 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Wed, 17 Aug 2016 07:34:32 +0000 (13:04 +0530)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
src/ceph-disk/ceph_disk/main.py

index 7bc1aaf1b8eb82fc4ac64ae4e07bca030f04112c..a252cb48be299481945e593a9df504af003f79cd 100755 (executable)
@@ -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