
Greetings. I'm an automation tester in charge of testing SDK, my problem is that I cannot influence the objects that are created without so called "monkey patching" (google that and you will see what it means) the ovirtsdk.infrastructure.brokers.*. I made some comments about this #782891, but I was not so clear there, so I hope this will be better: In [12]: api.datacenters.list()[0] Out[12]: <ovirtsdk.infrastructure.brokers.DataCenter at 0x1a62890> You see that this returns an object that was declared somewhere in SDK. We have AFAIK no good way to say which object should be created. It would be good for us to be able to tell SDK: " My dear SDK, every time you are asked, please don't create and give me ovirtsdk.infrastructure.brokers.DataCenter, but something very similar: our.tests.infrastructure.brokers.DataCenter " This object would be a subclass SDK object. Than we would not have make another layer which would be converting between objects from ovirtsdk and objects we need, which will contain our own code (__eq__, __in__, str, ...). I hope this would be good for other SDK users as well. I think this could be achieved by having a overridable mapping: entitites_map = { 'DataCenters': ovirtsdk.api.DataCenters, # Use the default. 'DataCenters': our.tests.infrastructure.brokers.DataCenter, 'Clusters': our.tests.infrastructure.brokers.Clusters, 'Cluster': our.tests.infrastructure.brokers.Cluster } SDK would create the objects somehow like this: new_cluster = entities_map['Cluster'](param1="sdff", param2="dsfs", ...) Or even better if there was a Factory: class DefaultEntitiesFactory(object): def cluster(self, param1=None, param2=None, datacenter=...): cluster = ovirtsdk.infrastructure.brokers.Cluster(param1, param2, ...) ... return cluster def datacenter(self, param1=None, param2=None) dc = ovirtsdk.infrastructure.brokers.Datacenter(param1, param2, ...) ... return dc and there was, somewhere in the sdk: ovirtsdk..somemodule.ENTITIES_FACTORY = DefaultEntitiesFactory We could than switch the factory to something which fits better: ovirtsdk..somemodule.ENTITIES_FACTORY = MyBetterEntitiesFactory whereas the MyBetterEntitiesFactory would be a subclass: class MyBetterEntitiesFactory(DefaultEntitiesFactory): def cluster(self, param1=None, param2=None, datacenter=...): cluster = our.tests.infrastructure.brokers.Cluster(param1, param2, ...) do_some_fancy_cool_stuff(self, cluster) return cluster pass I hope I made myself clear this time. Jarda