Merge "Fix fallocate test on newer util-linux"

This commit is contained in:
Jenkins 2016-02-10 13:21:21 +00:00 committed by Gerrit Code Review
commit 8615de1bb7
2 changed files with 4 additions and 4 deletions

View File

@ -115,7 +115,7 @@ class _ImageTestCase(object):
image.cache(fake_fetch, self.TEMPLATE_PATH, self.SIZE)
self.assertEqual(fake_processutils.fake_execute_get_log(),
['fallocate -n -l 1 %s.fallocate_test' % self.PATH,
['fallocate -l 1 %s.fallocate_test' % self.PATH,
'fallocate -n -l %s %s' % (self.SIZE, self.PATH),
'fallocate -n -l %s %s' % (self.SIZE, self.PATH)])

View File

@ -264,9 +264,9 @@ class Image(object):
"""
can_fallocate = getattr(self.__class__, 'can_fallocate', None)
if can_fallocate is None:
_out, err = utils.trycmd('fallocate', '-n', '-l', '1',
self.path + '.fallocate_test')
fileutils.delete_if_exists(self.path + '.fallocate_test')
test_path = self.path + '.fallocate_test'
_out, err = utils.trycmd('fallocate', '-l', '1', test_path)
fileutils.delete_if_exists(test_path)
can_fallocate = not err
self.__class__.can_fallocate = can_fallocate
if not can_fallocate: