Skip to content

Commit

Permalink
Call df with -k instead of -B1
Browse files Browse the repository at this point in the history
Fix bug 893840

Change-Id: Ibdb5fe364f3ce086ee198d90f3593f3852fe2c97
  • Loading branch information
Lorin Hochstein committed Nov 23, 2011
1 parent b300964 commit bbbd489
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions nova/tests/test_libvirt.py
Expand Up @@ -1844,14 +1844,17 @@ def test_run_ajaxterm(self):
libvirt_utils.run_ajaxterm(shell_cmd, token, port)

def test_get_fs_info(self):
stdout, stderr = utils.execute('df', '-B1', '/tmp')
# Use a 1024-byte block size (df -k) because OS X does not support
# the -B flag
blocksize = 1024
stdout, stderr = utils.execute('df', '-k', '/tmp')
info_line = ' '.join(stdout.split('\n')[1:])
_dev, total, used, free, _percentage, _mntpnt = info_line.split()

fs_info = libvirt_utils.get_fs_info('/tmp')
self.assertEquals(int(total), fs_info['total'])
self.assertEquals(int(free), fs_info['free'])
self.assertEquals(int(used), fs_info['used'])
self.assertEquals(int(total) * blocksize, fs_info['total'])
self.assertEquals(int(free) * blocksize, fs_info['free'])
self.assertEquals(int(used) * blocksize, fs_info['used'])

def test_fetch_image(self):
self.mox.StubOutWithMock(images, 'fetch')
Expand Down

0 comments on commit bbbd489

Please sign in to comment.