mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
delete: Add _destroy_vm method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
928c049c9d
commit
3c6a5f4536
@ -86,6 +86,9 @@ class _vmmDeleteBase(vmmGObjectUI):
|
||||
meter.end(0)
|
||||
return storage_errors
|
||||
|
||||
def _destroy_vm(self, vm):
|
||||
raise NotImplementedError
|
||||
|
||||
def _init_state(self):
|
||||
blue = Gdk.Color.parse("#0072A8")[1]
|
||||
self.widget("header").modify_bg(Gtk.StateType.NORMAL, blue)
|
||||
@ -213,11 +216,8 @@ class _vmmDeleteBase(vmmGObjectUI):
|
||||
|
||||
def _async_delete(self, asyncjob, vm, paths):
|
||||
details = ""
|
||||
|
||||
try:
|
||||
if vm.is_active():
|
||||
log.debug("Forcing VM '%s' power off.", vm.get_name())
|
||||
vm.destroy()
|
||||
self._destroy_vm(vm)
|
||||
|
||||
conn = vm.conn.get_backend()
|
||||
meter = asyncjob.get_meter()
|
||||
@ -300,6 +300,11 @@ class vmmDeleteDialog(_vmmDeleteBase):
|
||||
log.debug("Removing VM '%s'", vm.get_name())
|
||||
vm.delete()
|
||||
|
||||
def _destroy_vm(self, vm):
|
||||
if vm.is_active():
|
||||
log.debug("Forcing VM '%s' power off.", vm.get_name())
|
||||
vm.destroy()
|
||||
|
||||
|
||||
class vmmDeleteStorage(_vmmDeleteBase):
|
||||
def __init__(self, disk):
|
||||
@ -330,6 +335,9 @@ class vmmDeleteStorage(_vmmDeleteBase):
|
||||
super()._delete_disks(vm, paths, conn, meter)
|
||||
return storage_errors
|
||||
|
||||
def _destroy_vm(self, vm):
|
||||
pass
|
||||
|
||||
|
||||
###################
|
||||
# UI init helpers #
|
||||
|
Loading…
Reference in New Issue
Block a user