RAPI client: fix epydoc formatting
[ganeti-local] / lib / server / noded.py
index b306452..0090efb 100644 (file)
@@ -1,7 +1,7 @@
-#!/usr/bin/python
+#
 #
 
-# Copyright (C) 2006, 2007, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -184,6 +184,15 @@ class NodeHttpServer(http.server.HttpServer):
     return backend.BlockdevCreate(bdev, size, owner, on_primary, info)
 
   @staticmethod
+  def perspective_blockdev_pause_resume_sync(params):
+    """Pause/resume sync of a block device.
+
+    """
+    disks_s, pause = params
+    disks = [objects.Disk.FromDict(bdev_s) for bdev_s in disks_s]
+    return backend.BlockdevPauseResumeSync(disks, pause)
+
+  @staticmethod
   def perspective_blockdev_wipe(params):
     """Wipe a block device.
 
@@ -214,11 +223,11 @@ class NodeHttpServer(http.server.HttpServer):
     """Assemble a block device.
 
     """
-    bdev_s, owner, on_primary = params
+    bdev_s, owner, on_primary, idx = params
     bdev = objects.Disk.FromDict(bdev_s)
     if bdev is None:
       raise ValueError("can't unserialize data!")
-    return backend.BlockdevAssemble(bdev, owner, on_primary)
+    return backend.BlockdevAssemble(bdev, owner, on_primary, idx)
 
   @staticmethod
   def perspective_blockdev_shutdown(params):
@@ -283,8 +292,15 @@ class NodeHttpServer(http.server.HttpServer):
     disks = [objects.Disk.FromDict(dsk_s)
              for dsk_s in node_disks.get(node_name, [])]
 
-    return [status.ToDict()
-            for status in backend.BlockdevGetmirrorstatus(disks)]
+    result = []
+
+    for (success, status) in backend.BlockdevGetmirrorstatusMulti(disks):
+      if success:
+        result.append((success, status.ToDict()))
+      else:
+        result.append((success, status))
+
+    return result
 
   @staticmethod
   def perspective_blockdev_find(params):
@@ -441,6 +457,15 @@ class NodeHttpServer(http.server.HttpServer):
     export = params[0]
     return backend.RemoveExport(export)
 
+  # block device ---------------------
+  @staticmethod
+  def perspective_bdev_sizes(params):
+    """Query the list of block devices
+
+    """
+    devices = params[0]
+    return backend.GetBlockDevSizes(devices)
+
   # volume  --------------------------
 
   @staticmethod
@@ -720,6 +745,18 @@ class NodeHttpServer(http.server.HttpServer):
     return backend.GetMasterInfo()
 
   @staticmethod
+  def perspective_run_oob(params):
+    """Runs oob on node.
+
+    """
+    output = backend.RunOob(params[0], params[1], params[2], params[3])
+    if output:
+      result = serializer.LoadJson(output)
+    else:
+      result = None
+    return result
+
+  @staticmethod
   def perspective_write_ssconf_files(params):
     """Write ssconf files.