Move some code into separate class in import/export daemon
[ganeti-local] / daemons / ganeti-noded
index 7a5ab7a..ef78513 100755 (executable)
@@ -353,20 +353,6 @@ class NodeHttpServer(http.server.HttpServer):
   # export/import  --------------------------
 
   @staticmethod
-  def perspective_snapshot_export(params):
-    """Export a given snapshot.
-
-    """
-    disk = objects.Disk.FromDict(params[0])
-    dest_node = params[1]
-    instance = objects.Instance.FromDict(params[2])
-    cluster_name = params[3]
-    dev_idx = params[4]
-    debug = params[5]
-    return backend.ExportSnapshot(disk, dest_node, instance,
-                                  cluster_name, dev_idx, debug)
-
-  @staticmethod
   def perspective_finalize_export(params):
     """Expose the finalize export functionality.
 
@@ -488,16 +474,6 @@ class NodeHttpServer(http.server.HttpServer):
     return backend.RunRenameInstance(inst, old_name, debug)
 
   @staticmethod
-  def perspective_instance_os_import(params):
-    """Run the import function of an OS onto a given instance.
-
-    """
-    inst_s, src_node, src_images, cluster_name, debug = params
-    inst = objects.Instance.FromDict(inst_s)
-    return backend.ImportOSIntoInstance(inst, src_node, src_images,
-                                        cluster_name, debug)
-
-  @staticmethod
   def perspective_instance_shutdown(params):
     """Shutdown an instance.
 
@@ -838,7 +814,7 @@ class NodeHttpServer(http.server.HttpServer):
   # Crypto
 
   @staticmethod
-  def perspective_create_x509_certificate(params):
+  def perspective_x509_cert_create(params):
     """Creates a new X509 certificate for SSL/TLS.
 
     """
@@ -846,7 +822,7 @@ class NodeHttpServer(http.server.HttpServer):
     return backend.CreateX509Certificate(validity)
 
   @staticmethod
-  def perspective_remove_x509_certificate(params):
+  def perspective_x509_cert_remove(params):
     """Removes a X509 certificate.
 
     """
@@ -856,7 +832,7 @@ class NodeHttpServer(http.server.HttpServer):
   # Import and export
 
   @staticmethod
-  def perspective_start_import_listener(params):
+  def perspective_import_start(params):
     """Starts an import daemon.
 
     """
@@ -869,7 +845,7 @@ class NodeHttpServer(http.server.HttpServer):
                                            _DecodeImportExportIO(dest,
                                                                  dest_args))
   @staticmethod
-  def perspective_start_export(params):
+  def perspective_export_start(params):
     """Starts an export daemon.
 
     """
@@ -884,14 +860,21 @@ class NodeHttpServer(http.server.HttpServer):
                                                                  source_args))
 
   @staticmethod
-  def perspective_get_import_export_status(params):
+  def perspective_impexp_status(params):
     """Retrieves the status of an import or export daemon.
 
     """
     return backend.GetImportExportStatus(params[0])
 
   @staticmethod
-  def perspective_cleanup_import_export(params):
+  def perspective_impexp_abort(params):
+    """Aborts an import or export.
+
+    """
+    return backend.AbortImportExport(params[0])
+
+  @staticmethod
+  def perspective_impexp_cleanup(params):
     """Cleans up after an import or export.
 
     """