]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerLoic Dachary <ldachary@redhat.com>
Wed, 26 Oct 2016 09:29:40 +0000 (11:29 +0200)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
(cherry picked from commit d290454cf5f660c1681eefd70a38e79da683525f)

src/ceph-disk/ceph_disk/main.py

index 9f4a2f03a0b019555dd9e8f30a6e804432bcb43b..f81425f9c902c3c3341a00fc7c512b13484cead5 100755 (executable)
@@ -1990,21 +1990,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