begin_unit
comment|'#  Copyright 2014 IBM Corp.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#    Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'#    not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'#    a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#         http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#    Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'#    License for the specific language governing permissions and limitations'
nl|'\n'
comment|'#    under the License.'
nl|'\n'
nl|'\n'
name|'import'
name|'os'
newline|'\n'
nl|'\n'
name|'import'
name|'mock'
newline|'\n'
name|'from'
name|'os_win'
name|'import'
name|'exceptions'
name|'as'
name|'os_win_exc'
newline|'\n'
name|'from'
name|'oslo_utils'
name|'import'
name|'units'
newline|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'objects'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
name|'import'
name|'fake_instance'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'virt'
op|'.'
name|'hyperv'
name|'import'
name|'test_base'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'virt'
op|'.'
name|'hyperv'
name|'import'
name|'migrationops'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|MigrationOpsTestCase
name|'class'
name|'MigrationOpsTestCase'
op|'('
name|'test_base'
op|'.'
name|'HyperVBaseTestCase'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Unit tests for the Hyper-V MigrationOps class."""'
newline|'\n'
nl|'\n'
DECL|variable|_FAKE_DISK
name|'_FAKE_DISK'
op|'='
string|"'fake_disk'"
newline|'\n'
DECL|variable|_FAKE_TIMEOUT
name|'_FAKE_TIMEOUT'
op|'='
number|'10'
newline|'\n'
DECL|variable|_FAKE_RETRY_INTERVAL
name|'_FAKE_RETRY_INTERVAL'
op|'='
number|'5'
newline|'\n'
nl|'\n'
DECL|member|setUp
name|'def'
name|'setUp'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'super'
op|'('
name|'MigrationOpsTestCase'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'context'
op|'='
string|"'fake-context'"
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'='
name|'migrationops'
op|'.'
name|'MigrationOps'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_hostutils'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmutils'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'='
name|'mock'
op|'.'
name|'Mock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_volumeops'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_imagecache'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
nl|'\n'
DECL|member|_check_migrate_disk_files
dedent|''
name|'def'
name|'_check_migrate_disk_files'
op|'('
name|'self'
op|','
name|'host'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'instance_path'
op|'='
string|"'fake/instance/path'"
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_dir'
op|'.'
name|'return_value'
op|'='
op|'('
nl|'\n'
name|'instance_path'
op|')'
newline|'\n'
name|'get_revert_dir'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_migr_revert_dir'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_hostutils'
op|'.'
name|'get_local_ips'
op|'.'
name|'return_value'
op|'='
op|'['
name|'host'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'return_value'
op|'='
name|'True'
newline|'\n'
nl|'\n'
name|'expected_get_dir'
op|'='
op|'['
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|')'
op|']'
newline|'\n'
name|'expected_move_calls'
op|'='
op|'['
name|'mock'
op|'.'
name|'call'
op|'('
name|'instance_path'
op|','
nl|'\n'
name|'get_revert_dir'
op|'.'
name|'return_value'
op|')'
op|']'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_migrate_disk_files'
op|'('
nl|'\n'
name|'instance_name'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|','
nl|'\n'
name|'disk_files'
op|'='
op|'['
name|'self'
op|'.'
name|'_FAKE_DISK'
op|']'
op|','
nl|'\n'
name|'dest'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_hostutils'
op|'.'
name|'get_local_ips'
op|'.'
name|'assert_called_once_with'
op|'('
op|')'
newline|'\n'
name|'get_revert_dir'
op|'.'
name|'assert_called_with'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|','
nl|'\n'
name|'remove_dir'
op|'='
name|'True'
op|','
name|'create_dir'
op|'='
name|'True'
op|')'
newline|'\n'
name|'if'
name|'host'
op|'=='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|':'
newline|'\n'
indent|'            '
name|'fake_dest_path'
op|'='
string|"'%s_tmp'"
op|'%'
name|'instance_path'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_dest_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'rmtree'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_dest_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'makedirs'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_dest_path'
op|')'
newline|'\n'
name|'expected_move_calls'
op|'.'
name|'append'
op|'('
name|'mock'
op|'.'
name|'call'
op|'('
name|'fake_dest_path'
op|','
nl|'\n'
name|'instance_path'
op|')'
op|')'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|'            '
name|'fake_dest_path'
op|'='
name|'instance_path'
newline|'\n'
name|'expected_get_dir'
op|'.'
name|'append'
op|'('
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|','
nl|'\n'
name|'remove_dir'
op|'='
name|'True'
op|')'
op|')'
newline|'\n'
dedent|''
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_dir'
op|'.'
name|'assert_has_calls'
op|'('
nl|'\n'
name|'expected_get_dir'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'copy'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_FAKE_DISK'
op|','
name|'fake_dest_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'move_folder_files'
op|'.'
name|'assert_has_calls'
op|'('
nl|'\n'
name|'expected_move_calls'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_migrate_disk_files
dedent|''
name|'def'
name|'test_migrate_disk_files'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_migrate_disk_files'
op|'('
name|'host'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'other_dest_path'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_migrate_disk_files_same_host
dedent|''
name|'def'
name|'test_migrate_disk_files_same_host'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_migrate_disk_files'
op|'('
name|'host'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
nl|'\n'
string|"'_cleanup_failed_disk_migration'"
op|')'
newline|'\n'
DECL|member|test_migrate_disk_files_exception
name|'def'
name|'test_migrate_disk_files_exception'
op|'('
name|'self'
op|','
name|'mock_cleanup'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'instance_path'
op|'='
string|"'fake/instance/path'"
newline|'\n'
name|'fake_dest_path'
op|'='
string|"'%s_tmp'"
op|'%'
name|'instance_path'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_dir'
op|'.'
name|'return_value'
op|'='
op|'('
nl|'\n'
name|'instance_path'
op|')'
newline|'\n'
name|'get_revert_dir'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_migr_revert_dir'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_hostutils'
op|'.'
name|'get_local_ips'
op|'.'
name|'return_value'
op|'='
op|'['
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'copy'
op|'.'
name|'side_effect'
op|'='
name|'IOError'
op|'('
nl|'\n'
string|'"Expected exception."'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'IOError'
op|','
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_migrate_disk_files'
op|','
nl|'\n'
name|'instance_name'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|','
nl|'\n'
name|'disk_files'
op|'='
op|'['
name|'self'
op|'.'
name|'_FAKE_DISK'
op|']'
op|','
nl|'\n'
name|'dest'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
newline|'\n'
name|'mock_cleanup'
op|'.'
name|'assert_called_once_with'
op|'('
name|'instance_path'
op|','
nl|'\n'
name|'get_revert_dir'
op|'.'
name|'return_value'
op|','
nl|'\n'
name|'fake_dest_path'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_cleanup_failed_disk_migration
dedent|''
name|'def'
name|'test_cleanup_failed_disk_migration'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'return_value'
op|'='
name|'True'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_cleanup_failed_disk_migration'
op|'('
nl|'\n'
name|'instance_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_path'
op|','
nl|'\n'
name|'revert_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'revert_path'
op|','
nl|'\n'
name|'dest_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
newline|'\n'
nl|'\n'
name|'expected'
op|'='
op|'['
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'revert_path'
op|')'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'assert_has_calls'
op|'('
name|'expected'
op|')'
newline|'\n'
name|'move_folder_files'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'move_folder_files'
newline|'\n'
name|'move_folder_files'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'revert_path'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'rmtree'
op|'.'
name|'assert_has_calls'
op|'('
op|'['
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'dest_path'
op|')'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'revert_path'
op|')'
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_check_target_flavor
dedent|''
name|'def'
name|'test_check_target_flavor'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'mock_instance'
op|'.'
name|'root_gb'
op|'='
number|'1'
newline|'\n'
name|'mock_flavor'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
name|'root_gb'
op|'='
number|'0'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InstanceFaultRollback'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_target_flavor'
op|','
nl|'\n'
name|'mock_instance'
op|','
name|'mock_flavor'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_check_and_attach_config_drive
dedent|''
name|'def'
name|'test_check_and_attach_config_drive'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
nl|'\n'
name|'self'
op|'.'
name|'context'
op|','
name|'expected_attrs'
op|'='
op|'['
string|"'system_metadata'"
op|']'
op|')'
newline|'\n'
name|'mock_instance'
op|'.'
name|'config_drive'
op|'='
string|"'True'"
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_and_attach_config_drive'
op|'('
nl|'\n'
name|'mock_instance'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'vm_gen'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'attach_config_drive'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_configdrive_path'
op|'.'
name|'return_value'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'vm_gen'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_check_and_attach_config_drive_unknown_path
dedent|''
name|'def'
name|'test_check_and_attach_config_drive_unknown_path'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
nl|'\n'
name|'self'
op|'.'
name|'context'
op|','
name|'expected_attrs'
op|'='
op|'['
string|"'system_metadata'"
op|']'
op|')'
newline|'\n'
name|'instance'
op|'.'
name|'config_drive'
op|'='
string|"'True'"
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_configdrive_path'
op|'.'
name|'return_value'
op|'='
op|'('
nl|'\n'
name|'None'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'ConfigDriveNotFound'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_and_attach_config_drive'
op|','
nl|'\n'
name|'instance'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'FAKE_VM_GEN'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_migrate_disk_files'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_check_target_flavor'"
op|')'
newline|'\n'
DECL|member|test_migrate_disk_and_power_off
name|'def'
name|'test_migrate_disk_and_power_off'
op|'('
name|'self'
op|','
name|'mock_check_flavor'
op|','
nl|'\n'
name|'mock_migrate_disk_files'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'flavor'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'network_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
nl|'\n'
name|'disk_files'
op|'='
op|'['
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
op|']'
newline|'\n'
name|'volume_drives'
op|'='
op|'['
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
op|']'
newline|'\n'
nl|'\n'
name|'mock_get_vm_st_path'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmutils'
op|'.'
name|'get_vm_storage_paths'
newline|'\n'
name|'mock_get_vm_st_path'
op|'.'
name|'return_value'
op|'='
op|'('
name|'disk_files'
op|','
name|'volume_drives'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'migrate_disk_and_power_off'
op|'('
nl|'\n'
name|'self'
op|'.'
name|'context'
op|','
name|'instance'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'FAKE_DEST'
op|','
name|'flavor'
op|','
nl|'\n'
name|'network_info'
op|','
name|'None'
op|','
name|'self'
op|'.'
name|'_FAKE_TIMEOUT'
op|','
name|'self'
op|'.'
name|'_FAKE_RETRY_INTERVAL'
op|')'
newline|'\n'
nl|'\n'
name|'mock_check_flavor'
op|'.'
name|'assert_called_once_with'
op|'('
name|'instance'
op|','
name|'flavor'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'power_off'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'instance'
op|','
name|'self'
op|'.'
name|'_FAKE_TIMEOUT'
op|','
name|'self'
op|'.'
name|'_FAKE_RETRY_INTERVAL'
op|')'
newline|'\n'
name|'mock_get_vm_st_path'
op|'.'
name|'assert_called_once_with'
op|'('
name|'instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'mock_migrate_disk_files'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'instance'
op|'.'
name|'name'
op|','
name|'disk_files'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'FAKE_DEST'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'destroy'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'instance'
op|','
name|'destroy_disks'
op|'='
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_confirm_migration
dedent|''
name|'def'
name|'test_confirm_migration'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'confirm_migration'
op|'('
nl|'\n'
name|'migration'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'migration'
op|','
name|'instance'
op|'='
name|'mock_instance'
op|','
nl|'\n'
name|'network_info'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|')'
newline|'\n'
name|'get_instance_migr_revert_dir'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_migr_revert_dir'
op|')'
newline|'\n'
name|'get_instance_migr_revert_dir'
op|'.'
name|'assert_called_with'
op|'('
name|'mock_instance'
op|'.'
name|'name'
op|','
nl|'\n'
name|'remove_dir'
op|'='
name|'True'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_revert_migration_files
dedent|''
name|'def'
name|'test_revert_migration_files'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'instance_path'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_dir'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'get_revert_dir'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_migr_revert_dir'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_revert_migration_files'
op|'('
nl|'\n'
name|'instance_name'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'get_instance_dir'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|','
name|'create_dir'
op|'='
name|'False'
op|','
name|'remove_dir'
op|'='
name|'True'
op|')'
newline|'\n'
name|'get_revert_dir'
op|'.'
name|'assert_called_with'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'instance_name'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'rename'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'get_revert_dir'
op|'.'
name|'return_value'
op|','
name|'instance_path'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
nl|'\n'
string|"'_check_and_attach_config_drive'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_revert_migration_files'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ImageMeta'
op|','
string|'"from_instance"'
op|')'
newline|'\n'
DECL|member|_check_finish_revert_migration
name|'def'
name|'_check_finish_revert_migration'
op|'('
name|'self'
op|','
name|'mock_image'
op|','
nl|'\n'
name|'mock_revert_migration_files'
op|','
nl|'\n'
name|'mock_check_attach_config_drive'
op|','
nl|'\n'
name|'boot_from_volume'
op|'='
name|'False'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_image'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'ImageMeta'
op|'.'
name|'from_dict'
op|'('
op|'{'
op|'}'
op|')'
newline|'\n'
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_volumeops'
op|'.'
name|'ebs_root_in_block_devices'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'.'
name|'return_value'
op|'='
name|'boot_from_volume'
newline|'\n'
name|'lookup_ephemeral'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_ephemeral_vhd_path'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'finish_revert_migration'
op|'('
nl|'\n'
name|'context'
op|'='
name|'self'
op|'.'
name|'context'
op|','
name|'instance'
op|'='
name|'mock_instance'
op|','
nl|'\n'
name|'network_info'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|','
nl|'\n'
name|'block_device_info'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'block_device'
op|','
nl|'\n'
name|'power_on'
op|'='
name|'True'
op|')'
newline|'\n'
nl|'\n'
name|'mock_revert_migration_files'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'block_device'
op|')'
newline|'\n'
name|'if'
name|'not'
name|'boot_from_volume'
op|':'
newline|'\n'
indent|'            '
name|'lookup_root_vhd'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_root_vhd_path'
op|')'
newline|'\n'
name|'lookup_root_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock_instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'fake_root_path'
op|'='
name|'lookup_root_vhd'
op|'.'
name|'return_value'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|'            '
name|'fake_root_path'
op|'='
name|'None'
newline|'\n'
nl|'\n'
dedent|''
name|'lookup_ephemeral'
op|'.'
name|'assert_called_with'
op|'('
name|'mock_instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'get_image_vm_gen'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'get_image_vm_generation'
newline|'\n'
name|'get_image_vm_gen'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|'.'
name|'uuid'
op|','
name|'fake_root_path'
op|','
nl|'\n'
name|'test'
op|'.'
name|'MatchType'
op|'('
name|'objects'
op|'.'
name|'ImageMeta'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'create_instance'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'block_device'
op|','
name|'fake_root_path'
op|','
nl|'\n'
name|'lookup_ephemeral'
op|'.'
name|'return_value'
op|','
name|'get_image_vm_gen'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'mock_check_attach_config_drive'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|','
name|'get_image_vm_gen'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'power_on'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_revert_migration_boot_from_volume
dedent|''
name|'def'
name|'test_finish_revert_migration_boot_from_volume'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_finish_revert_migration'
op|'('
name|'boot_from_volume'
op|'='
name|'True'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_revert_migration_not_in_block_device
dedent|''
name|'def'
name|'test_finish_revert_migration_not_in_block_device'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_finish_revert_migration'
op|'('
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_merge_base_vhd
dedent|''
name|'def'
name|'test_merge_base_vhd'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'fake_diff_vhd_path'
op|'='
string|"'fake/diff/path'"
newline|'\n'
name|'fake_base_vhd_path'
op|'='
string|"'fake/base/path'"
newline|'\n'
name|'base_vhd_copy_path'
op|'='
name|'os'
op|'.'
name|'path'
op|'.'
name|'join'
op|'('
nl|'\n'
name|'os'
op|'.'
name|'path'
op|'.'
name|'dirname'
op|'('
name|'fake_diff_vhd_path'
op|')'
op|','
nl|'\n'
name|'os'
op|'.'
name|'path'
op|'.'
name|'basename'
op|'('
name|'fake_base_vhd_path'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_merge_base_vhd'
op|'('
name|'diff_vhd_path'
op|'='
name|'fake_diff_vhd_path'
op|','
nl|'\n'
name|'base_vhd_path'
op|'='
name|'fake_base_vhd_path'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'copyfile'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_base_vhd_path'
op|','
name|'base_vhd_copy_path'
op|')'
newline|'\n'
name|'recon_parent_vhd'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'reconnect_parent_vhd'
newline|'\n'
name|'recon_parent_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
name|'fake_diff_vhd_path'
op|','
nl|'\n'
name|'base_vhd_copy_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'merge_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_diff_vhd_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'rename'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'base_vhd_copy_path'
op|','
name|'fake_diff_vhd_path'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_merge_base_vhd_exception
dedent|''
name|'def'
name|'test_merge_base_vhd_exception'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'fake_diff_vhd_path'
op|'='
string|"'fake/diff/path'"
newline|'\n'
name|'fake_base_vhd_path'
op|'='
string|"'fake/base/path'"
newline|'\n'
name|'base_vhd_copy_path'
op|'='
name|'os'
op|'.'
name|'path'
op|'.'
name|'join'
op|'('
nl|'\n'
name|'os'
op|'.'
name|'path'
op|'.'
name|'dirname'
op|'('
name|'fake_diff_vhd_path'
op|')'
op|','
nl|'\n'
name|'os'
op|'.'
name|'path'
op|'.'
name|'basename'
op|'('
name|'fake_base_vhd_path'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'reconnect_parent_vhd'
op|'.'
name|'side_effect'
op|'='
op|'('
nl|'\n'
name|'os_win_exc'
op|'.'
name|'HyperVException'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'return_value'
op|'='
name|'True'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'os_win_exc'
op|'.'
name|'HyperVException'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_merge_base_vhd'
op|','
nl|'\n'
name|'fake_diff_vhd_path'
op|','
name|'fake_base_vhd_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'exists'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'base_vhd_copy_path'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'remove'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'base_vhd_copy_path'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_resize_vhd'"
op|')'
newline|'\n'
DECL|member|test_check_resize_vhd
name|'def'
name|'test_check_resize_vhd'
op|'('
name|'self'
op|','
name|'mock_resize_vhd'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_resize_vhd'
op|'('
nl|'\n'
name|'vhd_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'vhd_path'
op|','
name|'vhd_info'
op|'='
op|'{'
string|"'VirtualSize'"
op|':'
number|'1'
op|'}'
op|','
nl|'\n'
name|'new_size'
op|'='
number|'2'
op|')'
newline|'\n'
name|'mock_resize_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'vhd_path'
op|','
number|'2'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_check_resize_vhd_exception
dedent|''
name|'def'
name|'test_check_resize_vhd_exception'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'CannotResizeDisk'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_resize_vhd'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'vhd_path'
op|','
nl|'\n'
op|'{'
string|"'VirtualSize'"
op|':'
number|'1'
op|'}'
op|','
number|'0'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_merge_base_vhd'"
op|')'
newline|'\n'
DECL|member|test_resize_vhd
name|'def'
name|'test_resize_vhd'
op|'('
name|'self'
op|','
name|'mock_merge_base_vhd'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'fake_vhd_path'
op|'='
string|"'fake/path.vhd'"
newline|'\n'
name|'new_vhd_size'
op|'='
number|'2'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_resize_vhd'
op|'('
name|'vhd_path'
op|'='
name|'fake_vhd_path'
op|','
nl|'\n'
name|'new_size'
op|'='
name|'new_vhd_size'
op|')'
newline|'\n'
nl|'\n'
name|'get_vhd_parent_path'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'get_vhd_parent_path'
newline|'\n'
name|'get_vhd_parent_path'
op|'.'
name|'assert_called_once_with'
op|'('
name|'fake_vhd_path'
op|')'
newline|'\n'
name|'mock_merge_base_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_vhd_path'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'get_vhd_parent_path'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'resize_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'fake_vhd_path'
op|','
name|'new_vhd_size'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_check_base_disk
dedent|''
name|'def'
name|'test_check_base_disk'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'fake_src_vhd_path'
op|'='
string|"'fake/src/path'"
newline|'\n'
name|'fake_base_vhd'
op|'='
string|"'fake/vhd'"
newline|'\n'
name|'get_cached_image'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_imagecache'
op|'.'
name|'get_cached_image'
newline|'\n'
name|'get_cached_image'
op|'.'
name|'return_value'
op|'='
name|'fake_base_vhd'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_check_base_disk'
op|'('
nl|'\n'
name|'context'
op|'='
name|'self'
op|'.'
name|'context'
op|','
name|'instance'
op|'='
name|'mock_instance'
op|','
nl|'\n'
name|'diff_vhd_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'diff_vhd_path'
op|','
nl|'\n'
name|'src_base_disk_path'
op|'='
name|'fake_src_vhd_path'
op|')'
newline|'\n'
nl|'\n'
name|'get_cached_image'
op|'.'
name|'assert_called_once_with'
op|'('
name|'self'
op|'.'
name|'context'
op|','
name|'mock_instance'
op|')'
newline|'\n'
name|'recon_parent_vhd'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'reconnect_parent_vhd'
newline|'\n'
name|'recon_parent_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'diff_vhd_path'
op|','
name|'fake_base_vhd'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
nl|'\n'
string|"'_check_and_attach_config_drive'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_check_base_disk'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'migrationops'
op|'.'
name|'MigrationOps'
op|','
string|"'_check_resize_vhd'"
op|')'
newline|'\n'
DECL|member|_check_finish_migration
name|'def'
name|'_check_finish_migration'
op|'('
name|'self'
op|','
name|'mock_check_resize_vhd'
op|','
nl|'\n'
name|'mock_check_base_disk'
op|','
nl|'\n'
name|'mock_check_attach_config_drive'
op|','
nl|'\n'
name|'ephemeral_path'
op|'='
name|'None'
op|','
nl|'\n'
name|'boot_from_volume'
op|'='
name|'False'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'mock_instance'
op|'.'
name|'ephemeral_gb'
op|'='
number|'1'
newline|'\n'
name|'mock_vhd_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'mock_eph_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'lookup_root_vhd'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_root_vhd_path'
newline|'\n'
name|'side_effect'
op|'='
op|'['
name|'mock_eph_info'
op|']'
name|'if'
name|'boot_from_volume'
name|'else'
op|'['
name|'mock_vhd_info'
op|','
nl|'\n'
name|'mock_eph_info'
op|']'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_volumeops'
op|'.'
name|'ebs_root_in_block_devices'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'.'
name|'return_value'
op|'='
name|'boot_from_volume'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'get_vhd_info'
op|'.'
name|'side_effect'
op|'='
name|'side_effect'
newline|'\n'
name|'look_up_ephem'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_ephemeral_vhd_path'
newline|'\n'
name|'look_up_ephem'
op|'.'
name|'return_value'
op|'='
name|'ephemeral_path'
newline|'\n'
name|'expected_check_resize'
op|'='
op|'['
op|']'
newline|'\n'
name|'expected_get_info'
op|'='
op|'['
op|']'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'finish_migration'
op|'('
nl|'\n'
name|'context'
op|'='
name|'self'
op|'.'
name|'context'
op|','
name|'migration'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'migration'
op|','
nl|'\n'
name|'instance'
op|'='
name|'mock_instance'
op|','
name|'disk_info'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'disk_info'
op|','
nl|'\n'
name|'network_info'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|','
nl|'\n'
name|'image_meta'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'image_meta'
op|','
name|'resize_instance'
op|'='
name|'True'
op|')'
newline|'\n'
nl|'\n'
name|'mock_ebs_root_in_block_devices'
op|'.'
name|'assert_called_once_with'
op|'('
name|'None'
op|')'
newline|'\n'
name|'if'
name|'not'
name|'boot_from_volume'
op|':'
newline|'\n'
indent|'            '
name|'root_vhd_path'
op|'='
name|'lookup_root_vhd'
op|'.'
name|'return_value'
newline|'\n'
name|'lookup_root_vhd'
op|'.'
name|'assert_called_with'
op|'('
name|'mock_instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'expected_get_info'
op|'='
op|'['
name|'mock'
op|'.'
name|'call'
op|'('
name|'root_vhd_path'
op|')'
op|']'
newline|'\n'
name|'mock_vhd_info'
op|'.'
name|'get'
op|'.'
name|'assert_called_once_with'
op|'('
string|'"ParentPath"'
op|')'
newline|'\n'
name|'mock_check_base_disk'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'self'
op|'.'
name|'context'
op|','
name|'mock_instance'
op|','
name|'root_vhd_path'
op|','
nl|'\n'
name|'mock_vhd_info'
op|'.'
name|'get'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'expected_check_resize'
op|'.'
name|'append'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
name|'root_vhd_path'
op|','
name|'mock_vhd_info'
op|','
nl|'\n'
name|'mock_instance'
op|'.'
name|'root_gb'
op|'*'
name|'units'
op|'.'
name|'Gi'
op|')'
op|')'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|'            '
name|'root_vhd_path'
op|'='
name|'None'
newline|'\n'
nl|'\n'
dedent|''
name|'look_up_ephem'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock_instance'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'if'
name|'ephemeral_path'
name|'is'
name|'None'
op|':'
newline|'\n'
indent|'            '
name|'create_eph_vhd'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'create_ephemeral_vhd'
newline|'\n'
name|'create_eph_vhd'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock_instance'
op|')'
newline|'\n'
name|'ephemeral_path'
op|'='
name|'create_eph_vhd'
op|'.'
name|'return_value'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|'            '
name|'expected_get_info'
op|'.'
name|'append'
op|'('
name|'mock'
op|'.'
name|'call'
op|'('
name|'ephemeral_path'
op|')'
op|')'
newline|'\n'
name|'expected_check_resize'
op|'.'
name|'append'
op|'('
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
name|'ephemeral_path'
op|','
name|'mock_eph_info'
op|','
nl|'\n'
name|'mock_instance'
op|'.'
name|'ephemeral_gb'
op|'*'
name|'units'
op|'.'
name|'Gi'
op|')'
op|')'
newline|'\n'
nl|'\n'
dedent|''
name|'mock_check_resize_vhd'
op|'.'
name|'assert_has_calls'
op|'('
name|'expected_check_resize'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vhdutils'
op|'.'
name|'get_vhd_info'
op|'.'
name|'assert_has_calls'
op|'('
nl|'\n'
name|'expected_get_info'
op|')'
newline|'\n'
name|'get_image_vm_gen'
op|'='
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'get_image_vm_generation'
newline|'\n'
name|'get_image_vm_gen'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock_instance'
op|'.'
name|'uuid'
op|','
nl|'\n'
name|'root_vhd_path'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'image_meta'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'create_instance'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|','
name|'None'
op|','
name|'root_vhd_path'
op|','
nl|'\n'
name|'ephemeral_path'
op|','
name|'get_image_vm_gen'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'mock_check_attach_config_drive'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|','
name|'get_image_vm_gen'
op|'.'
name|'return_value'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_vmops'
op|'.'
name|'power_on'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
name|'mock_instance'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_migration
dedent|''
name|'def'
name|'test_finish_migration'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_finish_migration'
op|'('
nl|'\n'
name|'ephemeral_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'ephemeral_path'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_migration_boot_from_volume
dedent|''
name|'def'
name|'test_finish_migration_boot_from_volume'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_finish_migration'
op|'('
nl|'\n'
name|'ephemeral_path'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'ephemeral_path'
op|','
nl|'\n'
name|'boot_from_volume'
op|'='
name|'True'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_migration_no_ephemeral
dedent|''
name|'def'
name|'test_finish_migration_no_ephemeral'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'_check_finish_migration'
op|'('
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_finish_migration_no_root
dedent|''
name|'def'
name|'test_finish_migration_no_root'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'mock_instance'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
name|'self'
op|'.'
name|'context'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'='
op|'('
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_volumeops'
op|'.'
name|'ebs_root_in_block_devices'
op|')'
newline|'\n'
name|'mock_ebs_root_in_block_devices'
op|'.'
name|'return_value'
op|'='
name|'False'
newline|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'_pathutils'
op|'.'
name|'lookup_root_vhd_path'
op|'.'
name|'return_value'
op|'='
name|'None'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'DiskNotFound'
op|','
nl|'\n'
name|'self'
op|'.'
name|'_migrationops'
op|'.'
name|'finish_migration'
op|','
nl|'\n'
name|'self'
op|'.'
name|'context'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'migration'
op|','
nl|'\n'
name|'mock_instance'
op|','
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'disk_info'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'network_info'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'image_meta'
op|','
name|'True'
op|','
name|'None'
op|','
name|'True'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
