Archived

This forum has been archived. Please start a new discussion on GitHub.

How to remove server instance from IceGrid?

Hi,

I am using Server Templates on IceGrid which I am instantiating using instantiateServer() API function.

My question is, how can I remove/delete this server instance using Ice API?

I can remove the server template instance using following command within icegridadmin tool.
server remove <Server ID>

Cheers.

Surya

Comments

  • matthew
    matthew NL, Canada
    One way is to look at the IceGrid admin implementation in cpp/src/IceGrid/Client.cpp. In this case the relevant code of interest is:
    void
    Parser::removeServer(const list<string>& args)
    {
        if(args.size() != 1)
        {
            invalidCommand("server remove", "requires exactly one argument");
            return;
        }
    
        try
        {
            ServerInfo info = _admin->getServerInfo(args.front());
            NodeUpdateDescriptor nodeUpdate;
            nodeUpdate.name = info.node;
            nodeUpdate.removeServers.push_back(args.front());
            ApplicationUpdateDescriptor update;
            update.name = info.application;
            update.nodes.push_back(nodeUpdate);
            _admin->updateApplication(update);
        }
        catch(const Ice::Exception& ex)
        {
            exception(ex);
        }    
    }
    

    args.front() is the name of the server.
  • Thanks Matthew.

    It works.

    Cheers.

    Surya