~renukaapte/nova/iscsi-refactor-d2

« back to all changes in this revision

Viewing changes to nova/network/manager.py

  • Committer: Tarmac
  • Author(s): Dan Prince, Mohammed Naser
  • Date: 2011-07-13 12:51:29 UTC
  • mfrom: (1266.1.3 fix_allocate_fixed_ips)
  • Revision ID: tarmac-20110713125129-4hlfrt4fl31krpgs
Don't pop 'vpn' on kwargs inside a loop in RPCAllocateFixedIP._allocate_fixed_ips (fixes KeyError).

Update allocate_fixed_ip methods in network manager to accept correct kwargs. (fixes regression in bzr 1266)

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        """Calls allocate_fixed_ip once for each network."""
129
129
        green_pool = greenpool.GreenPool()
130
130
 
 
131
        vpn = kwargs.pop('vpn')
131
132
        for network in networks:
132
133
            if network['host'] != self.host:
133
134
                # need to call allocate_fixed_ip to correct network host
136
137
                args = {}
137
138
                args['instance_id'] = instance_id
138
139
                args['network_id'] = network['id']
139
 
                args['vpn'] = kwargs.pop('vpn')
 
140
                args['vpn'] = vpn
140
141
 
141
142
                green_pool.spawn_n(rpc.call, context, topic,
142
143
                                   {'method': '_rpc_allocate_fixed_ip',
143
144
                                    'args': args})
144
145
            else:
145
146
                # i am the correct host, run here
146
 
                self.allocate_fixed_ip(context, instance_id, network,
147
 
                                       vpn=kwargs.pop('vpn'))
 
147
                self.allocate_fixed_ip(context, instance_id, network, vpn=vpn)
148
148
 
149
149
        # wait for all of the allocates (if any) to finish
150
150
        green_pool.waitall()
706
706
 
707
707
    timeout_fixed_ips = False
708
708
 
709
 
    def _allocate_fixed_ips(self, context, instance_id, networks):
 
709
    def _allocate_fixed_ips(self, context, instance_id, networks, **kwargs):
710
710
        """Calls allocate_fixed_ip once for each network."""
711
711
        for network in networks:
712
712
            self.allocate_fixed_ip(context, instance_id, network)
763
763
            self.driver.ensure_bridge(network['bridge'],
764
764
                                      network['bridge_interface'])
765
765
 
766
 
    def allocate_fixed_ip(self, context, instance_id, network):
 
766
    def allocate_fixed_ip(self, context, instance_id, network, **kwargs):
767
767
        """Allocate flat_network fixed_ip, then setup dhcp for this network."""
768
768
        address = super(FlatDHCPManager, self).allocate_fixed_ip(context,
769
769
                                                                 instance_id,