On 02/07/2014 05:59 PM, Lucas Meneghel Rodrigues wrote:
> On 02/05/2014 07:19 PM, Lucas Meneghel Rodrigues wrote:
>> On 02/05/2014 03:07 PM, Lucas Meneghel Rodrigues wrote:
> So, after a while thinking, I made the simplest change that touched only
> in the biggest offender, virttest.virsh, while not breaking any current
> code and still letting people to create virsh tests without 2 PRs
> (hopefully). You can see it here:
> 
> https://github.com/autotest/tp-libvirt/pull/12

(not meaning to sound defensive) Every module is the 'offender' with
circular dependencies, that's why they're circular!

In my experience, these issues are nearly always some low-level code
trying to use a higher level interface (i.e. a down-cast)**.  Fixing
these permanently involves identifying those usages and correcting them
to either be independent or get promoted to a higher-level.

> And to add new virsh functions, you just add them to
> 
> provider/virsh.py

This will cause an even worse problem!  If _anything_ other than 'from
virttest.virsh import *' (eek!) exists in that module,  it will 'fork'
the Virsh() class namespace.  Before anything can be added to
provider/virsh.py...

> In tp-libvirt. Of couse, at some point we need to actually move the 150
> functions that are not necessary by core virt-test functionality, but we

...the Virsh() class (and anything depending on it) _must_ be promoted
out of virttest.  That implies any virttest modules using the Virsh()
class interface, must be 'adjusted' to either always use the module
functions, or also get promoted to the test provider namespace.

If not, Virsh() will have undefined/ambiguous behavior!
i.e. [low-leve]l Virsh() != Virsh() [high-level]  (and the instance user
won't know the difference!)

---

**Note: One of the identified down-casters here is
virt_vm.BaseVM.lookup_vm_class().  We should start by relocating it to
the *one* place it's used: utils_env.Env.create_vm().

There's another one in BaseVM.get_address() which is/was addressed in my
networking update (needs splitting/porting to TP repo.)

-- 
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to