summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/nova/rootwrap.d/compute.filters2
-rw-r--r--nova/tests/test_imagebackend.py2
-rw-r--r--nova/virt/disk/api.py10
-rw-r--r--nova/virt/libvirt/imagebackend.py2
4 files changed, 11 insertions, 5 deletions
diff --git a/etc/nova/rootwrap.d/compute.filters b/etc/nova/rootwrap.d/compute.filters
index f344a1b1c..e1113a9e7 100644
--- a/etc/nova/rootwrap.d/compute.filters
+++ b/etc/nova/rootwrap.d/compute.filters
@@ -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', ...
diff --git a/nova/tests/test_imagebackend.py b/nova/tests/test_imagebackend.py
index a9865cb44..495e7c947 100644
--- a/nova/tests/test_imagebackend.py
+++ b/nova/tests/test_imagebackend.py
@@ -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)
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index 26fb86f1e..d080f6d36 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -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):
diff --git a/nova/virt/libvirt/imagebackend.py b/nova/virt/libvirt/imagebackend.py
index d272e408c..0815c142f 100644
--- a/nova/virt/libvirt/imagebackend.py
+++ b/nova/virt/libvirt/imagebackend.py
@@ -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