Skip to content

Commit

Permalink
Fix an issue CPU threshold (#234)
Browse files Browse the repository at this point in the history
- Fixed an issue with the CPU threshold that was added twice to the orchestrator
  • Loading branch information
cjlapao authored Nov 11, 2024
1 parent b4e98f4 commit 1d26319
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/orchestrator/create_host_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ func (s *OrchestratorService) validateHost(host data_models.OrchestratorHost, ar
return false, apiError
}

systemCPUThreshold := int64(1)
systemMemoryThreshold := float64(1024)
availableCpus := host.Resources.TotalAvailable.LogicalCpuCount - systemCPUThreshold
availableMemory := host.Resources.TotalAvailable.MemorySize - systemMemoryThreshold
// We will trust that the host has the reserved cpus setup correctly
// otherwise we would potentially go above the reserved cpus
availableCpus := host.Resources.TotalAvailable.LogicalCpuCount
availableMemory := host.Resources.TotalAvailable.MemorySize

// Checking for the maximum number of Apple VMs
if strings.EqualFold(specs.Type, "macvm") {
Expand Down
2 changes: 1 addition & 1 deletion src/serviceprovider/parallelsdesktop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,7 @@ func (s *ParallelsService) GetHardwareUsage(ctx basecontext.ApiContext) (*models
result.Total.DiskSize = systemInfo.DiskSize - systemInfo.FreeDiskSize

result.TotalAvailable = &models.SystemUsageItem{}
result.TotalAvailable.DiskSize = result.Total.DiskSize - result.SystemReserved.DiskSize - result.TotalReserved.DiskSize - result.TotalInUse.DiskSize
result.TotalAvailable.DiskSize = systemInfo.FreeDiskSize
result.TotalAvailable.MemorySize = result.Total.MemorySize - result.SystemReserved.MemorySize - result.TotalInUse.MemorySize
result.TotalAvailable.LogicalCpuCount = result.Total.LogicalCpuCount - result.SystemReserved.LogicalCpuCount - result.TotalInUse.LogicalCpuCount

Expand Down

0 comments on commit 1d26319

Please sign in to comment.