Merge remote-tracking branch 'origin/pr/149'

* origin/pr/149:
  Add admin.vm.volume.Clear call (QubesOS/qubes-issues#5946)
This commit is contained in:
Marek Marczykowski-Górecki 2020-07-16 04:05:38 +02:00
commit 4da218c332
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
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):