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): |
| 14 | routes = self.manager.driver.get_external_routes() |
Sapan Bhatia | 04c94ad | 2013-09-02 18:00:28 -0400 | [diff] [blame] | 15 | subnets = self.manager.driver.shell.quantum.list_subnets()['subnets'] |
| 16 | for subnet in subnets: |
| 17 | try: |
| 18 | self.manager.driver.add_external_route(subnet, routes) |
| 19 | except: |
| 20 | logger.log_exc("failed to add external route for subnet %s" % subnet) |