In continuation with the last post – the recent development is I have build some tests to test the base class. Also added a Server header for OPTIONS. Server is a standard header to inform the client about the type of software used by origin server.
The goal is to add a feature to swift-recon cli to validate servers in the ring. Swift-recon cli is a command line utility to obtain various metrics and telemetry from the servers. To validate servers, I need to get the Server type by calling OPTIONS. This support is added in swift-recon to call OPTIONS (only GET is supported until now). The new command to validate ring will be
The server_type_check method which I newly created will be called when the command is given. This fetches all the hosts and loops through them by calling scout_server_type (in Scout) which in turn calls OPTIONS on the host:
for url, response in self.pool.imap(recon.scout_server_type, hosts)
imap is a itertool  which creates iterator for looping. In the above line, “recon.scout_server_type” is called for each of the “hosts”.
The method responds to the arguments – object/container/account and verify if the servers in the ring indeed match to the argument given. For instance,
swift-recon object –validate-servers
For the above command, it will verify if all of the servers are of object type (by passing the host name to OPTIONS and getting the Server header). If it is not, it displays what they are – container/account.
This needs tests to verify. This post will be continued in the next by detailing the tests and/or any obstacles.