Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 1 | import os |
| 2 | import base64 |
| 3 | from planetstack.config import Config |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 4 | from observer.syncstep import SyncStep |
Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 5 | |
| 6 | class SyncExternalRoutes(SyncStep): |
| 7 | # XXX what does this provide? |
Sapan Bhatia | 2ef36c8 | 2013-09-02 14:30:37 -0400 | [diff] [blame] | 8 | requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently |
| 9 | |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 10 | def __init__(self): |
| 11 | pass |
| 12 | |
Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 13 | def call(self): |
Tony Mack | 387a73f | 2013-09-18 07:59:14 -0400 | [diff] [blame] | 14 | routes = self.driver.get_external_routes() |
| 15 | subnets = self.driver.shell.quantum.list_subnets()['subnets'] |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 16 | for subnet in subnets: |
| 17 | try: |
Tony Mack | 387a73f | 2013-09-18 07:59:14 -0400 | [diff] [blame] | 18 | self.driver.add_external_route(subnet, routes) |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 19 | except: |
| 20 | logger.log_exc("failed to add external route for subnet %s" % subnet) |