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

Function removeVm

vmm/ui/src/composables/useVmManager.ts:1375–1396  ·  view source on GitHub ↗
(vm: VmListItem)

Source from the content-addressed store, hash-verified

1373 }
1374
1375 async function removeVm(vm: VmListItem) {
1376 if (dangerConfirmEnabled() &&
1377 !confirm('Remove VM? This action cannot be undone.')) {
1378 return;
1379 }
1380
1381 try {
1382 if (devMode.value && vm.status === 'running') {
1383 try {
1384 await vmmRpc.stopVm({ id: vm.id });
1385 } catch (error) {
1386 recordError(`Failed to stop ${vm.name} before removal`, error);
1387 return;
1388 }
1389 }
1390
1391 await vmmRpc.removeVm({ id: vm.id });
1392 loadVMList();
1393 } catch (error) {
1394 recordError(`Failed to remove ${vm.name}`, error);
1395 }
1396 }
1397
1398 function showLogs(id: string, channel: string) {
1399 window.open(`/logs?id=${encodeURIComponent(id)}&follow=true&ansi=false&lines=200&ch=${channel}`, '_blank');

Callers

nothing calls this directly

Calls 3

dangerConfirmEnabledFunction · 0.85
recordErrorFunction · 0.85
loadVMListFunction · 0.85

Tested by

no test coverage detected