예제 #1
0
파일: node.py 프로젝트: gdyuldin/fuel-web
    def reset_to_discover(cls, instance):
        """Flush database objects which is not consistent with actual node

        configuration in the event of resetting node to discover state

        :param instance: Node database object
        :returns: None
        """
        node_data = {
            "online": False,
            "status": consts.NODE_STATUSES.discover,
            "pending_addition": True,
            "pending_deletion": False,
        }
        cls.update(instance, node_data)
        cls.move_roles_to_pending_roles(instance)
        # when node reseted to discover:
        # - cobbler system is deleted
        # - mac to ip mapping from dnsmasq.conf is deleted
        # imho we need to revert node to original state, as it was
        # added to cluster (without any additonal state in database)
        netmanager = Cluster.get_network_manager()
        netmanager.clear_assigned_ips(instance)
        fire_callback_on_node_reset(instance)
        db().flush()
예제 #2
0
파일: node.py 프로젝트: xglhjk6/fuel-web
    def reset_to_discover(cls, instance):
        """Flush database objects which is not consistent with actual node

        configuration in the event of resetting node to discover state

        :param instance: Node database object
        :returns: None
        """
        node_data = {
            "online": False,
            "status": consts.NODE_STATUSES.discover,
            "pending_addition": True,
            "pending_deletion": False,
        }
        cls.update(instance, node_data)
        cls.move_roles_to_pending_roles(instance)
        # when node reseted to discover:
        # - cobbler system is deleted
        # - mac to ip mapping from dnsmasq.conf is deleted
        # imho we need to revert node to original state, as it was
        # added to cluster (without any additonal state in database)
        netmanager = Cluster.get_network_manager()
        netmanager.clear_assigned_ips(instance)
        fire_callback_on_node_reset(instance)
        db().flush()
예제 #3
0
    def test_fire_callback_on_node_reset(self, get_m):
        node = mock.MagicMock()
        fire_callback_on_node_reset(node)

        for ext in get_m.return_value:
            ext.on_node_reset.assert_called_once_with(node)