Skip to content

Commit

Permalink
incusd/cluster: Actually use YAML for resources cache
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Oct 21, 2024
1 parent 4c574b9 commit da4d1ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/incusd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"crypto/x509"
"database/sql"
"encoding/json"
"errors"
"fmt"
"io"
Expand All @@ -26,6 +25,7 @@ import (
"github.com/gorilla/mux"
liblxc "github.com/lxc/go-lxc"
"golang.org/x/sys/unix"
yaml "gopkg.in/yaml.v2"

internalIO "github.com/lxc/incus/v6/internal/io"
"github.com/lxc/incus/v6/internal/linux"
Expand Down Expand Up @@ -2405,7 +2405,7 @@ func (d *Daemon) heartbeatHandler(w http.ResponseWriter, r *http.Request, isLead
}

// Write to cache.
data, err := json.Marshal(resources)
data, err := yaml.Marshal(resources)
if err != nil {
return
}
Expand Down
5 changes: 3 additions & 2 deletions internal/server/instance/drivers/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package drivers

import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
Expand All @@ -11,6 +10,8 @@ import (
"strconv"
"strings"

yaml "gopkg.in/yaml.v2"

"github.com/lxc/incus/v6/internal/linux"
"github.com/lxc/incus/v6/internal/server/db"
"github.com/lxc/incus/v6/internal/server/instance/instancetype"
Expand Down Expand Up @@ -56,7 +57,7 @@ func GetClusterCPUFlags(ctx context.Context, s *state.State, servers []string, a
}

res := api.Resources{}
err = json.Unmarshal(data, &res)
err = yaml.Unmarshal(data, &res)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit da4d1ac

Please sign in to comment.