def ensure_filtering_rules_for_instance(self, instance, network_info):
    "Ensure that an instance's filtering rules are enabled.\n\n        When migrating an instance, we need the filtering rules to\n        be configured on the destination host before starting the\n        migration.\n\n        Also, when restarting the compute service, we need to ensure\n        that filtering rules exist for all running services.\n        "
    self.firewall_driver.setup_basic_filtering(instance, network_info)
    self.firewall_driver.prepare_instance_filter(instance, network_info)
    timeout_count = range(CONF.live_migration_retry_count)
    while timeout_count:
        if self.firewall_driver.instance_filter_exists(instance, network_info):
            break
        timeout_count.pop()
        if (len(timeout_count) == 0):
            msg = _('The firewall filter for %s does not exist')
            raise exception.NovaException((msg % instance.name))
        greenthread.sleep(1)
Ensure that an instance's filtering rules are enabled.

When migrating an instance, we need the filtering rules to
be configured on the destination host before starting the
migration.

Also, when restarting the compute service, we need to ensure
that filtering rules exist for all running services.
def ensure_filtering_rules_for_instance(self, instance, network_info):
    "Ensure that an instance's filtering rules are enabled.\n\n        When migrating an instance, we need the filtering rules to\n        be configured on the destination host before starting the\n        migration.\n\n        Also, when restarting the compute service, we need to ensure\n        that filtering rules exist for all running services.\n        "
    self.firewall_driver.setup_basic_filtering(instance, network_info)
    self.firewall_driver.prepare_instance_filter(instance, network_info)
    timeout_count = range(CONF.live_migration_retry_count)
    while timeout_count:
        if self.firewall_driver.instance_filter_exists(instance, network_info):
            break
        timeout_count.pop()
        if (len(timeout_count) == 0):
            msg = _('The firewall filter for %s does not exist')
            raise exception.NovaException((msg % instance.name))
        greenthread.sleep(1)