Implement restart policy for VMs (#83)

* Implement restart policy for VMs

* Do not update VM.Resource, we only use it as a read-only specification

* Err()/setErr(): use atomic.Pointer instead of sync.Mutex
This commit is contained in:
Nikolay Edigaryev
2023-04-24 19:30:08 +04:00
committed by GitHub
parent 010df300a3
commit 60e564da88
22 changed files with 482 additions and 382 deletions
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"github.com/cirruslabs/orchard/pkg/client"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
"time"
)
@@ -58,7 +57,7 @@ func runPauseWorker(cmd *cobra.Command, args []string) error {
return err
}
hasActiveVMs := slices.ContainsFunc(maps.Values(vms), func(vm v1.VM) bool {
hasActiveVMs := slices.ContainsFunc(vms, func(vm v1.VM) bool {
return !vm.TerminalState()
})
if !hasActiveVMs {