From aa912dc6691fba23c0827108f6a20296942e1ac0 Mon Sep 17 00:00:00 2001
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Mon, 10 Oct 2016 18:58:28 +0200
Subject: [PATCH] deploy: Fix: remove storage files explicitly

Previous change [1] tried to move the responsibility of removing
storage files (raw, iso) from our python scripts to libvirt.

Although this works as expected for non-root invocations, like
Armband deploys, it fails to remove raw files in Fuel@OPNFV deploys.

Work around this by keeping both mechanisms (libvirt managed +
python explicit handling).

Related-bug: ARMBAND-128

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

Change-Id: Ib846cd6071705b71d98824385835d724c729fd78
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 deploy/environments/execution_environment.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/deploy/environments/execution_environment.py b/deploy/environments/execution_environment.py
index 3812902aa..7a0b4744e 100644
--- a/deploy/environments/execution_environment.py
+++ b/deploy/environments/execution_environment.py
@@ -47,6 +47,8 @@ class ExecutionEnvironment(object):
         log('Deleting VM %s with disks %s' % (vm_name, disk_files))
         exec_cmd('virsh destroy %s' % vm_name, False)
         exec_cmd('virsh undefine --managed-save --remove-all-storage %s' % vm_name, False)
+        for file in disk_files:
+            delete(file)
 
     def overwrite_xml(self, vm_xml, vm_definition_overwrite):
         if not vm_definition_overwrite:
-- 
2.16.6