After an initial round of code reviews, Dan and I came up with the following 
code architecture at the VDSM side:

Additional requirements arose at the architectural level: 
1) Working with the configWriter configurator and the backups system 
2) Working with the upcoming iproute2 configurator: 
http://gerrit.ovirt.org/#/c/15301/
3) A solution that works properly with both configurators 

As a quick reminder, if the IP configuration is static I need to work with rule 
and route files, thus I need the cfg file configurator. 
If the IP configuration is DHCP I need to access the ip binary directly and add 
or remove routing lines and rules. 

The new proposed solution looks like this: 
* iproute2.py wrapper - Wrap the ip binary with our own methods that return 
named tuples containing the expected output. 
- This is quite a project in itself so I'll only implement the exact methods 
that I actually need 
- Write a unit test for this module 

* The new SourceRoute class will encapsulate two concepts: RuleSet (A set of 
rules like those in ip rule) and RoutingTable (Like the main routing table... 
ip route show table main) 
It's possible to separate the SourceRoute class to two classes but I have a 
feeling that will cause some duplication of code so right now I intend to 
implement just one class. 
- The SourceRoute class will be added to netmodels.py 

* The SourceRoute class receives the information it needs (ip, mask, gateway) 
and a configurator (Either ifcfg files configurator or iproute2 configurator). 
It has two methods: 
- configure: Call its configurator configureRuleSet and configureRoutingTable 
methods 
- remove: Call its configurator removeRuleSet and removeRoutingTable methods 
If the IP configuration is static, the cfg files configurator will be used and 
so the rule and route files will be created 
If the IP configuration is DHCP, the iproute2 configurator will be used and the 
ip binary will be called directly 

* DHCP hooks: During VDSM installation copy over two Python scripts to 
/etc/dhcp 
- dhclient-up-hooks, dhclient-down-hooks 
- These are two executables that are called whenever DHCP gets a DHCP response 
- They will check if the interface that was brought up or down is tracked by 
VDSM, and if so create a new SourceRoute instance and pass a new iproute2 
configurator 

* During configNetwork addNetwork and delNetwork: 
If the IP configuration is DHCP, there is nothing to do as the DHCP hooks were 
already put in place during VDSM installation 
If the IP configuration is static, then get the ifcfg configurator, pass it to 
a new SourceRoute instance and call configure
_______________________________________________
Arch mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/arch

Reply via email to