If you don't want to add it in a parameter then you already suspect that you
are doing something wrong. Using a singleton instead of passing a parameter
doesn't make the dependency not there. It's just obscures it.
I might not fully understand what you want to do but I think what you want is
to have MOM expect a certain interface.
Then have an adapter class bridging the two interfaces.
The pass the wrapped CIF to MOM.
----- Original Message -----
> From: "Mark Wu" <wu...@linux.vnet.ibm.com>
> To: email@example.com
> Cc: "Dan Kenigsberg" <dan...@redhat.com>, "Saggi Mizrahi"
> <smizr...@redhat.com>, "Adam Litke" <a...@us.ibm.com>, "Ryan
> Harper" <ry...@us.ibm.com>
> Sent: Wednesday, May 30, 2012 10:49:29 AM
> Subject: VDSM API/clientIF instance design issue
> Hi Guys,
> Recently, I has been working on integrate MOM into VDSM. MOM needs
> use VDSM API to interact with it. But currently, it requires the
> instance of clientIF to use vdsm API. Passing clientIF to MOM is not
> good choice since it's a vdsm internal object. So I try to remove
> parameter 'cif' from the interface definition and change to access
> globally unique clientIF instance in API.py.
> To get the instance of clientIF, I add a decorator to clientIF to
> change it into singleton. Actually, clientIF has been working as a
> global single instance already. We just don't have an interface to
> it and so passing it as parameter instead. I think using singleton
> get the instance of clientIF is more clean.
> Dan and Saggi already gave some comments in
> http://gerrit.ovirt.org/#change,4839 Thanks for the reviewing! But
> think we need more discussion on it, so I post it here because
> is not the appropriate to discuss a design issue.
> Thanks !
vdsm-devel mailing list