« Previous | Next » 

Revision 255dcebd

ID255dcebd55db98a986318758fde7646d2ed15074
Parent c8457ce7
Child 8e70b181

Added by Iustin Pop almost 14 years ago

Big rewrite of the OS-related functions

Currently the OSes have a special, customized error handling: the OS
object can represent either a valid OS, or an invalid OS. The associated
function, instead of raising other exception or failing, create custom
OS objects representing failed OSes.

While this was good when no other RPC had failure handling, it's
extremely different from how other function in backend.py expect
failures to be signalled.

This patch reworks this completely:
- the OS object always represents valid OSes (the next patch will
remove the valid/invalid field and associated constants)
- the call_os_diagnose returns instead of a list of OS objects, a list
of (name, path, status, diagnose_msg); the status is then used in
cmdlib to determine validity and the status and diagnose_msg values
are used in gnt-os for display
- call_os_get returns either a valid OS or a RPC remote failure (with
the error message)
- the other functions in backend.py now just call backend.OSFromDisk()
which will return either a valid OS object or raise an exception
- the bulk of the OSFromDisk was moved to _TryOSFromDisk which returns
status, value for the functions which don't want an exception raised

The gnt-os list and diagnose commands still work after this patch.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences