Skip to content

Commit c956b1c

Browse files
Address more Copilot suggestions
1 parent 0c9466b commit c956b1c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

linode_api4/objects/linode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
from linode_api4.util import drop_null_keys, generate_device_suffixes
4343

4444
PASSWORD_CHARS = string.ascii_letters + string.digits + string.punctuation
45+
MIN_DEVICE_LIMIT = 8
46+
MEMORY_DIVISOR = 1024
47+
MAX_DEVICE_LIMIT = 64
4548

4649

4750
class InstanceDiskEncryptionType(StrEnum):
@@ -1259,7 +1262,7 @@ def config_create(
12591262

12601263
hypervisor_prefix = "sd" if self.hypervisor == "kvm" else "xvd"
12611264

1262-
device_limit = int(max(8, min(self.specs.memory // 1024, 64)))
1265+
device_limit = int(max(MIN_DEVICE_LIMIT, min(self.specs.memory // MEMORY_DIVISOR, MAX_DEVICE_LIMIT)))
12631266

12641267
device_names = [
12651268
hypervisor_prefix + suffix

0 commit comments

Comments
 (0)