Sync charms.ceph to get code cleanup changes
Also had to fix some imports due to changes implemented as part of the cleanup. Change-Id: Ie232828056a7f15525f820e8e106264b22697168
This commit is contained in:
parent
a07585c0fe
commit
4bcdddc4a3
|
@ -27,7 +27,7 @@ from charmhelpers.core.hookenv import (
|
|||
action_fail,
|
||||
)
|
||||
|
||||
from ceph import get_local_osd_ids
|
||||
from ceph.utils import get_local_osd_ids
|
||||
from ceph_hooks import assess_status
|
||||
|
||||
from utils import (
|
||||
|
|
|
@ -22,7 +22,7 @@ import socket
|
|||
import netifaces
|
||||
|
||||
sys.path.append('lib')
|
||||
import ceph
|
||||
import ceph.utils as ceph
|
||||
from charmhelpers.core import hookenv
|
||||
from charmhelpers.core.hookenv import (
|
||||
log,
|
||||
|
|
2136
lib/ceph/__init__.py
2136
lib/ceph/__init__.py
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2016 Canonical Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -16,19 +14,21 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
from ceph.utils import (
|
||||
get_cephfs,
|
||||
get_osd_weight
|
||||
)
|
||||
from ceph.crush_utils import Crushmap
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
log,
|
||||
DEBUG,
|
||||
INFO,
|
||||
ERROR,
|
||||
)
|
||||
from ceph import (
|
||||
get_cephfs,
|
||||
get_osd_weight
|
||||
)
|
||||
from ceph.ceph_helpers import Crushmap
|
||||
from charmhelpers.contrib.storage.linux.ceph import (
|
||||
create_erasure_profile,
|
||||
delete_pool,
|
||||
|
@ -112,6 +112,9 @@ def process_requests(reqs):
|
|||
|
||||
This is a versioned api. API version must be supplied by the client making
|
||||
the request.
|
||||
|
||||
:param reqs: dict of request parameters.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
request_id = reqs.get('request-id')
|
||||
try:
|
||||
|
@ -140,6 +143,12 @@ def process_requests(reqs):
|
|||
|
||||
|
||||
def handle_create_erasure_profile(request, service):
|
||||
"""Create an erasure profile.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
# "local" | "shec" or it defaults to "jerasure"
|
||||
erasure_type = request.get('erasure-type')
|
||||
# "host" | "rack" or it defaults to "host" # Any valid Ceph bucket
|
||||
|
@ -160,10 +169,9 @@ def handle_create_erasure_profile(request, service):
|
|||
|
||||
|
||||
def handle_add_permissions_to_key(request, service):
|
||||
"""
|
||||
Groups are defined by the key cephx.groups.(namespace-)?-(name). This key
|
||||
will contain a dict serialized to JSON with data about the group, including
|
||||
pools and members.
|
||||
"""Groups are defined by the key cephx.groups.(namespace-)?-(name). This
|
||||
key will contain a dict serialized to JSON with data about the group,
|
||||
including pools and members.
|
||||
|
||||
A group can optionally have a namespace defined that will be used to
|
||||
further restrict pool access.
|
||||
|
@ -238,8 +246,7 @@ def pool_permission_list_for_service(service):
|
|||
|
||||
|
||||
def get_service_groups(service, namespace=None):
|
||||
"""
|
||||
Services are objects stored with some metadata, they look like (for a
|
||||
"""Services are objects stored with some metadata, they look like (for a
|
||||
service named "nova"):
|
||||
{
|
||||
group_names: {'rwx': ['images']},
|
||||
|
@ -272,7 +279,7 @@ def get_service_groups(service, namespace=None):
|
|||
|
||||
|
||||
def _build_service_groups(service, namespace=None):
|
||||
'''Rebuild the 'groups' dict for a service group
|
||||
"""Rebuild the 'groups' dict for a service group
|
||||
|
||||
:returns: dict: dictionary keyed by group name of the following
|
||||
format:
|
||||
|
@ -287,7 +294,7 @@ def _build_service_groups(service, namespace=None):
|
|||
services: ['nova']
|
||||
}
|
||||
}
|
||||
'''
|
||||
"""
|
||||
all_groups = {}
|
||||
for _, groups in service['group_names'].items():
|
||||
for group in groups:
|
||||
|
@ -299,8 +306,7 @@ def _build_service_groups(service, namespace=None):
|
|||
|
||||
|
||||
def get_group(group_name):
|
||||
"""
|
||||
A group is a structure to hold data about a named group, structured as:
|
||||
"""A group is a structure to hold data about a named group, structured as:
|
||||
{
|
||||
pools: ['glance'],
|
||||
services: ['nova']
|
||||
|
@ -344,6 +350,12 @@ def get_group_key(group_name):
|
|||
|
||||
|
||||
def handle_erasure_pool(request, service):
|
||||
"""Create a new erasure coded pool.
|
||||
|
||||
:param request: dict of request operations and params.
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0.
|
||||
"""
|
||||
pool_name = request.get('name')
|
||||
erasure_profile = request.get('erasure-profile')
|
||||
quota = request.get('max-bytes')
|
||||
|
@ -390,6 +402,12 @@ def handle_erasure_pool(request, service):
|
|||
|
||||
|
||||
def handle_replicated_pool(request, service):
|
||||
"""Create a new replicated pool.
|
||||
|
||||
:param request: dict of request operations and params.
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0.
|
||||
"""
|
||||
pool_name = request.get('name')
|
||||
replicas = request.get('replicas')
|
||||
quota = request.get('max-bytes')
|
||||
|
@ -441,6 +459,13 @@ def handle_replicated_pool(request, service):
|
|||
|
||||
|
||||
def handle_create_cache_tier(request, service):
|
||||
"""Create a cache tier on a cold pool. Modes supported are
|
||||
"writeback" and "readonly".
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
# mode = "writeback" | "readonly"
|
||||
storage_pool = request.get('cold-pool')
|
||||
cache_pool = request.get('hot-pool')
|
||||
|
@ -462,6 +487,12 @@ def handle_create_cache_tier(request, service):
|
|||
|
||||
|
||||
def handle_remove_cache_tier(request, service):
|
||||
"""Remove a cache tier from the cold pool.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
storage_pool = request.get('cold-pool')
|
||||
cache_pool = request.get('hot-pool')
|
||||
# cache and storage pool must exist first
|
||||
|
@ -477,6 +508,12 @@ def handle_remove_cache_tier(request, service):
|
|||
|
||||
|
||||
def handle_set_pool_value(request, service):
|
||||
"""Sets an arbitrary pool value.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
# Set arbitrary pool values
|
||||
params = {'pool': request.get('name'),
|
||||
'key': request.get('key'),
|
||||
|
@ -501,6 +538,12 @@ def handle_set_pool_value(request, service):
|
|||
|
||||
|
||||
def handle_rgw_regionmap_update(request, service):
|
||||
"""Change the radosgw region map.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
name = request.get('client-name')
|
||||
if not name:
|
||||
msg = "Missing rgw-region or client-name params"
|
||||
|
@ -516,6 +559,12 @@ def handle_rgw_regionmap_update(request, service):
|
|||
|
||||
|
||||
def handle_rgw_regionmap_default(request, service):
|
||||
"""Create a radosgw region map.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
region = request.get('rgw-region')
|
||||
name = request.get('client-name')
|
||||
if not region or not name:
|
||||
|
@ -537,6 +586,12 @@ def handle_rgw_regionmap_default(request, service):
|
|||
|
||||
|
||||
def handle_rgw_zone_set(request, service):
|
||||
"""Create a radosgw zone.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
json_file = request.get('zone-json')
|
||||
name = request.get('client-name')
|
||||
region_name = request.get('region-name')
|
||||
|
@ -567,6 +622,12 @@ def handle_rgw_zone_set(request, service):
|
|||
|
||||
|
||||
def handle_put_osd_in_bucket(request, service):
|
||||
"""Move an osd into a specified crush bucket.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
osd_id = request.get('osd')
|
||||
target_bucket = request.get('bucket')
|
||||
if not osd_id or not target_bucket:
|
||||
|
@ -597,6 +658,12 @@ def handle_put_osd_in_bucket(request, service):
|
|||
|
||||
|
||||
def handle_rgw_create_user(request, service):
|
||||
"""Create a new rados gateway user.
|
||||
|
||||
:param request: dict of request operations and params
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
user_id = request.get('rgw-uid')
|
||||
display_name = request.get('display-name')
|
||||
name = request.get('client-name')
|
||||
|
@ -630,11 +697,11 @@ def handle_rgw_create_user(request, service):
|
|||
|
||||
|
||||
def handle_create_cephfs(request, service):
|
||||
"""
|
||||
Create a new cephfs.
|
||||
"""Create a new cephfs.
|
||||
|
||||
:param request: The broker request
|
||||
:param service: The cephx user to run this command under
|
||||
:return:
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
cephfs_name = request.get('mds_name')
|
||||
data_pool = request.get('data_pool')
|
||||
|
@ -678,6 +745,12 @@ def handle_create_cephfs(request, service):
|
|||
|
||||
def handle_rgw_region_set(request, service):
|
||||
# radosgw-admin region set --infile us.json --name client.radosgw.us-east-1
|
||||
"""Set the rados gateway region.
|
||||
|
||||
:param request: dict. The broker request.
|
||||
:param service: The ceph client to run the command under.
|
||||
:returns: dict. exit-code and reason if not 0
|
||||
"""
|
||||
json_file = request.get('region-json')
|
||||
name = request.get('client-name')
|
||||
region_name = request.get('region-name')
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,149 @@
|
|||
# Copyright 2014 Canonical Limited.
|
||||
#
|
||||
# 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 re
|
||||
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
log,
|
||||
ERROR,
|
||||
)
|
||||
|
||||
CRUSH_BUCKET = """root {name} {{
|
||||
id {id} # do not change unnecessarily
|
||||
# weight 0.000
|
||||
alg straw
|
||||
hash 0 # rjenkins1
|
||||
}}
|
||||
|
||||
rule {name} {{
|
||||
ruleset 0
|
||||
type replicated
|
||||
min_size 1
|
||||
max_size 10
|
||||
step take {name}
|
||||
step chooseleaf firstn 0 type host
|
||||
step emit
|
||||
}}"""
|
||||
|
||||
# This regular expression looks for a string like:
|
||||
# root NAME {
|
||||
# id NUMBER
|
||||
# so that we can extract NAME and ID from the crushmap
|
||||
CRUSHMAP_BUCKETS_RE = re.compile(r"root\s+(.+)\s+\{\s*id\s+(-?\d+)")
|
||||
|
||||
# This regular expression looks for ID strings in the crushmap like:
|
||||
# id NUMBER
|
||||
# so that we can extract the IDs from a crushmap
|
||||
CRUSHMAP_ID_RE = re.compile(r"id\s+(-?\d+)")
|
||||
|
||||
|
||||
class Crushmap(object):
|
||||
"""An object oriented approach to Ceph crushmap management."""
|
||||
|
||||
def __init__(self):
|
||||
self._crushmap = self.load_crushmap()
|
||||
roots = re.findall(CRUSHMAP_BUCKETS_RE, self._crushmap)
|
||||
buckets = []
|
||||
ids = list(map(
|
||||
lambda x: int(x),
|
||||
re.findall(CRUSHMAP_ID_RE, self._crushmap)))
|
||||
ids.sort()
|
||||
if roots != []:
|
||||
for root in roots:
|
||||
buckets.append(CRUSHBucket(root[0], root[1], True))
|
||||
|
||||
self._buckets = buckets
|
||||
if ids != []:
|
||||
self._ids = ids
|
||||
else:
|
||||
self._ids = [0]
|
||||
|
||||
def load_crushmap(self):
|
||||
try:
|
||||
crush = check_output(['ceph', 'osd', 'getcrushmap'])
|
||||
return check_output(['crushtool', '-d', '-'], stdin=crush.stdout)
|
||||
except CalledProcessError as e:
|
||||
log("Error occured while loading and decompiling CRUSH map:"
|
||||
"{}".format(e), ERROR)
|
||||
raise "Failed to read CRUSH map"
|
||||
|
||||
def ensure_bucket_is_present(self, bucket_name):
|
||||
if bucket_name not in [bucket.name for bucket in self.buckets()]:
|
||||
self.add_bucket(bucket_name)
|
||||
self.save()
|
||||
|
||||
def buckets(self):
|
||||
"""Return a list of buckets that are in the Crushmap."""
|
||||
return self._buckets
|
||||
|
||||
def add_bucket(self, bucket_name):
|
||||
"""Add a named bucket to Ceph"""
|
||||
new_id = min(self._ids) - 1
|
||||
self._ids.append(new_id)
|
||||
self._buckets.append(CRUSHBucket(bucket_name, new_id))
|
||||
|
||||
def save(self):
|
||||
"""Persist Crushmap to Ceph"""
|
||||
try:
|
||||
crushmap = self.build_crushmap()
|
||||
compiled = check_output(['crushtool', '-c', '/dev/stdin', '-o',
|
||||
'/dev/stdout'], stdin=crushmap)
|
||||
ceph_output = check_output(['ceph', 'osd', 'setcrushmap', '-i',
|
||||
'/dev/stdin'], stdin=compiled)
|
||||
return ceph_output
|
||||
except CalledProcessError as e:
|
||||
log("save error: {}".format(e))
|
||||
raise "Failed to save CRUSH map."
|
||||
|
||||
def build_crushmap(self):
|
||||
"""Modifies the current CRUSH map to include the new buckets"""
|
||||
tmp_crushmap = self._crushmap
|
||||
for bucket in self._buckets:
|
||||
if not bucket.default:
|
||||
tmp_crushmap = "{}\n\n{}".format(
|
||||
tmp_crushmap,
|
||||
Crushmap.bucket_string(bucket.name, bucket.id))
|
||||
|
||||
return tmp_crushmap
|
||||
|
||||
@staticmethod
|
||||
def bucket_string(name, id):
|
||||
return CRUSH_BUCKET.format(name=name, id=id)
|
||||
|
||||
|
||||
class CRUSHBucket(object):
|
||||
"""CRUSH bucket description object."""
|
||||
|
||||
def __init__(self, name, id, default=False):
|
||||
self.name = name
|
||||
self.id = int(id)
|
||||
self.default = default
|
||||
|
||||
def __repr__(self):
|
||||
return "Bucket {{Name: {name}, ID: {id}}}".format(
|
||||
name=self.name, id=self.id)
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Override the default Equals behavior"""
|
||||
if isinstance(other, self.__class__):
|
||||
return self.__dict__ == other.__dict__
|
||||
return NotImplemented
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Define a non-equality test"""
|
||||
if isinstance(other, self.__class__):
|
||||
return not self.__eq__(other)
|
||||
return NotImplemented
|
File diff suppressed because it is too large
Load Diff
85
lib/setup.py
85
lib/setup.py
|
@ -1,85 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
version = "0.0.1.dev1"
|
||||
install_require = [
|
||||
]
|
||||
|
||||
tests_require = [
|
||||
'tox >= 2.3.1',
|
||||
]
|
||||
|
||||
|
||||
class Tox(TestCommand):
|
||||
|
||||
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
|
||||
|
||||
def initialize_options(self):
|
||||
TestCommand.initialize_options(self)
|
||||
self.tox_args = None
|
||||
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
|
||||
def run_tests(self):
|
||||
# import here, cause outside the eggs aren't loaded
|
||||
import tox
|
||||
import shlex
|
||||
args = self.tox_args
|
||||
# remove the 'test' arg from argv as tox passes it to ostestr which
|
||||
# breaks it.
|
||||
sys.argv.pop()
|
||||
if args:
|
||||
args = shlex.split(self.tox_args)
|
||||
errno = tox.cmdline(args=args)
|
||||
sys.exit(errno)
|
||||
|
||||
|
||||
if sys.argv[-1] == 'publish':
|
||||
os.system("python setup.py sdist upload")
|
||||
os.system("python setup.py bdist_wheel upload")
|
||||
sys.exit()
|
||||
|
||||
|
||||
if sys.argv[-1] == 'tag':
|
||||
os.system("git tag -a %s -m 'version %s'" % (version, version))
|
||||
os.system("git push --tags")
|
||||
sys.exit()
|
||||
|
||||
|
||||
setup(
|
||||
name='charms.ceph',
|
||||
version=version,
|
||||
description='Provide base module for ceph charms.',
|
||||
classifiers=[
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: System",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
"Topic :: System :: Software Distribution",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
],
|
||||
url='https://github.com/openstack/charms.ceph',
|
||||
author='OpenStack Charmers',
|
||||
author_email='openstack-dev@lists.openstack.org',
|
||||
license='Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0',
|
||||
packages=find_packages(exclude=["unit_tests"]),
|
||||
zip_safe=False,
|
||||
cmdclass={'test': Tox},
|
||||
install_requires=install_require,
|
||||
extras_require={
|
||||
'testing': tests_require,
|
||||
},
|
||||
tests_require=tests_require,
|
||||
)
|
|
@ -18,7 +18,7 @@ import posix
|
|||
from mock import call, Mock, patch
|
||||
|
||||
import test_utils
|
||||
import ceph
|
||||
import ceph.utils as ceph
|
||||
import replace_osd
|
||||
|
||||
TO_PATCH = [
|
||||
|
@ -73,13 +73,13 @@ class ReplaceOsdTestCase(test_utils.CharmTestCase):
|
|||
])
|
||||
assert ret == 0
|
||||
|
||||
@patch('ceph.mounts')
|
||||
@patch('ceph.check_output')
|
||||
@patch('ceph.umount')
|
||||
@patch('ceph.osdize')
|
||||
@patch('ceph.shutil')
|
||||
@patch('ceph.systemd')
|
||||
@patch('ceph.ceph_user')
|
||||
@patch.object(ceph, 'mounts')
|
||||
@patch.object(ceph.subprocess, 'check_output')
|
||||
@patch.object(ceph, 'umount')
|
||||
@patch.object(ceph, 'osdize')
|
||||
@patch.object(ceph, 'shutil')
|
||||
@patch.object(ceph, 'systemd')
|
||||
@patch.object(ceph, 'ceph_user')
|
||||
def test_replace_osd(self, ceph_user, systemd, shutil, osdize, umount,
|
||||
check_output, mounts):
|
||||
ceph_user.return_value = "ceph"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
__author__ = 'Chris Holcombe <chris.holcombe@canonical.com>'
|
||||
from mock import patch, call
|
||||
import test_utils
|
||||
import ceph
|
||||
import ceph.utils as ceph
|
||||
|
||||
TO_PATCH = [
|
||||
'hookenv',
|
||||
|
@ -14,7 +14,7 @@ class PerformanceTestCase(test_utils.CharmTestCase):
|
|||
def setUp(self):
|
||||
super(PerformanceTestCase, self).setUp(ceph, TO_PATCH)
|
||||
|
||||
@patch.object(ceph, 'check_output')
|
||||
@patch.object(ceph.subprocess, 'check_output')
|
||||
@patch.object(ceph, 'get_link_speed')
|
||||
@patch.object(ceph, 'save_sysctls')
|
||||
def test_tune_nic(self, save_sysctls, get_link_speed, check_output):
|
||||
|
@ -42,19 +42,19 @@ class PerformanceTestCase(test_utils.CharmTestCase):
|
|||
call('maintenance', 'Tuning device eth0'),
|
||||
])
|
||||
|
||||
@patch('ceph.check_output')
|
||||
@patch.object(ceph.subprocess, 'check_output')
|
||||
def test_get_block_uuid(self, check_output):
|
||||
check_output.return_value = \
|
||||
'UUID=378f3c86-b21a-4172-832d-e2b3d4bc7511\nTYPE=ext2\n'
|
||||
uuid = ceph.get_block_uuid('/dev/sda1')
|
||||
self.assertEqual(uuid, '378f3c86-b21a-4172-832d-e2b3d4bc7511')
|
||||
|
||||
@patch('ceph.persist_settings')
|
||||
@patch('ceph.set_hdd_read_ahead')
|
||||
@patch('ceph.get_max_sectors_kb')
|
||||
@patch('ceph.get_max_hw_sectors_kb')
|
||||
@patch('ceph.set_max_sectors_kb')
|
||||
@patch('ceph.get_block_uuid')
|
||||
@patch.object(ceph, 'persist_settings')
|
||||
@patch.object(ceph, 'set_hdd_read_ahead')
|
||||
@patch.object(ceph, 'get_max_sectors_kb')
|
||||
@patch.object(ceph, 'get_max_hw_sectors_kb')
|
||||
@patch.object(ceph, 'set_max_sectors_kb')
|
||||
@patch.object(ceph, 'get_block_uuid')
|
||||
def test_tune_dev(self,
|
||||
block_uuid,
|
||||
set_max_sectors_kb,
|
||||
|
@ -84,12 +84,12 @@ class PerformanceTestCase(test_utils.CharmTestCase):
|
|||
call('maintenance', 'Finished tuning device /dev/sda')
|
||||
])
|
||||
|
||||
@patch('ceph.persist_settings')
|
||||
@patch('ceph.set_hdd_read_ahead')
|
||||
@patch('ceph.get_max_sectors_kb')
|
||||
@patch('ceph.get_max_hw_sectors_kb')
|
||||
@patch('ceph.set_max_sectors_kb')
|
||||
@patch('ceph.get_block_uuid')
|
||||
@patch.object(ceph, 'persist_settings')
|
||||
@patch.object(ceph, 'set_hdd_read_ahead')
|
||||
@patch.object(ceph, 'get_max_sectors_kb')
|
||||
@patch.object(ceph, 'get_max_hw_sectors_kb')
|
||||
@patch.object(ceph, 'set_max_sectors_kb')
|
||||
@patch.object(ceph, 'get_block_uuid')
|
||||
def test_tune_dev_2(self,
|
||||
block_uuid,
|
||||
set_max_sectors_kb,
|
||||
|
@ -118,7 +118,7 @@ class PerformanceTestCase(test_utils.CharmTestCase):
|
|||
call('maintenance', 'Finished tuning device /dev/sda')
|
||||
])
|
||||
|
||||
@patch('ceph.check_output')
|
||||
@patch.object(ceph.subprocess, 'check_output')
|
||||
def test_set_hdd_read_ahead(self, check_output):
|
||||
ceph.set_hdd_read_ahead(dev_name='/dev/sda')
|
||||
check_output.assert_called_with(
|
||||
|
|
Loading…
Reference in New Issue