From e6824a223057ca1379d3890ec58773f7549f6ec2 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 6 Nov 2024 14:51:42 +0100 Subject: [PATCH 1/3] add noop provider Signed-off-by: Mathieu Tortuyaux --- src/providers/noop/mod.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/providers/noop/mod.rs diff --git a/src/providers/noop/mod.rs b/src/providers/noop/mod.rs new file mode 100644 index 00000000..c722297b --- /dev/null +++ b/src/providers/noop/mod.rs @@ -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 { + Ok(Self { }) + } +} + +impl MetadataProvider for NoopProvider {} From 916461089ca513a297acedd5296e18371d7ae2f0 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 6 Nov 2024 15:14:26 +0100 Subject: [PATCH 2/3] proxmox: use noop provider if no configdrive Signed-off-by: Mathieu Tortuyaux --- src/metadata.rs | 4 ++-- src/providers/mod.rs | 1 + src/providers/noop/mod.rs | 2 +- src/providers/proxmoxve/mod.rs | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/metadata.rs b/src/metadata.rs index 94f9238b..bd311f78 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -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; @@ -71,7 +71,7 @@ pub fn fetch_metadata(provider: &str) -> Result 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()?), diff --git a/src/providers/mod.rs b/src/providers/mod.rs index e17d5519..dab07e1e 100644 --- a/src/providers/mod.rs +++ b/src/providers/mod.rs @@ -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; diff --git a/src/providers/noop/mod.rs b/src/providers/noop/mod.rs index c722297b..136f9233 100644 --- a/src/providers/noop/mod.rs +++ b/src/providers/noop/mod.rs @@ -21,7 +21,7 @@ pub struct NoopProvider {} impl NoopProvider { pub fn try_new() -> Result { - Ok(Self { }) + Ok(Self {}) } } diff --git a/src/providers/proxmoxve/mod.rs b/src/providers/proxmoxve/mod.rs index 14146b0e..1ce543fa 100644 --- a/src/providers/proxmoxve/mod.rs +++ b/src/providers/proxmoxve/mod.rs @@ -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::*; @@ -20,3 +25,13 @@ pub use cloudconfig::*; #[cfg(test)] mod tests; + +pub fn try_config_drive_else_leave() -> Result> { + 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()?)) + } + } +} From 587cbbc61d5fb8af78eacaa4257d3c7f7a737f50 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 6 Nov 2024 20:18:54 +0100 Subject: [PATCH 3/3] docs: add changelog entry Signed-off-by: Mathieu Tortuyaux --- docs/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes.md b/docs/release-notes.md index 348a7860..251df6a6 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -10,6 +10,8 @@ Major changes: Minor changes: +- ProxmoxVE: Fixed instance boot without config drive + Packaging changes: ## Afterburn 5.7.0