Exemplo n.º 1
0
    def copy(self, context, source_object, destination_object):
        data = {
            'host_src': source_object.host,
            'path_src': source_object.path,
            'host_dst': destination_object.host,
            'path_dst': destination_object.path
        }

        try:
            copier = base.get_copier_checked(context.src_cloud,
                                             context.dst_cloud,
                                             data)

            copier.transfer(data)
        except (base.FileCopyError,
                base.CopierCannotBeUsed,
                base.CopierNotFound,
                base.NotEnoughSpace) as e:
            msg = ("Copying file from {src_host}@{src_file} to "
                   "{dst_host}@{dst_file}, error: {err}").format(
                src_host=source_object.host,
                src_file=source_object.path,
                dst_host=destination_object.host,
                dst_file=destination_object.path,
                err=e.message)
            raise CopyFailed(msg)
Exemplo n.º 2
0
    def copy(self, context, source_object, destination_object):
        data = {
            'host_src': source_object.host,
            'path_src': source_object.path,
            'host_dst': destination_object.host,
            'path_dst': destination_object.path
        }

        try:
            copier = base.get_copier_checked(context.src_cloud,
                                             context.dst_cloud, data)

            copier.transfer(data)
        except (base.FileCopyError, base.CopierCannotBeUsed,
                base.CopierNotFound, base.NotEnoughSpace) as e:
            msg = ("Copying file from {src_host}@{src_file} to "
                   "{dst_host}@{dst_file}, error: {err}").format(
                       src_host=source_object.host,
                       src_file=source_object.path,
                       dst_host=destination_object.host,
                       dst_file=destination_object.path,
                       err=e.message)
            raise CopyFailed(msg)
Exemplo n.º 3
0
 def get_copier(self, name):
     self.cfg.set_override('copy_backend', name, 'migrate')
     return base.get_copier_checked('fake_src_cloud', 'fake_dst_cloud', {
         'host_src': 'fake_host_src',
         'host_dst': 'fake_host_dst'
     })
Exemplo n.º 4
0
 def get_copier(self, name):
     self.cfg.set_override('copy_backend', name, 'migrate')
     return base.get_copier_checked('fake_src_cloud', 'fake_dst_cloud',
                                    {'host_src': 'fake_host_src',
                                     'host_dst': 'fake_host_dst'})