deploy: fix: remove storage files during cleanup 47/22447/1
authorStefan Sicleru <stefan.sicleru@enea.com>
Mon, 26 Sep 2016 12:09:09 +0000 (14:09 +0200)
committerStefan Sicleru <stefan.sicleru@enea.com>
Mon, 26 Sep 2016 12:27:23 +0000 (14:27 +0200)
Remove old disks through virsh instead of calling os.delete()
methods so that the cleanup phase would succeed within a non-root
setup. [1]

Related-bug: ARMBAND-128

[1] https://gerrit.opnfv.org/gerrit/#/c/19491/

Change-Id: I90007edf014c7e15a68b9a334fcaffaa127ee4ab
Signed-off-by: Stefan Sicleru <stefan.sicleru@enea.com>
deploy/environments/execution_environment.py

index af0e130..3812902 100644 (file)
@@ -46,9 +46,7 @@ class ExecutionEnvironment(object):
                     disk_files.append(source_file)
         log('Deleting VM %s with disks %s' % (vm_name, disk_files))
         exec_cmd('virsh destroy %s' % vm_name, False)
-        exec_cmd('virsh undefine %s' % vm_name, False)
-        for file in disk_files:
-            delete(file)
+        exec_cmd('virsh undefine --managed-save --remove-all-storage %s' % vm_name, False)
 
     def overwrite_xml(self, vm_xml, vm_definition_overwrite):
         if not vm_definition_overwrite: