Only delete VM disks that are under our control

This commit is contained in:
Tom Marshall 2021-04-28 17:15:15 -07:00
parent 3c8520f1f0
commit d03badf41f
1 changed files with 2 additions and 1 deletions

3
vmmd
View File

@ -1835,7 +1835,8 @@ class HttpClientRequestHandler(http.server.BaseHTTPRequestHandler):
vms_table.update(vm)
if args['action'][0] == 'Delete':
if not vm_running:
file_delete(vm['diskpath'])
if vm['diskpath'].startswith(config['disk.storage.location']):
file_delete(vm['diskpath'])
vms_table.delete(vm)
self._send_response(302, {'Location': '/ui/vm'}, None)
else: