Allow VMs to be launched when no profile_override.toml is found.

Fixes mbilker/vgpu_unlock-rs#1

Signed-off-by: Erin Allison <erin@eallison.us>
This commit is contained in:
Erin Allison 2021-12-17 10:53:13 -06:00
parent 3ca0999210
commit 40abb4b7c9
No known key found for this signature in database
GPG Key ID: 635F855566C675DB

View File

@ -391,13 +391,20 @@ fn handle_profile_override(config: &mut VgpuConfig) -> bool {
Some(path) => PathBuf::from(path), Some(path) => PathBuf::from(path),
None => PathBuf::from(DEFAULT_PROFILE_OVERRIDE_CONFIG_PATH), None => PathBuf::from(DEFAULT_PROFILE_OVERRIDE_CONFIG_PATH),
}; };
let config_overrides = match fs::read_to_string(&config_path) { let config_overrides = match fs::read_to_string(&config_path) {
Ok(data) => data, Ok(data) => data,
Err(e) => { Err(e) => {
if e.kind() != ErrorKind::NotFound {
error!("Config file '{}' not found", config_path.display());
return true;
}
error!("Failed to read '{}': {}", config_path.display(), e); error!("Failed to read '{}': {}", config_path.display(), e);
return false; return false;
} }
}; };
let config_overrides: ProfileOverridesConfig = match toml::from_str(&config_overrides) { let config_overrides: ProfileOverridesConfig = match toml::from_str(&config_overrides) {
Ok(config) => config, Ok(config) => config,
Err(e) => { Err(e) => {