virt-test icon indicating copy to clipboard operation
virt-test copied to clipboard

Todo: refine virsh module accessory classes

Open cevich opened this issue 12 years ago • 0 comments

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
  • VirshBase class 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 current command() function. Executes commands & returns output via VirshSessionBase subclass. Imports and wraps all module-level virsh-command functions.
  • VirshInterfaceBase - ABC similar to current VirshPersistant & Virsh classes. Interfaces with VirshCommandBase subclass (which controls VirshSessionBase). 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.

cevich avatar Sep 13 '13 14:09 cevich