Zhiteng Huang d17cc23c64 Allow create_volume() to retry when exception happened
Due to the fact that certain volume back-ends cannot easily report
simple total_capacity_gb/free_capacity_gb for their internal
implementation complexity, scheduler is updated to let those back-ends
who report unclear capacity pass capacity filter, thus there is chance
create_volume() request would fail. In a more general case, when a
volume back-end failed to serve create_volume request for whatever reason
it'd be good that we have a mechanism to 'retry' the request.

So the idea is when volume manager catches the exception from
driver.create_volume() call, it checks if the request is allowed to be
rescheduled (requests that are not: clone volume and create volume from
snapshot while 'snapshot_same_host' option is true), it composes a new
request back to scheduler with additional information to mark this specific
back-end has been tried (so that scheduler may choose to skip this back-end
if needed).  Scheduler is (filter scheduler only, simple and chance
scheduler is not supported) is updated as well so that it only retry
scheduler_max_attempts times.  In order to skip/rule out previously tried
back-ends in next schedule task, a new RetryFilter is added.

Changes:
1) volume RPC API create_volume() is updated with new parameters
to save original request information in case rescheduling is needed.
This bumps volume RPC API to 1.4.

2) implementation of create_volume() method in volume API is
refactored in order to distinguish if a request is allowed to
do reschedule (i.e. currently create volume from source volume
bypasses scheduler, not rescheduling is allowed).

3) add reschedule functionality in create_volume() of volume
manager so that it's able to send the request back to scheduler.

4) add schedule_max_attempts config option in scheduler/driver.py

5) add RetryFitler

6) change scheduler_driver default option to FilterScheduler

Change-Id: Ia46b5eb4dc033d73734b6aea82ada34ba5731075
2013-02-14 23:36:58 +08:00

81 lines
2.8 KiB
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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.
import setuptools
from cinder.openstack.common import setup as common_setup
requires = common_setup.parse_requirements()
project = 'cinder'
filters = [
"AvailabilityZoneFilter = "
"cinder.openstack.common.scheduler.filters."
"availability_zone_filter:AvailabilityZoneFilter",
"CapabilitiesFilter = "
"cinder.openstack.common.scheduler.filters."
"capabilities_filter:CapabilitiesFilter",
"CapacityFilter = "
"cinder.scheduler.filters.capacity_filter:CapacityFilter",
"JsonFilter = "
"cinder.openstack.common.scheduler.filters.json_filter:JsonFilter",
"RetryFilter = "
"cinder.scheduler.filters.retry_filter:RetryFilter",
]
weights = [
"CapacityWeigher = cinder.scheduler.weights.capacity:CapacityWeigher",
]
setuptools.setup(
name=project,
version=common_setup.get_version(project, '2013.1'),
description='block storage service',
author='OpenStack',
author_email='cinder@lists.launchpad.net',
url='http://www.openstack.org/',
classifiers=[
'Environment :: OpenStack',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
cmdclass=common_setup.get_cmdclass(),
packages=setuptools.find_packages(exclude=['bin', 'smoketests']),
install_requires=requires,
entry_points={
'cinder.scheduler.filters': filters,
'cinder.scheduler.weights': weights,
},
include_package_data=True,
test_suite='nose.collector',
setup_requires=['setuptools_git>=0.4'],
scripts=['bin/cinder-all',
'bin/cinder-api',
'bin/cinder-clear-rabbit-queues',
'bin/cinder-manage',
'bin/cinder-rootwrap',
'bin/cinder-scheduler',
'bin/cinder-volume',
'bin/cinder-volume-usage-audit'],
py_modules=[])