[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 2/4] Updated startdomain.py to use vmmDomain objects.



Broke out the start functionality to include unpausing a suspended
domain as well as starting up a stopped domain.
---
 src/virtManagerTui/libvirtworker.py |    5 -----
 src/virtManagerTui/startdomain.py   |   11 +++++++----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/virtManagerTui/libvirtworker.py b/src/virtManagerTui/libvirtworker.py
index 0172fe1..225cf38 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 create_domain(self, name):
-        '''Creates the specified domain.'''
-        domain = self.get_domain(name)
-        domain.create()
-
     def destroy_domain(self, name):
         '''Destroys the specified domain.'''
         domain = self.get_domain(name)
diff --git a/src/virtManagerTui/startdomain.py b/src/virtManagerTui/startdomain.py
index 468f591..b796645 100644
--- a/src/virtManagerTui/startdomain.py
+++ b/src/virtManagerTui/startdomain.py
@@ -30,7 +30,7 @@ class StartDomainConfigScreen(DomainListConfigScreen):
 
     def get_elements_for_page(self, screen, page):
         if page is self.LIST_PAGE:
-            return self.get_domain_list_page(screen, started = False)
+            return self.get_domain_list_page(screen, created = False)
         elif page is self.START_PAGE:
             return self.get_start_domain_page(screen)
 
@@ -47,17 +47,20 @@ class StartDomainConfigScreen(DomainListConfigScreen):
             if self.get_selected_domain() is not None:
                 domain = self.get_selected_domain()
                 try:
-                    self.get_libvirt().create_domain(domain)
+                    if domain.is_unpauseable():
+                        domain.resume()
+                    else:
+                        domain.startup()
                     return True
                 except Exception, error:
-                    errors.append("There was an error creating the domain: %s" % domain)
+                    errors.append("There was an error creating the domain: %s" % domain.get_name())
                     errors.append(str(error))
             else:
                 errors.append("You must first select a domain to start.")
 
     def get_start_domain_page(self, screen):
         grid = Grid(1, 1)
-        grid.setField(Label("%s was successfully started." % self.get_selected_domain()), 0, 0)
+        grid.setField(Label("%s was successfully started." % self.get_selected_domain().get_name()), 0, 0)
         return [grid]
 
 def StartDomain():
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]