Log instance consistently.
Change-Id: Icd0d5021de768ab16b1b766f27ed03df61546239
This commit is contained in:
parent
fb58a57af6
commit
03a331cdfe
|
@ -127,16 +127,16 @@ class IptablesFirewallDriver(FirewallDriver):
|
|||
self.remove_filters_for_instance(instance)
|
||||
self.iptables.apply()
|
||||
else:
|
||||
LOG.info(_('Attempted to unfilter instance %s which is not '
|
||||
'filtered'), instance['id'])
|
||||
LOG.info(_('Attempted to unfilter instance which is not '
|
||||
'filtered'), instance=instance)
|
||||
|
||||
def prepare_instance_filter(self, instance, network_info):
|
||||
self.instances[instance['id']] = instance
|
||||
self.network_infos[instance['id']] = network_info
|
||||
self.add_filters_for_instance(instance)
|
||||
LOG.debug(_('Filters added to instance %s'), instance['uuid'])
|
||||
LOG.debug(_('Filters added to instance'), instance=instance)
|
||||
self.refresh_provider_fw_rules()
|
||||
LOG.debug(_('Provider Firewall Rules refreshed'))
|
||||
LOG.debug(_('Provider Firewall Rules refreshed'), instance=instance)
|
||||
self.iptables.apply()
|
||||
|
||||
def _create_filter(self, ips, chain_name):
|
||||
|
@ -288,7 +288,8 @@ class IptablesFirewallDriver(FirewallDriver):
|
|||
security_group['id'])
|
||||
|
||||
for rule in rules:
|
||||
LOG.debug(_('Adding security group rule: %r'), rule)
|
||||
LOG.debug(_('Adding security group rule: %r'), rule,
|
||||
instance=instance)
|
||||
|
||||
if not rule.cidr:
|
||||
version = 4
|
||||
|
@ -313,7 +314,7 @@ class IptablesFirewallDriver(FirewallDriver):
|
|||
elif protocol == 'icmp':
|
||||
args += self._build_icmp_rule(rule, version)
|
||||
if rule.cidr:
|
||||
LOG.debug('Using cidr %r', rule.cidr)
|
||||
LOG.debug('Using cidr %r', rule.cidr, instance=instance)
|
||||
args += ['-s', rule.cidr]
|
||||
fw_rules += [' '.join(args)]
|
||||
else:
|
||||
|
@ -326,7 +327,6 @@ class IptablesFirewallDriver(FirewallDriver):
|
|||
import nova.network
|
||||
nw_api = nova.network.API()
|
||||
for instance in rule['grantee_group']['instances']:
|
||||
LOG.debug('instance: %r', instance)
|
||||
nw_info = nw_api.get_instance_nw_info(ctxt,
|
||||
instance)
|
||||
|
||||
|
@ -334,12 +334,13 @@ class IptablesFirewallDriver(FirewallDriver):
|
|||
for ip in nw_info.fixed_ips()
|
||||
if ip['version'] == version]
|
||||
|
||||
LOG.debug('ips: %r', ips)
|
||||
LOG.debug('ips: %r', ips, instance=instance)
|
||||
for ip in ips:
|
||||
subrule = args + ['-s %s' % ip]
|
||||
fw_rules += [' '.join(subrule)]
|
||||
|
||||
LOG.debug('Using fw_rules: %r', fw_rules)
|
||||
LOG.debug('Using fw_rules: %r', fw_rules, instance=instance)
|
||||
|
||||
ipv4_rules += ['-j $sg-fallback']
|
||||
ipv6_rules += ['-j $sg-fallback']
|
||||
|
||||
|
|
Loading…
Reference in New Issue