Pull latest scheduler change from Oslo
The RetryFilter is now part of Oslo, although it's been renamed to IgnoreAttemptedFilter. Thanks to entry_point, we are able to maintain backwards compatibility after pulling that commit from Oslo. Commits in this change: * 66fe978 2013-12-10 | Change IgnoreAttemptedHostFilter to expect 'retry' key (attempt-retry) * 135dd00 2013-12-10 | Remove start index 0 in range() * 45658e2 2013-12-09 | Fix violations of H302:import only modules * 70004c6 2013-12-04 | Add IgnoreAttemptedHostsFilter to oslo * 880acf7 2013-11-14 | Change capabilities filters to use resource type (capfilter_message) * 06e9d98 2013-11-10 | Add some log messages to capabilities_filter.py * 3970d46 2013-11-02 | Fix typos in oslo * 8718763 2013-08-19 | Replace list with dict in AvailabilityZoneFilter.host_passes * c0d052a 2013-07-12 | python3: Add basic compatibility support. * e3545f8 2013-06-02 | Enable hacking H402 test * 484a1df 2013-05-30 | Enable hacking H403 test * 35660da 2013-05-30 | Enable hacking H401 test * 5dcc43b 2013-05-05 | Break out common functionality for filters and weights * 1f2aba5 2013-05-03 | Renames filter to base_filter and weight to base_weight Change-Id: Ibeb685ef60e44cb6388fc460ee6a78255ed3dbae
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
# Copyright (c) 2012 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common.scheduler import filters
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RetryFilter(filters.BaseHostFilter):
|
||||
"""Filter out nodes that have already been attempted for scheduling
|
||||
purposes
|
||||
"""
|
||||
|
||||
def host_passes(self, host_state, filter_properties):
|
||||
"""Skip nodes that have already been attempted."""
|
||||
retry = filter_properties.get('retry', None)
|
||||
if not retry:
|
||||
# Re-scheduling is disabled
|
||||
LOG.debug("Re-scheduling is disabled")
|
||||
return True
|
||||
|
||||
hosts = retry.get('hosts', [])
|
||||
host = host_state.host
|
||||
|
||||
passes = host not in hosts
|
||||
pass_msg = "passes" if passes else "fails"
|
||||
|
||||
LOG.debug(_("Host %(host)s %(pass_msg)s. Previously tried hosts: "
|
||||
"%(hosts)s") %
|
||||
{'host': host, 'pass_msg': pass_msg, 'hosts': hosts})
|
||||
|
||||
# Host passes if it's not in the list of previously attempted hosts:
|
||||
return passes
|
||||
Reference in New Issue
Block a user