<commit_before># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2012 Grid Dynamics
# 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 os

from nova.virt.libvirt import config
from nova.virt.libvirt import imagebackend


class Backend(object):
    def __init__(self, use_cow):
        pass

    def image(self, instance, name, image_type=''):
        class FakeImage(imagebackend.Image):
            def __init__(self, instance, name):
                self.path = os.path.join(instance['name'], name)

            def create_image(self, prepare_template, base,
                              size, *args, **kwargs):
                pass

            def cache(self, fetch_func, filename, size=None, *args, **kwargs):
                pass

            def snapshot(self, name):
                pass

            def libvirt_info(self, disk_bus, disk_dev, device_type,
                             cache_mode):
                info = config.LibvirtConfigGuestDisk()
                info.source_type = 'file'
                info.source_device = device_type
                info.target_bus = disk_bus
                info.target_dev = disk_dev
                info.driver_cache = cache_mode
                info.driver_format = 'raw'
                info.source_path = self.path
                return info
<commit_msg>Add support for instance disk IO control.<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2012 Grid Dynamics
# 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 os

from nova.virt.libvirt import config
from nova.virt.libvirt import imagebackend


class Backend(object):
    def __init__(self, use_cow):
        pass

    def image(self, instance, name, image_type=''):
        class FakeImage(imagebackend.Image):
            def __init__(self, instance, name):
                self.path = os.path.join(instance['name'], name)

            def create_image(self, prepare_template, base,
                              size, *args, **kwargs):
                pass

            def cache(self, fetch_func, filename, size=None, *args, **kwargs):
                pass

            def snapshot(self, name):
                pass

            def libvirt_info(self, disk_bus, disk_dev, device_type,
                             cache_mode, extra_specs):
                info = config.LibvirtConfigGuestDisk()
                info.source_type = 'file'
                info.source_device = device_type
                info.target_bus = disk_bus
                info.target_dev = disk_dev
                info.driver_cache = cache_mode
                info.driver_format = 'raw'
                info.source_path = self.path
                return info

{'fraction_non_alphanumeric': 0.07645663063538097, 'fraction_numerical': 0.005800158186132349, 'mean_word_length': 2.0870626525630596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7126522', 'n_tokens_mistral': 1016, 'n_tokens_neox': 971, 'n_words': 335}