The function create_access_path
creates a new access path in the system. It takes in various options as arguments such as the name of the access path, pool name, type of access path, description, initiator group name, volume name list, portal group name list, volume rw permissions, CHAP username and password for target.
Firstly, it calls the get_pid_by_pool_name
function to retrieve the pool id by pool name. Then, it retrieves the initiator group id by initiator group name through the get_igid_by_name
function and volume id list by volume name list through get_vid_list_by_vllist
function. Similarly, it retrieves portal group id list by portal group name list using the get_pgid_list_by_pglist
function.
It sets various options for the access path such as pid, igid, vid_list, pgid_list, ap_type, and rw_state, based on the retrieved information and passed arguments. It then creates an instance of accessPath
class and calls its create
method passing the options as an argument to create a new access path in the system.
Finally, it prints the result returned by the create
method using the print_res
function.