From dd88e7d72a91f9a9cb298004bd6b4f90b89d2590 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Wed, 29 Feb 2012 23:11:29 +0100 Subject: [PATCH] dom0: fix qvm-grow-private (#459) --- dom0/qvm-core/qubes.py | 8 ++++---- dom0/qvm-tools/qvm-grow-private | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 0bf293ce..dd844013 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -664,7 +664,7 @@ class QubesVm(object): retcode = 0 if self.is_running(): # find loop device - p = subprocess.Popen (["losetup", "--associated", vm.private_img], + p = subprocess.Popen (["sudo", "losetup", "--associated", self.private_img], stdout=subprocess.PIPE) result = p.communicate() m = re.match(r"^(/dev/loop\d+):\s", result[0]) @@ -676,10 +676,10 @@ class QubesVm(object): # resize loop device subprocess.check_call(["sudo", "losetup", "--set-capacity", loop_dev]) - retcode = self.run("root:while [ \"`blockdev --getsize64 /dev/xvdb`\" -lt {0} ]; do " + - "head /dev/xvdb > /dev/null; sleep 0.2; done; resize2fs /dev/xvdb".format(size_bytes), wait=True) + retcode = self.run("root:while [ \"`blockdev --getsize64 /dev/xvdb`\" -lt {0} ]; do ".format(size) + + "head /dev/xvdb > /dev/null; sleep 0.2; done; resize2fs /dev/xvdb", wait=True) else: - retcode = subprocess.check_call(["sudo", "resize2fs", "-f", vm.private_img]) + retcode = subprocess.check_call(["sudo", "resize2fs", "-f", self.private_img]) if retcode != 0: raise QubesException("resize2fs failed") diff --git a/dom0/qvm-tools/qvm-grow-private b/dom0/qvm-tools/qvm-grow-private index 77182938..c144adab 100755 --- a/dom0/qvm-tools/qvm-grow-private +++ b/dom0/qvm-tools/qvm-grow-private @@ -22,7 +22,7 @@ from qubes.qubes import QubesVmCollection from qubes.qubes import QubesException -from qubesutils import parse_size +from qubes.qubesutils import parse_size from optparse import OptionParser import subprocess import os