Blob Blame History Raw
From 6f2711641ac3be709c0d9b4a66c9427358809b8c Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Thu, 9 Oct 2014 11:06:51 +0200
Subject: [PATCH 1/3] virt-manager, delete: fix path for disk type='volume'

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1146869

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 8f1aa5a4f002aa139faba63cfda3cedd9df7032a)
---
 virtManager/delete.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/virtManager/delete.py b/virtManager/delete.py
index 1aa8180..8a58191 100644
--- a/virtManager/delete.py
+++ b/virtManager/delete.py
@@ -232,8 +232,18 @@ def populate_storage_list(storage_list, vm, conn):
     model = storage_list.get_model()
     model.clear()
 
-    diskdata = [(disk.target, disk.path, disk.read_only, disk.shareable) for
-                disk in vm.get_disk_devices()]
+    def get_path(disk):
+        if disk.sourcePool:
+            try:
+                pool = conn.get_pool(disk.sourcePool)
+                vol = pool.get_volume(disk.path)
+                return vol.get_target_path()
+            except KeyError:
+                return disk.path
+        return disk.path
+
+    diskdata = [(d.target, get_path(d), d.read_only, d.shareable) for
+                d in vm.get_disk_devices()]
 
     diskdata.append(("kernel", vm.get_xmlobj().os.kernel, True, False))
     diskdata.append(("initrd", vm.get_xmlobj().os.initrd, True, False))
-- 
1.9.3