From 533d5dbb71897e2d2ae019bf3f0bca627671ebe2 Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Wed, 24 Jul 2019 16:13:59 -0500 Subject: [PATCH] Completely remove fake_libvirt_utils. Its dead Jim. Change-Id: I0d48fc17095ca35c6c026e9d2dfbf997b47fcf3a --- .../unit/virt/libvirt/fake_libvirt_utils.py | 195 ------------------ 1 file changed, 195 deletions(-) delete mode 100644 nova/tests/unit/virt/libvirt/fake_libvirt_utils.py diff --git a/nova/tests/unit/virt/libvirt/fake_libvirt_utils.py b/nova/tests/unit/virt/libvirt/fake_libvirt_utils.py deleted file mode 100644 index 882984d2d5..0000000000 --- a/nova/tests/unit/virt/libvirt/fake_libvirt_utils.py +++ /dev/null @@ -1,195 +0,0 @@ -# Copyright (c) 2011 OpenStack Foundation -# -# 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 io -import os - -from nova import objects -from nova.virt.libvirt import utils as libvirt_utils - - -files = {'console.log': b''} -disk_sizes = {} -disk_backing_files = {} -disk_type = "qcow2" - -RESIZE_SNAPSHOT_NAME = libvirt_utils.RESIZE_SNAPSHOT_NAME -CPU_TRAITS_MAPPING = libvirt_utils.CPU_TRAITS_MAPPING - - -def create_image(disk_format, path, size): - pass - - -def create_cow_image(backing_file, path, size=None): - pass - - -def create_ploop_image(disk_format, path, size, fs_type): - pass - - -def get_disk_size(path, format=None): - return 0 - - -def get_disk_backing_file(path, basename=True, format=None): - backing_file = disk_backing_files.get(path, None) - if backing_file and basename: - backing_file = os.path.basename(backing_file) - - return backing_file - - -def get_disk_type_from_path(path): - if disk_type in ('raw', 'qcow2'): - return None - return disk_type - - -def copy_image(src, dest, host=None, receive=False, - on_execute=None, on_completion=None, - compression=True): - pass - - -def resize2fs(path): - pass - - -def create_lvm_image(vg, lv, size, sparse=False): - pass - - -def volume_group_free_space(vg): - pass - - -def remove_logical_volumes(*paths): - pass - - -def write_to_file(path, contents, umask=None): - pass - - -def extract_snapshot(disk_path, source_fmt, out_path, dest_fmt): - files[out_path] = b'' - - -class File(object): - def __init__(self, path, mode=None): - if path in files: - self.fp = io.BytesIO(files[path]) - else: - self.fp = io.BytesIO(files[os.path.split(path)[-1]]) - - def __enter__(self): - return self.fp - - def __exit__(self, *args): - return - - def close(self, *args, **kwargs): - self.fp.close() - - -def file_open(path, mode=None): - return File(path, mode) - - -def find_disk(virt_dom): - if disk_type == 'lvm': - return ("/dev/nova-vg/lv", "raw") - elif disk_type in ['raw', 'qcow2']: - return ("filename", disk_type) - else: - return ("unknown_type_disk", None) - - -def load_file(path): - if os.path.exists(path): - with open(path, 'r') as fp: - return fp.read() - else: - return '' - - -def logical_volume_info(path): - return {} - - -def get_fs_info(path): - return {'total': 128 * (1024 ** 3), - 'used': 44 * (1024 ** 3), - 'free': 84 * (1024 ** 3)} - - -def fetch_image(context, target, image_id, trusted_certs=None): - if trusted_certs is not None: - assert isinstance(trusted_certs, objects.TrustedCerts) - - -def fetch_raw_image(context, target, image_id, trusted_certs=None): - if trusted_certs is not None: - assert isinstance(trusted_certs, objects.TrustedCerts) - - -def get_instance_path(instance, relative=False): - return libvirt_utils.get_instance_path(instance, relative=relative) - - -def get_instance_path_at_destination(instance, migrate_data=None): - return libvirt_utils.get_instance_path_at_destination(instance, - migrate_data) - - -def pick_disk_driver_name(hypervisor_version, is_block_dev=False): - return "qemu" - - -def is_valid_hostname(name): - return True - - -def chown_for_id_maps(path, id_maps): - pass - - -def get_arch(image_meta): - return libvirt_utils.get_arch(image_meta) - - -def version_to_string(version): - return libvirt_utils.version_to_string(version) - - -def cpu_features_to_traits(features): - return libvirt_utils.cpu_features_to_traits(features) - - -def get_machine_type(image_meta): - return libvirt_utils.get_machine_type(image_meta) - - -def get_default_machine_type(arch): - return libvirt_utils.get_default_machine_type(arch) - - -def mdev_name2uuid(mdev_name): - return libvirt_utils.mdev_name2uuid(mdev_name) - - -def mdev_uuid2name(mdev_uuid): - return libvirt_utils.mdev_uuid2name(mdev_uuid)