Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxmoxve: do not fail if the config drive does not exist #1128

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Major changes:

Minor changes:

- ProxmoxVE: Fixed instance boot without config drive

Packaging changes:

## Afterburn 5.7.0
Expand Down
4 changes: 2 additions & 2 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::providers::openstack;
use crate::providers::openstack::network::OpenstackProviderNetwork;
use crate::providers::packet::PacketProvider;
use crate::providers::powervs::PowerVSProvider;
use crate::providers::proxmoxve::ProxmoxVEConfigDrive;
use crate::providers::proxmoxve;
use crate::providers::scaleway::ScalewayProvider;
use crate::providers::vmware::VmwareProvider;
use crate::providers::vultr::VultrProvider;
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn fetch_metadata(provider: &str) -> Result<Box<dyn providers::MetadataProvi
"openstack-metadata" => box_result!(OpenstackProviderNetwork::try_new()?),
"packet" => box_result!(PacketProvider::try_new()?),
"powervs" => box_result!(PowerVSProvider::try_new()?),
"proxmoxve" => box_result!(ProxmoxVEConfigDrive::try_new()?),
"proxmoxve" => proxmoxve::try_config_drive_else_leave(),
"scaleway" => box_result!(ScalewayProvider::try_new()?),
"vmware" => box_result!(VmwareProvider::try_new()?),
"vultr" => box_result!(VultrProvider::try_new()?),
Expand Down
1 change: 1 addition & 0 deletions src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub mod ibmcloud;
pub mod ibmcloud_classic;
pub mod kubevirt;
pub mod microsoft;
pub mod noop;
pub mod openstack;
pub mod packet;
pub mod powervs;
Expand Down
28 changes: 28 additions & 0 deletions src/providers/noop/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2023 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use anyhow::Result;

use crate::providers::MetadataProvider;

/// Noop provider
pub struct NoopProvider {}

impl NoopProvider {
pub fn try_new() -> Result<NoopProvider> {
Ok(Self {})
}
}

impl MetadataProvider for NoopProvider {}
15 changes: 15 additions & 0 deletions src/providers/proxmoxve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::providers;
use crate::providers::noop::NoopProvider;
use anyhow::Result;
use slog_scope::warn;

mod configdrive;
pub use configdrive::*;

Expand All @@ -20,3 +25,13 @@ pub use cloudconfig::*;

#[cfg(test)]
mod tests;

pub fn try_config_drive_else_leave() -> Result<Box<dyn providers::MetadataProvider>> {
match ProxmoxVEConfigDrive::try_new() {
Ok(config_drive) => Ok(Box::new(config_drive)),
Err(_) => {
warn!("failed to locate config-drive - aborting ProxmoxVE provider");
Ok(Box::new(NoopProvider::try_new()?))
}
}
}
Loading