Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 1 | import os |
| 2 | import base64 |
| 3 | from planetstack.config import Config |
Tony Mack | 66646d5 | 2013-09-24 21:47:12 -0400 | [diff] [blame] | 4 | from observer.openstacksyncstep import OpenStackSyncStep |
Sapan Bhatia | 24836f1 | 2013-08-27 10:16:05 -0400 | [diff] [blame] | 5 | |
Tony Mack | 66646d5 | 2013-09-24 21:47:12 -0400 | [diff] [blame] | 6 | class SyncExternalRoutes(OpenStackSyncStep): |
| 7 | # XXX what does this provide? |
| 8 | provides=[] |
| 9 | requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently |
Sapan Bhatia | 2ef36c8 | 2013-09-02 14:30:37 -0400 | [diff] [blame] | 10 | |
Tony Mack | a76b895 | 2013-10-05 23:36:30 -0400 | [diff] [blame] | 11 | def call(self, **args): |
Tony Mack | 66646d5 | 2013-09-24 21:47:12 -0400 | [diff] [blame] | 12 | routes = self.driver.get_external_routes() |
| 13 | subnets = self.driver.shell.quantum.list_subnets()['subnets'] |
| 14 | for subnet in subnets: |
| 15 | try: |
| 16 | self.driver.add_external_route(subnet, routes) |
| 17 | except: |
| 18 | logger.log_exc("failed to add external route for subnet %s" % subnet) |