as many already know, we have a problem in the vdsm/virt/* area with the size of vm.py.
As in today's master (SHA1: ed7618102e4e3aedf859adb1084eecded8e5158d), vm.py weights
1082 11:28:09 fromani@musashi ~/Projects/upstream/vdsm $ ls -lh vdsm/virt/vm.py
-rw-rw-r--. 1 fromani fromani 209K Nov 24 11:15 vdsm/virt/vm.py
1083 11:30:22 fromani@musashi ~/Projects/upstream/vdsm $ wc vdsm/virt/vm.py
5202 17125 213026 vdsm/virt/vm.py
I'd like to renew my commitment to bring this monster down to a sane size.
I don't think we can make it in one go. We should tackle this monster task in stages.
We have roughly five weeks left until the end of the year.
Sounds like a good timespan for the first stage, and I'm aiming for go down under
the 4000 line mark.
So we have roughly 1200 lines to eliminate somehow.
This is the initial plan I'm thinking off, in expected increasing difficulty
level, from easies to hardest:
Chance to break things: minimal
- roughly 120 lines (10% of the goal)
- can be moved verbatim (cut/paste) elsewhere, like vdsm/virt/livemerge.py,
fixing only import paths.
2. the findDrive* family of functions:
Chance to break things: minimal/very low
- roughly 50 lines (~4% of the goal)
- can be moved with minimal changes elsewhere, like vdsm/virt/storage/????.py,
3. the getConf* faimily of functions:
Chance to break things: medium-to-high in the 3.x branch, low on 4.x because we drop
- roughly 110 lines (~9% of the goal)
- just drop them for 4.0!
- alternatively, need to figure out a proper place, maybe a new module?
4. the Devices/VM setup bits
All scatthered through vm.py (e.g. _buildDomainXML, DeviceMapping table)
Chance to break things: medium-to-low, depends on individual patches
- all summed up, roughly 200 lines (~18% of the goal)
- need serious cleanup
- no definite plan
- mostly is cut/paste or transform Vm methods into functions
5. the getUnderlying* familiy of functions:
Chance to break things: low (maybe medium on some cases, to lean on the safe side)
- roughly 550 lines (~46% of the goal)
- easy to test (just run vms!)
- can be moved in the devices/ subpackage with some changes.
- require further work in the area to properly integrate this code in the device objects
- more work is planned in this area, including move from minidom to ElementTree
So far, I've gathered ~1030 lines, so I'm short of 170 lines to reach the goal,
but I'm confident
I can find something more.
The plan now is to start from the easy parts *and* in background with #4, which requires
work than everything else.
Thoughts, objections and suggestions all welcome, especially from storage people, because
items in my list affects them.
Thanks and bests,
RedHat Engineering Virtualization R & D