File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 4
4
from upcloud_api .firewall import FirewallRule
5
5
from upcloud_api .ip_address import IPAddress
6
6
from upcloud_api .server_group import ServerGroup
7
- from upcloud_api .storage import Storage
7
+ from upcloud_api .storage import STORAGE_OSES_WHICH_REQUIRE_METADATA , Storage
8
8
from upcloud_api .upcloud_resource import UpCloudResource
9
9
from upcloud_api .utils import try_it_n_times
10
10
@@ -393,6 +393,16 @@ def prepare_post_body(self):
393
393
if hasattr (self , 'metadata' ) and isinstance (self .metadata , bool ):
394
394
body ['server' ]['metadata' ] = "yes" if self .metadata else "no"
395
395
396
+ # metadata service has to be "yes" for certain OSes
397
+ for storage in self .storage_devices :
398
+ if (
399
+ hasattr (storage , 'os' )
400
+ and storage .os
401
+ and storage .os in STORAGE_OSES_WHICH_REQUIRE_METADATA
402
+ ):
403
+ body ['server' ]['metadata' ] = "yes"
404
+ break
405
+
396
406
if hasattr (self , 'server_group' ) and isinstance (self .server_group , ServerGroup ):
397
407
body ['server' ]['server_group' ] = f"{ self .server_group .uuid } "
398
408
Original file line number Diff line number Diff line change 2
2
3
3
from upcloud_api .upcloud_resource import UpCloudResource
4
4
5
+ STORAGE_OSES_WHICH_REQUIRE_METADATA = [
6
+ "01000000-0000-4000-8000-000020060100" , # Debian GNU/Linux 11 (Bullseye)
7
+ "01000000-0000-4000-8000-000020070100" , # Debian GNU/Linux 12 (Bookworm)
8
+ "01000000-0000-4000-8000-000030200200" , # Ubuntu Server 20.04 LTS (Focal Fossa)
9
+ "01000000-0000-4000-8000-000030220200" , # Ubuntu Server 22.04 LTS (Jammy Jellyfish)
10
+ "01000000-0000-4000-8000-000030240200" , # Ubuntu Server 24.04 LTS (Noble Numbat)
11
+ "01000000-0000-4000-8000-000140010100" , # AlmaLinux 8
12
+ "01000000-0000-4000-8000-000140020100" , # AlmaLinux 9
13
+ "01000000-0000-4000-8000-000150010100" , # Rocky Linux 8
14
+ "01000000-0000-4000-8000-000150020100" , # Rocky Linux 9
15
+ ]
16
+
5
17
6
18
class BackupDeletionPolicy (Enum ):
7
19
"""
You can’t perform that action at this time.
0 commit comments