Sessions

pyCSM.services.session_service.session_service.change_properties(property_dictionary)

Takes a dictionary of properties and the values that user wants to change and changes them in the file.

Parameters
  • property_dictionary (dict) – Dictionary of the keys and values that need

  • file. (to be changed in the) –

  • {"language" (ex.) – “en-UK”, “verify”:True}

Returns

Returns the new properties dictionary.

pyCSM.services.session_service.session_service.create_session(url, tk, name, sess_type, desc=None)

Create a copy services manager session. A session must be created before copy sets can be placed into the session and managed by the server.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session that will be created.

  • sess_type – The type of session to create.

  • desc (str) (Optional) – description for the session

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.create_session_by_volgroup_name(url, tk, volgroup, type, desc=None)

Create a copy services manager session and automatically creates a session name and populates the session based on the passed in volume group

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • volgroup (str) – The name of the specv volume group that will be created.

  • type (str) – type The type of session to create. Only Spec V Snapshot supports this today. Type is the “shortname” for the copy type returned in the /system/sessiontypes query.

  • desc (str) – description Optional description for the session

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.delete_session(url, tk, name)

Deletes a copy services manager session. Only inactive sessions can be deleted.

Args:

url (str): Base url of CSM server. ex. https://servername:port/CSM/web. tk (str): Rest token for the CSM server. name (str): The name of the session that will be deleted.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.export_device_writeio_history(url, tk, name, start_time, end_time)

Export ESE Box History for a session in csv format to a file

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • start_time (str) – Start time YYYY-MM-DD

  • end_time (str) – End time YYYY-MM-DD

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.export_lss_oos_history(url, tk, name, rolepair, start_time, end_time)

Export LSS OOS History for a session in csv format to a file

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • rolepair (str) – The role pair name to query

  • start_time (str) – Start time YYYY-MM-DD

  • end_time (str) – End time YYYY-MM-DD

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_available_commands(url, tk, name)

Returns the list of available commands for a session based on the session’s current state

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.get_backup_details(url, tk, name, role, backup_id)

Gets detailed information for a given backup in a session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • role – The name of role where the backups reside.

  • backup_id – The ID of the backup to send to the run command.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_properties()

Returns a dictionary of the current properties and their values set for the file.

pyCSM.services.session_service.session_service.get_recovered_backup_details(url, tk, name, backup_id)

Gets the pair information for a specific recovered backup on a specific session

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • backup_id (int) – the backupid to get the detailed info for

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_recovered_backups(url, tk, name)

Gets all recovered backups for Spec V Safeguarded Copy session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_rolepair_info(url, tk, name, rolepair)

Gets a summary for a given role pair in a session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • rolepair (str) – The name of the role pair.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_rpo_history(url, tk, name, rolepair, start_time, end_time)

Export ESE Box History for a session in csv format to a file

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • start_time (str) – Start time YYYY-MM-DD (ex. “2020-04-22”)

  • end_time (str) – End time YYYY-MM-DD (ex. “2020-04-22”)

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_session_info(url, tk, name)

This method returns the detailed information for a given session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.get_session_options(url, tk, name)

Gets the options for the given session. The results returned from this method will vary depending on the session type.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_session_overviews(url, tk)

This method returns the overview summary information for all sessions managed by the server

Parameters
Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.get_session_overviews_short(url, tk)

This method returns minimal overview summary information for all sessions managed by the server.

Parameters
Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

pyCSM.services.session_service.session_service.get_snapshot_clone_details_by_name(url, tk, name, snapshot_name)

Gets the pair details for the thin clone of the specified snapshot in the session

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • snapshot_name (str) – the name of the snapshot to get clone details for

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_snapshot_clones(url, tk, name)

Gets all clones for snapshots in for Spec V Safeguarded Copy session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.get_snapshot_details_by_name(url, tk, name, role, snapshot_name)

Gets detailed information for a given snapshot in a session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • role – The name of role where the snapshot resides.

  • snapshot_name – The name of the snapshot to return

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.modify_session_description(url, tk, name, desc)

Changes the description field for a given session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • desc (str) – description for the session

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.run_backup_command(url, tk, name, role, backup_id, cmd)

Used to perform a recover or expire for the specified backup.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • name (str) – The name of the session.

  • role – The name of role where the backups reside.

  • backup_id – The ID of the backup to send to the run command.

  • cmd (str) – command to run (ex. “Recover Backup”, “Expire Backup”)

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.run_session_command(url, tk, ses_name, com_name)

Run a command against a session.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • ses_name (str) – The name of the session.

  • com_name (str) – The name of the command.

Returns

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.sgc_recover(url, tk, ses_name, com_name, role, backup_id)

Run a Recover command to the specified Safeguarded Copy backup ID.

Args:

url (str): Base url of CSM server. ex. https://servername:port/CSM/web. tk (str): Rest token for the CSM server. ses_name (str): The name of the session. com_name (str): The name of the command. role: The name of role where the backups reside. backup_id: The ID of the backup to send to the run command.

Returns:

JSON String representing the result of the command.

pyCSM.services.session_service.session_service.wait_for_state(url, tk, ses_name, state, minutes=5, debug=False)

Runs until the session is in a given state or until it times out and returns the results.

Parameters
  • url (str) – Base url of CSM server. ex. https://servername:port/CSM/web.

  • tk (str) – Rest token for the CSM server.

  • ses_name (str) – The name of the session.

  • state (str) – state of the server that user wants to wait for.

  • minutes (double) – number of minutes before it times out

  • debug (boolean) – True if you want the state and status to print in console

Returns

boolean for whether the state was reached and “session_info”: JSON string representing the response of the command

Return type

A dictionary with “state_reached”