virt-test
virt-test copied to clipboard
Todo: refine virsh module accessory classes
It seems we have more ways of executing virsh commands coming in than we have facilities in virsh module to deal with. The command function keeps expanding with more conditionals. The VirshSession keeps expanding to support different ways of talking to libvirt.
I propose we move things around slightly to follow a 3-tier approach:
- Regular module-level function calls should continue working as-is
VirshBaseclass left as-is.VirshSessionBase- ABC providing session-level interface needed to local/remote/other session create, destroy, duplicate, recycle.VirshCommandBase- ABC providing interface to execute commands - supports specialization of currentcommand()function. Executes commands & returns output viaVirshSessionBasesubclass. Imports and wraps all module-level virsh-command functions.VirshInterfaceBase- ABC similar to currentVirshPersistant&Virshclasses. Interfaces withVirshCommandBasesubclass (which controlsVirshSessionBase). Responsible for hiding complexity of command execution and output processing.- Test-modules would instantiate a VirshSessionBase and VirshCommandBase subclass, then pass those to a VirshInterfaceBase subclass. All test interaction would then go through VirshInterface object, allowing commands or sequence of commands to be executed and provide more easily consumable return values back to test.