|
40 | 40 | AWS_INSTANCES_OVERVIEW_FILE, |
41 | 41 | AWS_INSTANCES_OVERVIEW_FILE_ETAG, |
42 | 42 | AWS_INSTANCES_OVERVIEW_URL, |
| 43 | + MEM_BLOCK_BOUNDARY_GiB, |
| 44 | + MEM_BLOCK_SIZE_GiB, |
43 | 45 | ) |
44 | 46 | from igvm.transaction import Transaction |
45 | 47 | from igvm.utils import parse_size, wait_until |
@@ -233,6 +235,27 @@ def check_serveradmin_config(self): |
233 | 235 | ('puppet_master', lambda v: True, 'puppet_master must be set'), |
234 | 236 | ] |
235 | 237 |
|
| 238 | + # Hosts defined with topmost address higher than MEM_BLOCK_BOUNDARY_GiB will use |
| 239 | + # 1GiB or 2GiB memory block size. There is always extra 1GiB address space for |
| 240 | + # the PCI bus. A host defined with an even amount of memory ends up with an |
| 241 | + # an odd-sized address space and block size of 1GiB. A host with an odd amount |
| 242 | + # of memory ends up with an even address space size and block size of 2GiB. |
| 243 | + # The latter case makes it problematic to add memory modules: depending on |
| 244 | + # their size, which also depends on NUMA layout, they might not align with |
| 245 | + # the memory block size. |
| 246 | + # |
| 247 | + # Enforce memory sizes resulting in block size of 1GiB. |
| 248 | + if self.dataset_obj['memory'] >= MEM_BLOCK_BOUNDARY_GiB * 1024 : |
| 249 | + validations.extend([ |
| 250 | + ( |
| 251 | + 'memory', |
| 252 | + lambda v: v % (MEM_BLOCK_SIZE_GiB * 1024) == 0, |
| 253 | + f'For VMs with memory size of {MEM_BLOCK_BOUNDARY_GiB}GiB or more ' |
| 254 | + f'it must be a multiple of {MEM_BLOCK_SIZE_GiB}GiB', |
| 255 | + ), |
| 256 | + ]) |
| 257 | + |
| 258 | + |
236 | 259 | if self.dataset_obj['datacenter_type'] == 'aws.dct': |
237 | 260 | validations.extend([ |
238 | 261 | ('aws_key_name', lambda v: True, 'aws_key_name must be set'), |
|
0 commit comments