def get_server_command(group, cert_dir, bin_dir, config_file, config_temp=None): """Get the daos_server command object to manage. Args: group (str): daos_server group name cert_dir (str): directory in which to copy certificates bin_dir (str): location of the daos_server executable config_file (str): configuration file name and path config_temp (str, optional): file name and path to use to generate the configuration file locally and then copy it to all the hosts using the config_file specification. Defaults to None, which creates and utilizes the file specified by config_file. Returns: DaosServerCommand: the daos_server command object """ transport_config = DaosServerTransportCredentials(cert_dir) common_config = CommonConfig(group, transport_config) config = DaosServerYamlParameters(config_file, common_config) command = DaosServerCommand(bin_dir, config) if config_temp: # Setup the DaosServerCommand to write the config file data to the # temporary file and then copy the file to all the hosts using the # assigned filename command.temporary_file = config_temp return command
def add_server_manager(self, config_file=None, dmg_config_file=None, common_cfg=None, timeout=20): """Add a new daos server manager object to the server manager list. When adding multiple server managers unique yaml config file names and common config setting (due to the server group name) should be used. Args: config_file (str, optional): daos server config file name. Defaults to None, which will use a default file name. dmg_config_file (str, optional): dmg config file name. Defaults to None, which will use a default file name. common_cfg (CommonConfig, optional): daos server config file settings shared between the agent and server. Defaults to None, which uses the class CommonConfig. timeout (int, optional): number of seconds to wait for the daos server to start before reporting an error. Defaults to 60. """ self.log.info("--- ADDING SERVER MANAGER ---") # Setup defaults if config_file is None: config_file = self.get_config_file("daos", "server") if common_cfg is None: common_cfg = CommonConfig( self.server_group, DaosServerTransportCredentials(self.workdir)) if dmg_config_file is None: dmg_config_file = self.get_config_file("daos", "dmg") transport_dmg = DmgTransportCredentials(self.workdir) dmg_cfg = DmgYamlParameters(dmg_config_file, self.server_group, transport_dmg) # Create a ServerCommand to manage with a new ServerManager object server_cfg = DaosServerYamlParameters(config_file, common_cfg) server_cmd = DaosServerCommand(self.bin, server_cfg, timeout) self.server_managers.append( DaosServerManager(server_cmd, self.manager_class, dmg_cfg))