[virt-tools-list] [PATCH 3/4] Updated stopdomain.py to use vmmDomain types.
Darryl L. Pierce
dpierce at redhat.com
Mon May 23 21:47:22 UTC 2011
---
src/virtManagerTui/libvirtworker.py | 5 -----
src/virtManagerTui/stopdomain.py | 11 +++++++----
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/virtManagerTui/libvirtworker.py b/src/virtManagerTui/libvirtworker.py
index 225cf38..02a6af2 100644
--- a/src/virtManagerTui/libvirtworker.py
+++ b/src/virtManagerTui/libvirtworker.py
@@ -146,11 +146,6 @@ class LibvirtWorker:
if name in domains: return True
return False
- def destroy_domain(self, name):
- '''Destroys the specified domain.'''
- domain = self.get_domain(name)
- domain.destroy()
-
def undefine_domain(self, name):
'''Undefines the specified domain.'''
domain = self.get_domain(name)
diff --git a/src/virtManagerTui/stopdomain.py b/src/virtManagerTui/stopdomain.py
index a58b9dd..1a2008b 100644
--- a/src/virtManagerTui/stopdomain.py
+++ b/src/virtManagerTui/stopdomain.py
@@ -47,10 +47,13 @@ class StopDomainConfigScreen(DomainListConfigScreen):
if self.get_selected_domain() is not None:
domain = self.get_selected_domain()
try:
- self.get_libvirt().destroy_domain(domain)
- return True
+ if domain.is_stoppable():
+ domain.destroy()
+ return True
+ else:
+ errors.append("%s is not in a stoppable state: state=%s" % (domain.get_name(), domain.run_status()))
except Exception, error:
- errors.append("There was an error stop the domain: %s" % domain)
+ errors.append("There was an error stopping the domain: %s" % domain)
errors.append(str(error))
else:
errors.append("You must first select a domain to stop.")
@@ -58,7 +61,7 @@ class StopDomainConfigScreen(DomainListConfigScreen):
def get_stop_page(self, screen):
grid = Grid(1, 1)
- grid.setField(Label("%s was successfully stoped." % self.get_selected_domain()), 0, 0)
+ grid.setField(Label("%s was successfully stopped." % self.get_selected_domain().get_name()), 0, 0)
return [grid]
def StopDomain():
--
1.7.4.4
More information about the virt-tools-list
mailing list