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

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



  * 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)
-- 
1.7.1


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