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 44from upcloud_api .firewall import FirewallRule
55from upcloud_api .ip_address import IPAddress
66from 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
88from upcloud_api .upcloud_resource import UpCloudResource
99from upcloud_api .utils import try_it_n_times
1010
@@ -393,6 +393,16 @@ def prepare_post_body(self):
393393 if hasattr (self , 'metadata' ) and isinstance (self .metadata , bool ):
394394 body ['server' ]['metadata' ] = "yes" if self .metadata else "no"
395395
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+
396406 if hasattr (self , 'server_group' ) and isinstance (self .server_group , ServerGroup ):
397407 body ['server' ]['server_group' ] = f"{ self .server_group .uuid } "
398408
Original file line number Diff line number Diff line change 22
33from upcloud_api .upcloud_resource import UpCloudResource
44
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+
517
618class BackupDeletionPolicy (Enum ):
719 """
You can’t perform that action at this time.
0 commit comments