Пример #1
0
    def PUT(self, cluster_id):
        """:returns: JSONized network configuration for cluster.

        :http: * 200 (OK)
               * 400 (data validation or some of tasks failed)
               * 404 (cluster not found in db)
               * 409 (previous dsnmasq setup is not finished yet)
        """
        cluster, data = self._get_cluster_and_validated_network_data(
            cluster_id)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status == consts.TASK_STATUSES.error:
            raise self.http(400, task.message, err_list=task.result)

        nm = objects.Cluster.get_network_manager(cluster)
        admin_nets = nm.get_admin_networks()
        nm.update(cluster, data)

        network_config = self.serializer.serialize_for_cluster(cluster)

        if admin_nets != nm.get_admin_networks():
            try:
                task = UpdateDnsmasqTaskManager().execute()
            except errors.TaskAlreadyRunning:
                raise self.http(409, errors.UpdateDnsmasqTaskIsRunning.message)
            if task.status == consts.TASK_STATUSES.error:
                raise self.http(400, task.message)

        return network_config
Пример #2
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (network checking task created)
               * 404 (cluster not found in db)
        """
        data = json.loads(web.data())
        cluster = self.get_object_or_404(Cluster, cluster_id)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(json.dumps(data))

                NetworkConfiguration.update(cluster, data)
            except web.webapi.badrequest as exc:
                TaskHelper.set_error(task.uuid, exc.data)
                logger.error(traceback.format_exc())
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()
        raise web.accepted(data=data)
Пример #3
0
    def PUT(self, cluster_id):
        data = jsonutils.loads(web.data())
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:

            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        jsonutils.dumps(data))

                if 'networking_parameters' in data:
                    self.validator.validate_neutron_params(
                        jsonutils.dumps(data), cluster_id=cluster_id)

                objects.Cluster.get_network_manager(cluster).update(
                    cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {
                    'status': 'error',
                    'progress': 100,
                    'message': six.text_type(exc)
                }
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        raise self.http(202, objects.Task.to_json(task))
Пример #4
0
    def PUT(self, cluster_id):
        data = json.loads(web.data())
        cluster = self.get_object_or_404(Cluster, cluster_id)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            if 'networks' in data:
                network_configuration = self.validator.\
                    validate_networks_update(json.dumps(data))
            try:
                NetworkConfiguration.update(cluster, data)
            except Exception as exc:
                err = str(exc)
                TaskHelper.update_task_status(task.uuid,
                                              status="error",
                                              progress=100,
                                              msg=err)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            self.db.rollback()
        else:
            self.db.commit()
        raise web.accepted(data=data)
Пример #5
0
    def PUT(self, cluster_id):
        data = json.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]
        cluster = self.get_object_or_404(Cluster, cluster_id)

        check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':

            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(json.dumps(data))

                if 'neutron_parameters' in data:
                    self.validator.validate_neutron_params(json.dumps(data))

                NeutronNetworkConfiguration.update(cluster, data)
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()
        raise web.accepted(data=data)
Пример #6
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 200 (task successfully executed)
               * 202 (network checking task scheduled for execution)
               * 400 (data validation failed)
               * 404 (cluster not found in db)
        """
        # TODO(pkaminski): this seems to be synchronous, no task needed here
        data = jsonutils.loads(web.data())
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:
            try:
                if "networks" in data:
                    self.validator.validate_networks_update(jsonutils.dumps(data))

                if "networking_parameters" in data:
                    self.validator.validate_neutron_params(jsonutils.dumps(data), cluster_id=cluster_id)

                objects.Cluster.get_network_manager(cluster).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {"status": "error", "progress": 100, "message": six.text_type(exc)}
                objects.Task.update(task, data)
                logger.error(traceback.format_exc())

        self.raise_task(task)
Пример #7
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 200 (task successfully executed)
               * 202 (network checking task scheduled for execution)
               * 400 (data validation failed)
               * 404 (cluster not found in db)
        """
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        try:
            data = self.validator.validate_networks_data(web.data(), cluster)
        except Exception as exc:
            self._raise_error_task(cluster, exc)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:
            objects.Cluster.get_network_manager(
                cluster
            ).update(cluster, data)

        # TODO(pkaminski): this is synchronous, no task needed here
        self.raise_task(task)
Пример #8
0
    def PUT(self, cluster_id):
        """:returns: JSONized network configuration for cluster.

        :http: * 200 (task successfully executed)
               * 202 (network checking task scheduled for execution)
               * 400 (data validation failed)
               * 404 (cluster not found in db)
        """
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        data = self.checked_data(
            self.validator.validate_networks_data,
            data=web.data(), cluster=cluster, networks_required=False)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status == consts.TASK_STATUSES.error:
            raise self.http(400, task.message, err_list=task.result)

        objects.Cluster.get_network_manager(
            cluster
        ).update(cluster, data)
        return self.serializer.serialize_for_cluster(cluster)
Пример #9
0
    def PUT(self, cluster_id):
        """:returns: JSONized network configuration for cluster.

        :http: * 200 (OK)
               * 400 (data validation or some of tasks failed)
               * 404 (cluster not found in db)
               * 409 (previous dsnmasq setup is not finished yet)
        """
        cluster, data = self._get_cluster_and_validated_network_data(
            cluster_id)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status == consts.TASK_STATUSES.error:
            raise self.http(400, task.message, err_list=task.result)

        nm = objects.Cluster.get_network_manager(cluster)
        admin_nets = nm.get_admin_networks()
        nm.update(cluster, data)

        network_config = self.serializer.serialize_for_cluster(cluster)

        if admin_nets != nm.get_admin_networks():
            try:
                task = UpdateDnsmasqTaskManager().execute()
            except errors.TaskAlreadyRunning:
                raise self.http(409, errors.UpdateDnsmasqTaskIsRunning.message)
            if task.status == consts.TASK_STATUSES.error:
                raise self.http(400, task.message)

        return network_config
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (network checking task created)
               * 404 (cluster not found in db)
        """
        data = jsonutils.loads(web.data())
        if data.get("networks"):
            data["networks"] = [n for n in data["networks"] if n.get("name") != "fuelweb_admin"]

        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:
            try:
                if "networks" in data:
                    self.validator.validate_networks_update(jsonutils.dumps(data))

                if "dns_nameservers" in data:
                    self.validator.validate_dns_servers_update(jsonutils.dumps(data))

                objects.Cluster.get_network_manager(cluster).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {"status": consts.TASK_STATUSES.error, "progress": 100, "message": six.text_type(exc)}
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        raise self.http(202, objects.Task.to_json(task))
    def PUT(self, cluster_id):
        data = jsonutils.loads(web.data())
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:

            try:
                if "networks" in data:
                    self.validator.validate_networks_update(jsonutils.dumps(data))

                if "networking_parameters" in data:
                    self.validator.validate_neutron_params(jsonutils.dumps(data), cluster_id=cluster_id)

                objects.Cluster.get_network_manager(cluster).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {"status": "error", "progress": 100, "message": six.text_type(exc)}
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        raise self.http(202, objects.Task.to_json(task))
Пример #12
0
    def PUT(self, cluster_id):
        data = json.loads(web.data())
        cluster = self.get_object_or_404(Cluster, cluster_id)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            try:
                if 'networks' in data:
                    network_configuration = self.validator.\
                        validate_networks_update(json.dumps(data))

                NetworkConfiguration.update(cluster, data)
            except web.webapi.badrequest as exc:
                TaskHelper.set_error(task.uuid, exc.data)
                logger.error(traceback.format_exc())
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()
        raise web.accepted(data=data)
Пример #13
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (network checking task created)
               * 404 (cluster not found in db)
        """
        data = jsonutils.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]

        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        jsonutils.dumps(data)
                    )

                if 'dns_nameservers' in data:
                    self.validator.validate_dns_servers_update(
                        jsonutils.dumps(data)
                    )

                objects.Cluster.get_network_manager(
                    cluster
                ).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {'status': 'error',
                        'progress': 100,
                        'message': six.text_type(exc)}
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        #TODO(enchantner): research this behaviour
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()

        raise self.http(202, Task.to_json(task))
Пример #14
0
    def PUT(self, cluster_id):
        """:returns: JSONized network configuration for cluster.

        :http: * 200 (OK)
               * 400 (data validation or some of tasks failed)
               * 404 (cluster not found in db)
               * 409 (previous dsnmasq setup is not finished yet)
        """
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        data = self.checked_data(
            self.validator.validate_networks_data,
            data=web.data(), cluster=cluster, networks_required=False)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status == consts.TASK_STATUSES.error:
            raise self.http(400, task.message, err_list=task.result)

        nm = objects.Cluster.get_network_manager(cluster)
        admin_nets = nm.get_admin_networks()
        nm.update(cluster, data)

        try:
            network_config = self.serializer.serialize_for_cluster(cluster,
                                                                   True)
        except errors.DuplicatedVIPNames as exc:
            raise self.http(400, six.text_type(exc))
        except errors.OutOfIPs as exc:
            network_id = getattr(exc, 'network_id', None)
            raise self.http(
                400,
                six.text_type(exc),
                err_list=[{"errors": ["ip_ranges"], "ids": [network_id]}]
            )

        if admin_nets != nm.get_admin_networks():
            try:
                task = UpdateDnsmasqTaskManager().execute()
            except errors.TaskAlreadyRunning:
                raise self.http(409, errors.UpdateDnsmasqTaskIsRunning.message)
            if task.status == consts.TASK_STATUSES.error:
                raise self.http(400, task.message)

        return network_config
Пример #15
0
    def PUT(self, cluster_id):
        """:returns: JSONized network configuration for cluster.

        :http: * 200 (OK)
               * 400 (data validation or some of tasks failed)
               * 404 (cluster not found in db)
               * 409 (previous dsnmasq setup is not finished yet)
        """
        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        data = self.checked_data(self.validator.validate_networks_data,
                                 data=web.data(),
                                 cluster=cluster,
                                 networks_required=False)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status == consts.TASK_STATUSES.error:
            raise self.http(400, task.message, err_list=task.result)

        nm = objects.Cluster.get_network_manager(cluster)
        admin_nets = nm.get_admin_networks()
        nm.update(cluster, data)

        try:
            network_config = self.serializer.serialize_for_cluster(cluster)
        except errors.OutOfIPs as exc:
            network_id = getattr(exc, 'network_id', None)
            raise self.http(400,
                            six.text_type(exc),
                            err_list=[{
                                "errors": ["ip_ranges"],
                                "ids": [network_id]
                            }])

        if admin_nets != nm.get_admin_networks():
            try:
                task = UpdateDnsmasqTaskManager().execute()
            except errors.TaskAlreadyRunning:
                raise self.http(409, errors.UpdateDnsmasqTaskIsRunning.message)
            if task.status == consts.TASK_STATUSES.error:
                raise self.http(400, task.message)

        return network_config
Пример #16
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 200 (task successfully executed)
               * 202 (network checking task scheduled for execution)
               * 400 (data validation failed)
               * 404 (cluster not found in db)
        """
        # TODO(pkaminski): this seems to be synchronous, no task needed here
        data = jsonutils.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]

        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        jsonutils.dumps(data)
                    )

                if 'dns_nameservers' in data:
                    self.validator.validate_dns_servers_update(
                        jsonutils.dumps(data)
                    )

                objects.Cluster.get_network_manager(
                    cluster
                ).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {'status': consts.TASK_STATUSES.error,
                        'progress': 100,
                        'message': six.text_type(exc)}
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        self.raise_task(task)
Пример #17
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 200 (task successfully executed)
               * 202 (network checking task scheduled for execution)
               * 400 (data validation failed)
               * 404 (cluster not found in db)
        """
        # TODO(pkaminski): this seems to be synchronous, no task needed here
        data = jsonutils.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]

        cluster = self.get_object_or_404(objects.Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != consts.TASK_STATUSES.error:
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        jsonutils.dumps(data))

                if 'dns_nameservers' in data:
                    self.validator.validate_dns_servers_update(
                        jsonutils.dumps(data))

                objects.Cluster.get_network_manager(cluster).update(
                    cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {
                    'status': consts.TASK_STATUSES.error,
                    'progress': 100,
                    'message': six.text_type(exc)
                }
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        self.raise_task(task)
Пример #18
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (network checking task created)
               * 404 (cluster not found in db)
        """
        data = json.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]

        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        json.dumps(data)
                    )

                if 'dns_nameservers' in data:
                    self.validator.validate_dns_servers_update(
                        json.dumps(data)
                    )

                NovaNetworkManager.update(cluster, data)
            except web.webapi.badrequest as exc:
                TaskHelper.set_error(task.uuid, exc.data)
                logger.error(traceback.format_exc())
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()
        raise web.accepted(data=data)
Пример #19
0
    def PUT(self, cluster_id):
        data = json.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]
        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':

            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        json.dumps(data)
                    )

                if 'networking_parameters' in data:
                    self.validator.validate_neutron_params(
                        json.dumps(data),
                        cluster_id=cluster_id
                    )

                objects.Cluster.get_network_manager(
                    cluster
                ).update(cluster, data)
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        #TODO(enchantner): research this behaviour
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()

        raise self.http(202, Task.to_json(task))
Пример #20
0
    def PUT(self, cluster_id):
        """:returns: JSONized Task object.
        :http: * 202 (network checking task created)
               * 404 (cluster not found in db)
        """
        data = json.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]

        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':
            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(json.dumps(data))

                if 'dns_nameservers' in data:
                    self.validator.validate_dns_servers_update(
                        json.dumps(data))

                objects.Cluster.get_network_manager(cluster).update(
                    cluster, data)
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        #TODO(enchantner): research this behaviour
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()

        raise self.http(202, Task.to_json(task))
Пример #21
0
    def PUT(self, cluster_id):
        data = jsonutils.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]
        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':

            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        jsonutils.dumps(data)
                    )

                if 'networking_parameters' in data:
                    self.validator.validate_neutron_params(
                        jsonutils.dumps(data),
                        cluster_id=cluster_id
                    )

                objects.Cluster.get_network_manager(
                    cluster
                ).update(cluster, data)
            except Exception as exc:
                # set task status to error and update its corresponding data
                data = {'status': 'error',
                        'progress': 100,
                        'message': six.text_type(exc)}
                objects.Task.update(task, data)

                logger.error(traceback.format_exc())

        raise self.http(202, Task.to_json(task))
Пример #22
0
    def PUT(self, cluster_id):
        data = json.loads(web.data())
        if data.get("networks"):
            data["networks"] = [
                n for n in data["networks"] if n.get("name") != "fuelweb_admin"
            ]
        cluster = self.get_object_or_404(Cluster, cluster_id)
        self.check_net_provider(cluster)

        self.check_if_network_configuration_locked(cluster)

        task_manager = CheckNetworksTaskManager(cluster_id=cluster.id)
        task = task_manager.execute(data)

        if task.status != 'error':

            try:
                if 'networks' in data:
                    self.validator.validate_networks_update(
                        json.dumps(data)
                    )

                if 'neutron_parameters' in data:
                    self.validator.validate_neutron_params(
                        json.dumps(data),
                        cluster_id=cluster_id
                    )

                NeutronManager.update(cluster, data)
            except Exception as exc:
                TaskHelper.set_error(task.uuid, exc)
                logger.error(traceback.format_exc())

        data = build_json_response(TaskHandler.render(task))
        if task.status == 'error':
            db().rollback()
        else:
            db().commit()
        raise web.accepted(data=data)