def do(self, workflow_dict):
        try:

            workflow_dict['hosts_and_exports'] = []
            databaseinfra = workflow_dict['databaseinfra']
            snapshot_id = workflow_dict['snapshot_id']
            nfsaas_export_id = workflow_dict['export_id_snapshot']
            provider = NfsaasProvider()
            restore_result = provider.restore_snapshot(environment=databaseinfra.environment,
                                                       export_id=nfsaas_export_id,
                                                       snapshot_id=snapshot_id)

            job_result = provider.check_restore_nfsaas_job(environment=databaseinfra.environment,
                                                           job_id=restore_result['job'])

            if 'id' in job_result['result']:
                new_export_id = job_result['result']['id']
                new_export_path = job_result['result']['path']
            else:
                raise Exception('Error while restoring nfs snapshot')

            host = workflow_dict['host']
            workflow_dict['hosts_and_exports'].append({
                'host': host,
                'old_export_id': workflow_dict['export_id'],
                'old_export_path': workflow_dict['export_path'],
                'new_export_id': new_export_id,
                'new_export_path': new_export_path,
            })

            old_host_attr = nfs_HostAttr.objects.get(nfsaas_export_id=nfsaas_export_id)
            new_host_attr = nfs_HostAttr()
            new_host_attr.host = old_host_attr.host
            new_host_attr.nfsaas_export_id = new_export_id
            new_host_attr.nfsaas_path = new_export_path
            new_host_attr.is_active = False
            new_host_attr.nfsaas_team_id = old_host_attr.nfsaas_team_id
            new_host_attr.nfsaas_project_id = old_host_attr.nfsaas_project_id
            new_host_attr.nfsaas_environment_id = old_host_attr.nfsaas_environment_id
            new_host_attr.nfsaas_size_id = old_host_attr.nfsaas_size_id
            new_host_attr.save()

            restore_result = provider.restore_snapshot(environment=databaseinfra.environment,
                                                       export_id=nfsaas_export_id,
                                                       snapshot_id=snapshot_id)

            job_result = provider.check_restore_nfsaas_job(environment=databaseinfra.environment,
                                                           job_id=restore_result['job'])

            if 'id' in job_result['result']:
                new_export_id = job_result['result']['id']
                new_export_path = job_result['result']['path']
            else:
                raise Exception('Error while restoring nfs snapshot')

            host = workflow_dict['not_primary_hosts'][0]
            nfs_host_attr = nfs_HostAttr.objects.get(host=host, is_active=True)
            workflow_dict['hosts_and_exports'].append({
                'host': host,
                'old_export_id': nfs_host_attr.nfsaas_export_id,
                'old_export_path': nfs_host_attr.nfsaas_path,
                'new_export_id': new_export_id,
                'new_export_path': new_export_path,
            })

            new_host_attr = nfs_HostAttr()
            new_host_attr.host = old_host_attr.host
            new_host_attr.nfsaas_export_id = new_export_id
            new_host_attr.nfsaas_path = new_export_path
            new_host_attr.is_active = False
            new_host_attr.nfsaas_team_id = old_host_attr.nfsaas_team_id
            new_host_attr.nfsaas_project_id = old_host_attr.nfsaas_project_id
            new_host_attr.nfsaas_environment_id = old_host_attr.nfsaas_environment_id
            new_host_attr.nfsaas_size_id = old_host_attr.nfsaas_size_id
            new_host_attr.save()

            return True
        except Exception:
            traceback = full_stack()

            workflow_dict['exceptions']['error_codes'].append(DBAAS_0021)
            workflow_dict['exceptions']['traceback'].append(traceback)

            return False
dataset/ETHPy150Open globocom/database-as-a-service/dbaas/workflow/steps/mysql/restore_snapshot/restore_snapshot.py/RestoreSnapshot.do/original