
On 03/22/2012 02:51 PM, Guannan Ren wrote:
On 03/22/2012 08:54 PM, Peter Krempa wrote:
With this patch, the newStream() method of the ConnectAPI class returns an already encapsulated StreamAPI object . *lib/connectAPI.py: - modify newStream method to return StreamAPI object *lib/streamAPI.py: - modify constructor to take virStream objects --- lib/connectAPI.py | 4 +++- lib/streamAPI.py | 9 ++------- 2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/lib/connectAPI.py b/lib/connectAPI.py index f52467f..2723fc8 100644 --- a/lib/connectAPI.py +++ b/lib/connectAPI.py @@ -24,6 +24,7 @@ import os import re
import libvirt +from lib import streamAPI
The initial idea is to have a separate file for each of classes(domain, storage, etc) in libvirt.py at least in the form of files. The direction you are heading here is to combine them together again. Testcase is the right place where these objects of encapsulated class should meet each other. I prefer the way of what you did in openConsole API. We just pass the instance of ConnectAPI to initiate SteamAPI class for getting the object of SteamAPI for use we should delete the newStream method in connectAPI.py. Right now, the virConnect object from libvirt.py is exposed directly in existing testcases, that's not good way compared to what you did in openConsole. I will clean them next. What do you think?
Ok, I didn't know you want to keep those classes separate. The only small issue with this is, that ConnectAPI.newStream() produces unencapsulated virStream object, but you can get that anyways using the StreamAPI.getStream() method. I'll post a v2 of the next patch that adds flags to add them to the correct file. Peter
Guannan Ren
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list