From 03a331cdfe492cb7a9d531021b444384a27bdd56 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Thu, 12 Apr 2012 12:36:24 +1000 Subject: [PATCH] Log instance consistently. Change-Id: Icd0d5021de768ab16b1b766f27ed03df61546239 --- nova/virt/firewall.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/nova/virt/firewall.py b/nova/virt/firewall.py index af13a5817f68..b70e164b1a45 100644 --- a/nova/virt/firewall.py +++ b/nova/virt/firewall.py @@ -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']