summaryrefslogtreecommitdiff
path: root/nova/privsep
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2017-09-27 06:54:33 +1000
committerMichael Still <mikal@stillhq.com>2017-10-23 09:36:28 +1100
commit64036a68c201275a5e83d6bbd24658d88d642e21 (patch)
treee71309349833dc40dc25bd3b11e1542e8e6b2fe9 /nova/privsep
parent02dce6fc43ff7a2f444d01369315ae0f97cf39a1 (diff)
downloadnova-64036a68c201275a5e83d6bbd24658d88d642e21.tar.gz
Move shred to privsep.
The same pattern once again, this time for shred. Change-Id: Ib6cf64d18f2ebde34030cc5b6a142af1dbf75c90 blueprint: hurrah-for-privsep
Diffstat (limited to 'nova/privsep')
-rw-r--r--nova/privsep/fs.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/privsep/fs.py b/nova/privsep/fs.py
index 28931fb01a..8137cc9d3c 100644
--- a/nova/privsep/fs.py
+++ b/nova/privsep/fs.py
@@ -76,3 +76,14 @@ def lvremove(path):
@nova.privsep.sys_admin_pctxt.entrypoint
def blockdev_size(path):
return processutils.execute('blockdev', '--getsize64', path)
+
+
+@nova.privsep.sys_admin_pctxt.entrypoint
+def clear(path, volume_size, shred=False):
+ cmd = ['shred']
+ if shred:
+ cmd.extend(['-n3'])
+ else:
+ cmd.extend(['-n0', '-z'])
+ cmd.extend(['-s%d' % volume_size, path])
+ processutils.execute(*cmd)