def __setup_virtual_machine_done(self, sctx):
        self.log.debug("azure virtual environment %d vm setup done" % sctx.current_job_index)
        ctx = sctx.job_ctxs[sctx.current_job_index]

        # update the status of virtual environment
        expr = Experiment.objects(id=ctx.experiment_id).first()
        ve = expr.virtual_environments[sctx.current_job_index]
        adapter = VirtualMachineAdapter(ctx.subscription_id, ctx.pem_url, host=ctx.management_host)

        ve.status = VEStatus.RUNNING
        expr.save()

        azure_resource = AzureVirtualMachine(name=ctx.virtual_machine_name,
                                             label=ctx.virtual_machine_label,
                                             dns="%s.chinacloudapp.cn" % ctx.cloud_service_name,
                                             end_points=[])
        # todo record AzureDeployment, AzureCloudService and so on in db for roll back

        vm_role = adapter.get_virtual_machine_role(ctx.cloud_service_name,
                                                   ctx.deployment_name,
                                                   ctx.virtual_machine_name)

        if (not vm_role) or (not vm_role.instance_endpoints):
            self.log.warn(
                "unable to find vm %s, cannot update virtual env config like guacamole" % ctx.virtual_machine_name)
        else:
            for endpoint in vm_role.instance_endpoints:
                azure_resource.public_ip = endpoint.vip
                if endpoint.name == ctx.remote_endpoint_name:  # endpoint for remote desktop
                    ve.remote_provider = VERemoteProvider.Guacamole
                    ve.remote_paras = get_remote_parameters(
                        ctx.raw_system_config,
                        ctx.remote,
                        ctx.virtual_machine_name,
                        endpoint.vip,
                        endpoint.public_port)
                else:
                    try:
                        aep = self.__get_persistable_endpoint(endpoint, ctx.raw_network_config)
                        azure_resource.end_points.append(aep)
                    except Exception as e:
                        self.log.error(e)

        ve.azure_resource = azure_resource
        azure_resource.save()
        expr.save()
        self.expr_manager.check_expr_status(expr)

        self.log.debug("azure virtual environment %d vm success callback done, step to next" % sctx.current_job_index)
        # step to config next unit
        sctx.current_job_index += 1
        self.__schedule_setup(sctx)