virt-manager/b9bc3b60-undefine-only-persistent-domain.patch
Charles Arnold 47dab25b0a - Upstream bug fixes (bsc#1027942)
b9bc3b60-undefine-only-persistent-domain.patch
  7fc7e94f-fix-virtio-scsi-controller-target-calculation.patch
  2eb455c9-correctly-calculate-virtio-scsi-controller-index.patch

- bsc#1067263 - virt-install: ERROR unicode argument expected, got
  'str'
  f836e47b-virtinst-Fix-URLFetcher-for-reading-files.patch
- Drop virtinst-fix-replace-StringIO-with-io.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=379
2017-11-28 16:06:53 +00:00

48 lines
1.7 KiB
Diff

Subject: delete: undefine only persistent domain
From: Pavel Hrdina phrdina@redhat.com Fri Nov 24 17:26:59 2017 +0100
Date: Fri Nov 24 17:39:58 2017 +0100:
Git: b9bc3b605a96920d3e225d472d549864205e92ce
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1517119
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
diff --git a/virtManager/delete.py b/virtManager/delete.py
index 98df413..0ebfdeb 100644
--- a/virtManager/delete.py
+++ b/virtManager/delete.py
@@ -162,6 +162,7 @@ class vmmDeleteDialog(vmmGObjectUI):
def _async_delete(self, asyncjob, paths):
storage_errors = []
details = ""
+ undefine = self.vm.is_persistent()
try:
if self.vm.is_active():
@@ -181,8 +182,9 @@ class vmmDeleteDialog(vmmGObjectUI):
"".join(traceback.format_exc())))
meter.end(0)
- logging.debug("Removing VM '%s'", self.vm.get_name())
- self.vm.delete()
+ if undefine:
+ logging.debug("Removing VM '%s'", self.vm.get_name())
+ self.vm.delete()
except Exception as e:
error = (_("Error deleting virtual machine '%s': %s") %
diff --git a/virtManager/domain.py b/virtManager/domain.py
index a1f59e3..183a56c 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -484,6 +484,9 @@ class vmmDomain(vmmLibvirtObject):
return bool(self.get_xmlobj().os.loader_ro is True and
self.get_xmlobj().os.loader_type == "pflash")
+ def is_persistent(self):
+ return bool(self._backend.isPersistent())
+
##################
# Support checks #
##################