MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / buildCreateVmPayload

Function buildCreateVmPayload

vmm/ui/src/composables/useVmManager.ts:442–464  ·  view source on GitHub ↗
(source: CreateVmPayloadSource)

Source from the content-addressed store, hash-verified

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) {

Callers 2

createVmFunction · 0.85
cloneConfigFunction · 0.85

Calls 2

normalizePortsFunction · 0.85
NumberInterface · 0.85

Tested by

no test coverage detected