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

Re: [libvirt] [test-API][PATCH 1/2] Add 2 new functions in storageAPI



On 01/31/2012 04:45 PM, Wayne Sun wrote:
   * download(self, poolname, volname, stream, offset, length, flags = 0)
   * upload(self, poolname, volname, stream, offset, length, flags = 0)
---
  lib/storageAPI.py |   17 +++++++++++++++++
  1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/lib/storageAPI.py b/lib/storageAPI.py
index 6c9d286..b0733f8 100644
--- a/lib/storageAPI.py
+++ b/lib/storageAPI.py
@@ -466,3 +466,20 @@ class StorageAPI(object):
              code = e.get_error_code()
              raise exception.LibvirtAPI(message, code)

+    def download(self, poolname, volname, stream, offset, length, flags = 0):
+        try:
+            volobj = self.get_volume_obj(poolname, volname)
+            return volobj.download(stream, offset, length, flags)
+        except libvirt.libvirtError, e:
+            message = e.get_error_message()
+            code = e.get_error_code()
+            raise exception.LibvirtAPI(message, code)
+
+    def upload(self, poolname, volname, stream, offset, length, flags = 0):
+        try:
+            volobj = self.get_volume_obj(poolname, volname)
+            return volobj.upload(stream, offset, length, flags)
+        except libvirt.libvirtError, e:
+            message = e.get_error_message()
+            code = e.get_error_code()
+            raise exception.LibvirtAPI(message, code)

   ACK

   Guannan Ren


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