#NEWLINE# @ mock . patch ( 'hyperv.nova.volumeops.VolumeOps.get_disk_path_mapping' ) #NEWLINE# @ mock . patch ( 'hyperv.nova.imagecache.ImageCache.get_cached_image' ) #NEWLINE# @ mock . patch ( 'hyperv.nova.volumeops.VolumeOps.connect_volumes' ) #NEWLINE# def _test_pre_live_migration( self , mock_connect_volumes , mock_get_cached_image , mock_get_disk_path_mapping , phys_disks_attached = True ) : #NEWLINE# #INDENT# mock_instance = fake_instance . fake_instance_obj ( self . context ) #NEWLINE# mock_instance . image_ref = 'fake_image_ref' #NEWLINE# bdman = self . _livemigrops . _block_dev_man #NEWLINE# mock_is_boot_from_vol = bdman . is_boot_from_volume #NEWLINE# mock_is_boot_from_vol . return_value = None #NEWLINE# mock_get_disk_path_mapping . return_value = ( mock . sentinel . disk_path_mapping if phys_disks_attached else None ) #NEWLINE# CONF . set_override ( 'use_cow_images' , True ) #NEWLINE# self . _livemigrops . pre_live_migration ( self . context , mock_instance , block_device_info = mock . sentinel . BLOCK_INFO , network_info = mock . sentinel . NET_INFO ) #NEWLINE# check_config = self . _livemigrops . _livemigrutils . check_live_migration_config #NEWLINE# check_config . assert_called_once_with ( ) #NEWLINE# mock_is_boot_from_vol . assert_called_once_with ( mock . sentinel . BLOCK_INFO ) #NEWLINE# mock_get_cached_image . assert_called_once_with ( self . context , mock_instance ) #NEWLINE# mock_connect_volumes . assert_called_once_with ( mock . sentinel . BLOCK_INFO ) #NEWLINE# if phys_disks_attached : #NEWLINE# #INDENT# livemigrutils = self . _livemigrops . _livemigrutils #NEWLINE# livemigrutils . create_planned_vm . assert_called_once_with ( mock_instance . name , mock_instance . host , mock . sentinel . disk_path_mapping )