(source: CreateVmPayloadSource)
| 440 | }; |
| 441 | |
| 442 | function buildCreateVmPayload(source: CreateVmPayloadSource): VmmTypes.IVmConfiguration { |
| 443 | const normalizedPorts = normalizePorts(source.ports); |
| 444 | return { |
| 445 | name: source.name.trim(), |
| 446 | image: source.image.trim(), |
| 447 | compose_file: source.compose_file, |
| 448 | vcpu: Math.max(1, Number(source.vcpu) || 1), |
| 449 | memory: Math.max(0, Number(source.memory) || 0), |
| 450 | disk_size: Math.max(0, Number(source.disk_size) || 0), |
| 451 | ports: normalizedPorts, |
| 452 | encrypted_env: source.encrypted_env, |
| 453 | app_id: source.app_id || undefined, |
| 454 | user_config: source.user_config || '', |
| 455 | hugepages: !!source.hugepages, |
| 456 | pin_numa: !!source.pin_numa, |
| 457 | no_tee: source.no_tee ?? false, |
| 458 | networking: source.net_mode ? { mode: source.net_mode } : undefined, |
| 459 | gpus: source.gpus, |
| 460 | kms_urls: source.kms_urls?.filter((url) => url && url.trim().length) ?? [], |
| 461 | gateway_urls: source.gateway_urls?.filter((url) => url && url.trim().length) ?? [], |
| 462 | stopped: !!source.stopped, |
| 463 | }; |
| 464 | } |
| 465 | |
| 466 | const autoMemoryDisplay = (mb: number): { memoryValue: number; memoryUnit: MemoryUnit } => { |
| 467 | if (mb >= 1024) { |
no test coverage detected