Revision b6765b7e image_creator/disk.py

b/image_creator/disk.py
174 174
        snapshot = uuid.uuid4().hex
175 175
        tablefd, table = tempfile.mkstemp()
176 176
        try:
177
            os.write(tablefd, "0 %d snapshot %s %s n 8" %
178
                              (int(size), sourcedev, cowdev))
177
            try:
178
                os.write(tablefd, "0 %d snapshot %s %s n 8" %
179
                                  (int(size), sourcedev, cowdev))
180
            finally:
181
                os.close(tablefd)
182

  
179 183
            dmsetup('create', snapshot, table)
180 184
            self._add_cleanup(try_fail_repeat, dmsetup, 'remove', snapshot)
181

  
182 185
        finally:
183 186
            os.unlink(table)
184 187
        self.out.success('done')

Also available in: Unified diff