Skip to content

Commit c1cd336

Browse files
committed
coreos-base/afterburn: fix instance boots
Without configdrive the instance is failing to boot - this patch is currently under review on PR#1128 (coreos/afterburn) Signed-off-by: Mathieu Tortuyaux <[email protected]>
1 parent 6e674b2 commit c1cd336

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
From e6824a223057ca1379d3890ec58773f7549f6ec2 Mon Sep 17 00:00:00 2001
2+
From: Mathieu Tortuyaux <[email protected]>
3+
Date: Wed, 6 Nov 2024 14:51:42 +0100
4+
Subject: [PATCH 1/2] add noop provider
5+
6+
Signed-off-by: Mathieu Tortuyaux <[email protected]>
7+
---
8+
src/providers/noop/mod.rs | 28 ++++++++++++++++++++++++++++
9+
1 file changed, 28 insertions(+)
10+
create mode 100644 src/providers/noop/mod.rs
11+
12+
diff --git a/src/providers/noop/mod.rs b/src/providers/noop/mod.rs
13+
new file mode 100644
14+
index 0000000..c722297
15+
--- /dev/null
16+
+++ b/src/providers/noop/mod.rs
17+
@@ -0,0 +1,28 @@
18+
+// Copyright 2023 CoreOS, Inc.
19+
+//
20+
+// Licensed under the Apache License, Version 2.0 (the "License");
21+
+// you may not use this file except in compliance with the License.
22+
+// You may obtain a copy of the License at
23+
+//
24+
+// http://www.apache.org/licenses/LICENSE-2.0
25+
+//
26+
+// Unless required by applicable law or agreed to in writing, software
27+
+// distributed under the License is distributed on an "AS IS" BASIS,
28+
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29+
+// See the License for the specific language governing permissions and
30+
+// limitations under the License.
31+
+
32+
+use anyhow::Result;
33+
+
34+
+use crate::providers::MetadataProvider;
35+
+
36+
+/// Noop provider
37+
+pub struct NoopProvider {}
38+
+
39+
+impl NoopProvider {
40+
+ pub fn try_new() -> Result<NoopProvider> {
41+
+ Ok(Self { })
42+
+ }
43+
+}
44+
+
45+
+impl MetadataProvider for NoopProvider {}
46+
--
47+
2.44.2
48+
49+
From fce6d962436fad9c0700174c7fab99ba35d653fd Mon Sep 17 00:00:00 2001
50+
From: Mathieu Tortuyaux <[email protected]>
51+
Date: Wed, 6 Nov 2024 15:14:26 +0100
52+
Subject: [PATCH 2/2] proxmox: use noop provider if no configdrive
53+
54+
Signed-off-by: Mathieu Tortuyaux <[email protected]>
55+
---
56+
src/metadata.rs | 4 ++--
57+
src/providers/mod.rs | 1 +
58+
src/providers/proxmoxve/mod.rs | 14 ++++++++++++++
59+
3 files changed, 17 insertions(+), 2 deletions(-)
60+
61+
diff --git a/src/metadata.rs b/src/metadata.rs
62+
index 94f9238..bd311f7 100644
63+
--- a/src/metadata.rs
64+
+++ b/src/metadata.rs
65+
@@ -33,7 +33,7 @@ use crate::providers::openstack;
66+
use crate::providers::openstack::network::OpenstackProviderNetwork;
67+
use crate::providers::packet::PacketProvider;
68+
use crate::providers::powervs::PowerVSProvider;
69+
-use crate::providers::proxmoxve::ProxmoxVEConfigDrive;
70+
+use crate::providers::proxmoxve;
71+
use crate::providers::scaleway::ScalewayProvider;
72+
use crate::providers::vmware::VmwareProvider;
73+
use crate::providers::vultr::VultrProvider;
74+
@@ -71,7 +71,7 @@ pub fn fetch_metadata(provider: &str) -> Result<Box<dyn providers::MetadataProvi
75+
"openstack-metadata" => box_result!(OpenstackProviderNetwork::try_new()?),
76+
"packet" => box_result!(PacketProvider::try_new()?),
77+
"powervs" => box_result!(PowerVSProvider::try_new()?),
78+
- "proxmoxve" => box_result!(ProxmoxVEConfigDrive::try_new()?),
79+
+ "proxmoxve" => proxmoxve::try_config_drive_else_leave(),
80+
"scaleway" => box_result!(ScalewayProvider::try_new()?),
81+
"vmware" => box_result!(VmwareProvider::try_new()?),
82+
"vultr" => box_result!(VultrProvider::try_new()?),
83+
diff --git a/src/providers/mod.rs b/src/providers/mod.rs
84+
index e17d551..dab07e1 100644
85+
--- a/src/providers/mod.rs
86+
+++ b/src/providers/mod.rs
87+
@@ -35,6 +35,7 @@ pub mod ibmcloud;
88+
pub mod ibmcloud_classic;
89+
pub mod kubevirt;
90+
pub mod microsoft;
91+
+pub mod noop;
92+
pub mod openstack;
93+
pub mod packet;
94+
pub mod powervs;
95+
diff --git a/src/providers/proxmoxve/mod.rs b/src/providers/proxmoxve/mod.rs
96+
index 14146b0..a965162 100644
97+
--- a/src/providers/proxmoxve/mod.rs
98+
+++ b/src/providers/proxmoxve/mod.rs
99+
@@ -12,6 +12,11 @@
100+
// See the License for the specific language governing permissions and
101+
// limitations under the License.
102+
103+
+use anyhow::Result;
104+
+use crate::providers;
105+
+use crate::providers::noop::NoopProvider;
106+
+use slog_scope::warn;
107+
+
108+
mod configdrive;
109+
pub use configdrive::*;
110+
111+
@@ -20,3 +25,12 @@ pub use cloudconfig::*;
112+
113+
#[cfg(test)]
114+
mod tests;
115+
+
116+
+pub fn try_config_drive_else_leave() -> Result<Box<dyn providers::MetadataProvider>> {
117+
+ if let Ok(config_drive) = ProxmoxVEConfigDrive::try_new() {
118+
+ Ok(Box::new(config_drive))
119+
+ } else {
120+
+ warn!("failed to locate config-drive - aborting ProxmoxVE provider");
121+
+ Ok(Box::new(NoopProvider::try_new()?))
122+
+ }
123+
+}
124+
--
125+
2.44.2
126+

0 commit comments

Comments
 (0)