def migrate_images_by_instances(self): act_conv_comp_img = convert_compute_to_image.ConvertComputeToImage( self.init, cloud='src_cloud') act_conv_image_comp = convert_image_to_compute.ConvertImageToCompute( self.init) act_copy_inst_images = copy_g2g.CopyFromGlanceToGlance(self.init) return act_conv_comp_img >> act_copy_inst_images >> act_conv_image_comp
def test_run_with_info(self): fake_action = copy_g2g.CopyFromGlanceToGlance(self.fake_init) new_info = fake_action.run(image_info=self.fake_input_info) self.assertEqual({'images_info': self.fake_result_info}, new_info) self.fake_image.deploy.assert_called_once_with( {'images_info': self.fake_image.read_info()})
def test_run_no_info(self, mock_info): mock_info().run.return_value = self.fake_input_info fake_action = copy_g2g.CopyFromGlanceToGlance(self.fake_init) new_info = fake_action.run() self.assertEqual({'images_info': self.fake_result_info}, new_info) self.fake_image.deploy.assert_called_once_with( {'image_data': {'fake_key': 'fake_value'}})
def transport_volumes_by_instance(self): act_copy_g2g_vols = copy_g2g.CopyFromGlanceToGlance(self.init) act_convert_c_to_v = convert_compute_to_volume.ConvertComputeToVolume( self.init, cloud='src_cloud') act_convert_v_to_i = convert_volume_to_image.ConvertVolumeToImage( self.init, cloud='src_cloud') act_convert_i_to_v = convert_image_to_volume.ConvertImageToVolume( self.init, cloud='dst_cloud') act_convert_v_to_c = convert_volume_to_compute.ConvertVolumeToCompute( self.init, cloud='dst_cloud') task_convert_c_to_v_to_i = act_convert_c_to_v >> act_convert_v_to_i task_convert_i_to_v_to_c = act_convert_i_to_v >> act_convert_v_to_c return task_convert_c_to_v_to_i >> act_copy_g2g_vols >> task_convert_i_to_v_to_c
def transport_boot_volume_src_to_dst(self, src_cloud, dst_cloud, info, instance_id): info = copy.deepcopy(info) instance = info[utl.INSTANCES_TYPE][instance_id] src_storage = src_cloud.resources[utl.STORAGE_RESOURCE] volume = src_storage.read_info( id=instance[INSTANCE_BODY]['volumes'][0]['id']) act_v_to_i = convert_volume_to_image.ConvertVolumeToImage( self.init, cloud='src_cloud') image = act_v_to_i.run(volume)['image_data'] act_g_to_g = copy_g2g.CopyFromGlanceToGlance(self.init) image_dst = act_g_to_g.run(image)['images_info'] instance[utl.META_INFO][ utl.IMAGE_BODY] = image_dst['image']['images'].values()[0] return info
def migration_images(self): act_get_info_images = get_info_images.GetInfoImages(self.init, cloud='src_cloud') act_deploy_images = copy_g2g.CopyFromGlanceToGlance(self.init) return act_get_info_images >> act_deploy_images