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

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

 



  * 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]