Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue CPU threshold #234

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading