Merge "Run_as_root to ensure resize2fs succeed for all image backends"

This commit is contained in:
Jenkins 2013-01-23 13:09:13 +00:00 committed by Gerrit Code Review
commit d3819e1244
4 changed files with 11 additions and 5 deletions

View File

@ -99,9 +99,11 @@ pygrub: CommandFilter, /usr/bin/pygrub, root
fdisk: CommandFilter, /sbin/fdisk, root
# nova/virt/xenapi/vm_utils.py: e2fsck, -f, -p, partition_path
# nova/virt/disk/api.py: e2fsck, -f, -p, image
e2fsck: CommandFilter, /sbin/e2fsck, root
# nova/virt/xenapi/vm_utils.py: resize2fs, partition_path
# nova/virt/disk/api.py: resize2fs, image
resize2fs: CommandFilter, /sbin/resize2fs, root
# nova/network/linux_net.py: 'ip[6]tables-save' % (cmd, '-t', ...

View File

@ -273,7 +273,7 @@ class LvmTestCase(_ImageTestCase, test.TestCase):
cmd = ('dd', 'if=%s' % self.TEMPLATE_PATH,
'of=%s' % self.PATH, 'bs=4M')
self.utils.execute(*cmd, run_as_root=True)
self.disk.resize2fs(self.PATH)
self.disk.resize2fs(self.PATH, run_as_root=True)
self.mox.ReplayAll()
image = self.image_class(self.INSTANCE, self.NAME)

View File

@ -96,9 +96,13 @@ def mkfs(os_type, fs_label, target):
utils.execute(*mkfs_command.split())
def resize2fs(image, check_exit_code=False):
utils.execute('e2fsck', '-fp', image, check_exit_code=check_exit_code)
utils.execute('resize2fs', image, check_exit_code=check_exit_code)
def resize2fs(image, check_exit_code=False, run_as_root=False):
utils.execute('e2fsck', '-fp', image,
check_exit_code=check_exit_code,
run_as_root=run_as_root)
utils.execute('resize2fs', image,
check_exit_code=check_exit_code,
run_as_root=run_as_root)
def get_disk_size(path):

View File

@ -228,7 +228,7 @@ class Lvm(Image):
cmd = ('dd', 'if=%s' % base, 'of=%s' % self.path, 'bs=4M')
utils.execute(*cmd, run_as_root=True)
if resize:
disk.resize2fs(self.path)
disk.resize2fs(self.path, run_as_root=True)
generated = 'ephemeral_size' in kwargs