[Libvirt-cim] [PATCH 1 of 2] [TEST] Add support for passed in parameters and RefConf to cim_define()

Dan Smith danms at us.ibm.com
Tue Aug 19 15:42:11 UTC 2008


KR> -    def cim_define(self, ip):
KR> +    def cim_define(self, ip, params=None, ref_conf=None):

This is a class method, right?  It seems weird to have a parameter to a
class method that overrides the use of any of the class's private
variables.  AFAICT, this behaves like a class method when params=None
and like a regular function when params is not None.

Why not make cim_define() a regular function for the case where you need
to pass in specific values and have the class method call it with the
information from the class?

KR>          service = vsms.get_vsms_class(self.virt)(ip)
KR> -        sys_settings = str(self.vssd)
KR> -        res_settings = [str(self.dasd), str(self.nasd),
KR> -                        str(self.pasd), str(self.masd)]
KR> +        if params is None:
KR> +            sys_settings = str(self.vssd)
KR> +            res_settings = [str(self.dasd), str(self.nasd),
KR> +                            str(self.pasd), str(self.masd)]
KR> +        else:
KR> +            sys_settings = params['vssd']
KR> +            res_settings = params['rasds']

For the record, I think that the current convention of passing in a dict
with two specifically-named items instead of just another parameter to
the method is pretty gross.  Just in case you were wondering :)

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080819/a0fdeac6/attachment.sig>


More information about the Libvirt-cim mailing list