Project

General

Profile

action #33388

Updated by okurz over 5 years ago

## Motivation 
 The current implementation of the spvm backend makes use of functions ( e.g. `use_ssh_serial_console` located in `lib/ipmi_backend_utils.pm`) 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. boot_from_pxe.pm 
 * Find occurences like in https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/lib/susedistribution.pm#L554 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

Back