~zulcss/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/scheduler/filters/io_ops_filter.py

  • Committer: Chuck Short
  • Date: 2012-11-26 19:48:39 UTC
  • mfrom: (94.1.1 raring-proposed)
  • Revision ID: zulcss@ubuntu.com-20121126194839-5j2rglv6l5hnt2pm
* New upstream release for the Ubuntu Cloud Archive.
* debian/control: Ensure novaclient is upgraded with nova,
  require python-keystoneclient >= 1:2.9.0. (LP: #1073289)
* debian/patches/{ubuntu/*, rbd-security.patch}: Dropped, applied
  upstream.
* debian/control: Add python-testtools to Build-Depends.
* New upstream version.
* Refreshed debian/patches/avoid_setuptools_git_dependency.patch.
* debian/rules: FTBFS if missing binaries.
* debian/nova-scheudler.install: Add missing rabbit-queues and
  nova-rpc-zmq-receiver.
* Remove nova-volume since it doesnt exist anymore, transition to cinder-*.
* debian/rules: install apport hook in the right place.
* debian/patches/ubuntu-show-tests.patch: Display test failures.
* debian/control: Add depends on genisoimage
* debian/control: Suggest guestmount.
* debian/control: Suggest websockify. (LP: #1076442)
* debian/nova.conf: Disable nova-volume service.
* debian/control: Depend on xen-system-* rather than the hypervisor.
* debian/control, debian/mans/nova-conductor.8, debian/nova-conductor.init,
  debian/nova-conductor.install, debian/nova-conductor.logrotate
  debian/nova-conductor.manpages, debian/nova-conductor.postrm
  debian/nova-conductor.upstart.in: Add nova-conductor service.
* debian/control: Add python-fixtures as a build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2012 OpenStack, LLC.
 
2
# All Rights Reserved.
 
3
#
 
4
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
5
#    not use this file except in compliance with the License. You may obtain
 
6
#    a copy of the License at
 
7
#
 
8
#         http://www.apache.org/licenses/LICENSE-2.0
 
9
#
 
10
#    Unless required by applicable law or agreed to in writing, software
 
11
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
12
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
13
#    License for the specific language governing permissions and limitations
 
14
#    under the License.
 
15
 
 
16
from nova.openstack.common import cfg
 
17
from nova.openstack.common import log as logging
 
18
from nova.scheduler import filters
 
19
 
 
20
LOG = logging.getLogger(__name__)
 
21
 
 
22
max_io_ops_per_host_opt = cfg.IntOpt("max_io_ops_per_host",
 
23
        default=8,
 
24
        help="Ignore hosts that have too many builds/resizes/snaps/migrations")
 
25
 
 
26
CONF = cfg.CONF
 
27
CONF.register_opt(max_io_ops_per_host_opt)
 
28
 
 
29
 
 
30
class IoOpsFilter(filters.BaseHostFilter):
 
31
    """Filter out hosts with too many concurrent I/O operations"""
 
32
 
 
33
    def host_passes(self, host_state, filter_properties):
 
34
        """Use information about current vm and task states collected from
 
35
        compute node statistics to decide whether to filter.
 
36
        """
 
37
        num_io_ops = host_state.num_io_ops
 
38
        max_io_ops = CONF.max_io_ops_per_host
 
39
        passes = num_io_ops < max_io_ops
 
40
        if not passes:
 
41
            LOG.debug(_("%(host_state)s fails I/O ops check: Max IOs per host "
 
42
                        "is set to %(max_io_ops)s"), locals())
 
43
        return passes