action #33388

Updated by okurz almost 6 years ago

## Motivation 
 The current implementation of the spvm backend makes use of functions ( e.g. `use_ssh_serial_console` located in `lib/`) from other "backends". 
 This is good enough for a first proof of concept but for the sake of clarity and further maintainability this should reside in a separate file which is shared/included from the backends using it. 

 ## Acceptance criteria 
 * **AC1:** Have clearly seperated backends with shared common functions 
 * **AC2:** Do not include any functions from other backends (e.g. from ipmi into spvm) 

 ## Suggestions 
 * Extract method "use_ssh_serial_console" into a common lib, e.g. "ssh_remote_console_backend_something_foobar" 
 * Call `git grep 'BACKEND.*pvm'` and only work on these occurences, that excludes e.g. 
 * Find occurences like in where we look for "s390x || ipmi || spvm" and replace this with an explicit function returning a boolean value for what it really is, e.g. "no_local_tty" or "remote_backend" or "relies_on_ssh_terminal" 
 * Create followup sibling ticket for all necessary work for other backends 

 ## Further details 
 Focus on spvm, leave the rest for the parent epic. "Having a single verification run is enough" says okurz 

 Example for a change: 

 - if (check_var('BACKEND', 'foo') || check_var('BACKEND', 'bar')) { 
 + sub backend_is_remote { return check_var('BACKEND', 'foo') || check_var('BACKEND', 'bar') } 
 + if (backend_is_remote) { 
 ``` epic