Blueprint: hyper-v-compute-resize Resize / cold migration is implemented by copying the local disks to a remote SMB share, identified by the configuration option HYPERV.instances_path_share or, if empty, by an administrative share with a remote path corresponding to the configuration option instances_path. The source instance directory is renamed by adding a suffix "_revert" and preserved until the migration is confirmed or reverted. In the former case the directory will be deleted and in the latter renamed to the original name. The VM corresponding to the instance is deleted on the source host and recreated on the target. Any mapped volume is disconnected on the source and reattached to the new VM on the target host. In case of resize operations, the local VHD file is resized according to the new flavor limits. Due to VHD limitations, an attempt to resize a disk to a smaller size will result in an exception. In case of differencing disks (CoW), should the base disk be missing in the target host's cache, it will be downloaded and reconnected to the copied differencing disk. Same host migrations are supported by using a temporary directory with suffix "_tmp" during disk file copy. Unit tests have been added for the new features accordingly. Change-Id: Ieee2afff8061d2ab73a2252b7d2499178d0515fd
73 lines
2.1 KiB
Python
73 lines
2.1 KiB
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright 2013 Cloudbase Solutions Srl
|
|
# 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 io
|
|
import os
|
|
|
|
|
|
class PathUtils(object):
|
|
def open(self, path, mode):
|
|
return io.BytesIO(b'fake content')
|
|
|
|
def exists(self, path):
|
|
return False
|
|
|
|
def makedirs(self, path):
|
|
pass
|
|
|
|
def remove(self, path):
|
|
pass
|
|
|
|
def rename(self, src, dest):
|
|
pass
|
|
|
|
def copyfile(self, src, dest):
|
|
pass
|
|
|
|
def copy(self, src, dest):
|
|
pass
|
|
|
|
def rmtree(self, path):
|
|
pass
|
|
|
|
def get_instances_dir(self, remote_server=None):
|
|
return 'C:\\FakeInstancesPath\\'
|
|
|
|
def get_instance_migr_revert_dir(self, instance_name, create_dir=False,
|
|
remove_dir=False):
|
|
return os.path.join(self.get_instances_dir(), instance_name, '_revert')
|
|
|
|
def get_instance_dir(self, instance_name, remote_server=None,
|
|
create_dir=True, remove_dir=False):
|
|
return os.path.join(self.get_instances_dir(remote_server),
|
|
instance_name)
|
|
|
|
def get_vhd_path(self, instance_name):
|
|
instance_path = self.get_instance_dir(instance_name)
|
|
return os.path.join(instance_path, 'root.vhd')
|
|
|
|
def get_base_vhd_dir(self):
|
|
return os.path.join(self.get_instances_dir(), '_base')
|
|
|
|
def get_export_dir(self, instance_name):
|
|
export_dir = os.path.join(self.get_instances_dir(), 'export',
|
|
instance_name)
|
|
return export_dir
|
|
|
|
def vhd_exists(self, path):
|
|
return False
|