SCPM agent description


TODO

management of resource groups !

Purpose

The SCPM agent (ag_scpm) is used to access SCPM library.

Implementation

The agent creates a SCPM object and calls the functions from SCPM library (=SCPM object methods). Look at these methods at /usr/include/scpm.h. It is also good to check info scpm.

Some functions called from SCPM library generate the "progress output" - the text which has to be shown in some YCP widget. These functions are called from agents's separate thread, so the progress output can be read from YCP client while the functions are still running. After the end of output is reached (this also means that threads exited), Read(.scpm.exit_status) must be read.

Functions generating output are curretnly Add, Copy, PrepareSwitch, Switch, Save, Enable (only from uninitialized state).

Check the development documentation in the autodocs/ directory.

Interface for SCPM-agent

The interface is implemented as a SCR agent with the usual Read(), Write() and Dir() interface. The path prefix used is .scpm. For more see the paths tables.

Restrictions, limits and future enhancements

Important:If you want to use SCPM, don't forget to call Execute(.scpm) at first and Write(.scpm, nil) at the end. These calls do necessary initialization work (creating and destroying SCPM object).

See the Todo.txt file for the list of possible future enhancements.

Complete Read paths table

PathArgumentTypeResult
.scpm.statusYCPMap Map with description of SCPM status. The important keys are enabled, initialized, needs_reinit (if reinitialization is necessary) and needs_recover (recovary after crash is needed)
.scpm.profilesYCPList list with all available profiles
.scpm.profiles.currentYCPString the name of the active profile
.scpm.profiles.descriptionYCPStringYCPString the description of the profile given as argument; if no argument is given, active profile is used (also in following calls)
.scpm.profiles.prestartYCPStringYCPString path to the prestart script of the given profile
.scpm.profiles.poststartYCPStringYCPString path to the poststart script of the given profile
.scpm.profiles.prestopYCPStringYCPString path to the prestop script of the given profile
.scpm.profiles.poststopYCPStringYCPString path to the poststop script of the given profile
.scpm.resourcesYCPList list contaning two list of available resource sets, predefined and individual (e.g. [ [ "default" ], [ "my_set" ] ]
.scpm.resources.currentYCPString name of the current resource set
.scpm.exit_statusYCPBoolean true if function called in thread finished successfully

Complete Write paths table

Return values are YCPBoolean (the success of the library call) or YCPVoid (no/bad argument).

PathArgumentResult
.scpmYCPValue calls a destructor of the SCPM object (as argument use anything)
.scpm.status.enabledYCPBoolean enables/disables SCPM
.scpm.resources.currentYCPString changes the active resource set to the given one
.scpm.profiles.descriptionYCPString sets the new description of the given profile; if nil argument is given, active profile is used (also in following calls)
.scpm.profiles.prestartYCPString sets the new prestart script of the given profile
.scpm.profiles.poststartYCPString sets the new poststart script of the given profile
.scpm.profiles.prestopYCPString sets the new prestop script of the given profile
.scpm.profiles.poststopYCPString sets the new poststop script of the given profile

Complete Execute paths table

Return values are YCPBoolean - the success of the library call.

Path1st argument2nd argumentResult
.scpmYCPString calls a constructor of the SCPM object; argument is path to the temporary directory, where outfile, hashfile, changesfile and tmpfile are created
.switch.prepareYCPString prepares switch to the profile given as argument; dumps switch_info_t struct to tmpfile
.switchYCPMap switchs to the selected profile; argument is switch_info_t struct
.save Saves modified resources of the profile
.enable.first enables SCPM for the first time - this is different from Write(.scpm.status.enabled) by generating output
.profiles.addYCPString adds a new profile
.profiles.deleteYCPString deletes a profile given as parameter
.profiles.copyYCPStringYCPString copies a profile (given as 1st argument) to the new profile (2nd argument)
.profiles.renameYCPStringYCPString renames a profile
.profiles.changesYCPStringYCPString checks the changes of the selected resource (1st argument is ist name, the 2nd its type) and dumps the output to changesfile
.resources.rebuild rebuilds the resources database
.resources.deleteYCPString [not implemented yet]
.resources.copyYCPStringYCPString [not implemented yet]

The calls from switch, switch.prepare, add, copy and enable.first paths generate output to outfile so they are started in separate thread.

Jiri Suchomel <jsuchome@suse.cz>