Add admin.vm.volume.Clear call (QubesOS/qubes-issues#5946)

This commit is contained in:
WillyPillow 2020-07-14 01:48:19 +08:00
parent ae39c75867
commit 455542ac7f
No known key found for this signature in database
GPG Key ID: 3839E194B1415A9C
2 changed files with 5 additions and 2 deletions

View File

@ -236,6 +236,10 @@ class Volume(object):
'ImportWithSize', payload=size_line.encode(), 'ImportWithSize', payload=size_line.encode(),
payload_stream=stream) payload_stream=stream)
def clear_data(self):
''' Clear existing volume content. '''
self._qubesd_call('Clear')
def clone(self, source): def clone(self, source):
''' Clone data from sane volume of another VM. ''' Clone data from sane volume of another VM.

View File

@ -124,8 +124,7 @@ def import_root_img(vm, source_dir):
def reset_private_img(vm): def reset_private_img(vm):
'''Clear private volume''' '''Clear private volume'''
with open('/dev/null', 'rb') as null: vm.volumes['private'].clear_data()
vm.volumes['private'].import_data(stream=null)
def import_appmenus(vm, source_dir): def import_appmenus(vm, source_dir):