From a5e575618c8056350300c103ea9377b7cde4d403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 18 Aug 2016 11:46:26 +0200 Subject: [PATCH] qubes-lvm: drop sudo from lvm calls The script is already running as root QubesOS/qubes-issues#2256 --- qubes/tools/qubes_lvm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qubes/tools/qubes_lvm.py b/qubes/tools/qubes_lvm.py index e857a569..33b4ef4e 100644 --- a/qubes/tools/qubes_lvm.py +++ b/qubes/tools/qubes_lvm.py @@ -75,7 +75,7 @@ def remove_volume(args): tries = 1 successful = False - cmd = ['sudo', 'lvremove', '-f', img] + cmd = ['lvremove', '-f', img] while tries <= 3 and not successful: log.info("Trying to remove LVM %s", img) @@ -100,7 +100,7 @@ def clone_volume(args): """ Calls lvcreate and creates new snapshot. """ old = args.source new_name = args.destination - cmd = ["sudo", "lvcreate", "-kn", "-ay", "-s", old, "-n", new_name] + cmd = ["lvcreate", "-kn", "-ay", "-s", old, "-n", new_name] return subprocess.call(cmd) @@ -112,7 +112,7 @@ def new_volume(args): size = args.size log.info('Creating new Thin LVM %s in %s VG %s bytes', name, thin_pool, size) - cmd = ['sudo', 'lvcreate', '-T', thin_pool, '-kn', '-ay', '-n', name, '-V', + cmd = ['lvcreate', '-T', thin_pool, '-kn', '-ay', '-n', name, '-V', str(size) + 'B'] return subprocess.call(cmd) @@ -121,7 +121,7 @@ def new_volume(args): def rename_volume(old_name, new_name): ''' Rename volume ''' log.debug("Renaming LVM %s to %s ", old_name, new_name) - retcode = subprocess.call(["sudo", "lvrename", old_name, new_name]) + retcode = subprocess.call(["lvrename", old_name, new_name]) if retcode != 0: raise IOError("Error renaming LVM %s to %s " % (old_name, new_name)) return new_name