Skip to content

Commit

Permalink
chore: rename drs to crs
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalvas committed Nov 28, 2023
1 parent 8c5eb45 commit 2ab8cb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions cmd/server/app/periodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
const periodicTime = 15

func (app *App) runPeriodic() error {
if err := app.SetupDRS(); err != nil {
return fmt.Errorf("setup DRS: %w", err)
if err := app.SetupCRS(); err != nil {
return fmt.Errorf("setup CRS: %w", err)
}

if err := app.SetupDRSQemu(); err != nil {
return fmt.Errorf("setup DRS QEMU: %w", err)
if err := app.SetupCRSQemu(); err != nil {
return fmt.Errorf("setup CRS QEMU: %w", err)
}

return nil
Expand Down
20 changes: 10 additions & 10 deletions cmd/server/app/setup_drs.go → cmd/server/app/setup_crs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
)

const (
drsMaxNodePriority = 1000
drsMinNodePriority = 1
crsMaxNodePriority = 1000
crsMinNodePriority = 1
)

func (app *App) SetupDRS() error {
func (app *App) SetupCRS() error {
hasSharedStorage, err := app.proxmox.HasSharedStorage()
if err != nil {
return err
Expand All @@ -36,8 +36,8 @@ func (app *App) SetupDRS() error {
createdPin := false
createdPrefer := false

haGroupPin := fmt.Sprintf("drs-pin-node-%s", strings.ToLower(row.Node))
haGroupPrefer := fmt.Sprintf("drs-prefer-node-%s", strings.ToLower(row.Node))
haGroupPin := fmt.Sprintf("crs-pin-node-%s", strings.ToLower(row.Node))
haGroupPrefer := fmt.Sprintf("crs-prefer-node-%s", strings.ToLower(row.Node))

actualHaGroups[haGroupPin] = true

Expand All @@ -60,7 +60,7 @@ func (app *App) SetupDRS() error {

app.proxmox.ClusterHAGroupCreate(proxmox.ClusterHAGroup{
Group: haGroupPin,
Nodes: fmt.Sprintf("%s:%d", row.Node, drsMaxNodePriority),
Nodes: fmt.Sprintf("%s:%d", row.Node, crsMaxNodePriority),
NoFailback: 1,
Restricted: 1,
})
Expand All @@ -74,11 +74,11 @@ func (app *App) SetupDRS() error {
for _, node := range nodes {
if node.Node == row.Node {
groupNodes = append(groupNodes,
fmt.Sprintf("%s:%d", node.Node, drsMaxNodePriority),
fmt.Sprintf("%s:%d", node.Node, crsMaxNodePriority),
)
} else {
groupNodes = append(groupNodes,
fmt.Sprintf("%s:%d", node.Node, drsMinNodePriority),
fmt.Sprintf("%s:%d", node.Node, crsMinNodePriority),
)
}
}
Expand All @@ -99,8 +99,8 @@ func (app *App) SetupDRS() error {
return err
}
for _, row := range clusterHAGroupList {
if strings.HasPrefix(row.Group, "drs-pin-node-") ||
strings.HasPrefix(row.Group, "drs-prefer-node-") {
if strings.HasPrefix(row.Group, "crs-pin-node-") ||
strings.HasPrefix(row.Group, "crs-prefer-node-") {

if _, exists := actualHaGroups[row.Group]; !exists {
log.Println("deleting ha group", row.Group)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/vitalvas/proxmox-cloud-resource-scheduler/internal/proxmox"
)

func (app *App) SetupDRSQemu() error {
func (app *App) SetupCRSQemu() error {
resources, err := app.proxmox.ClusterHAResourcesList()
if err != nil {
return err
Expand All @@ -20,7 +20,7 @@ func (app *App) SetupDRSQemu() error {
}

for _, node := range nodeList {
haGroupPin := fmt.Sprintf("drs-pin-node-%s", strings.ToLower(node.Node))
haGroupPin := fmt.Sprintf("crs-pin-node-%s", strings.ToLower(node.Node))

qemuList, err := app.proxmox.NodeQEMUList(node)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func (app *App) SetupDRSQemu() error {
data := proxmox.ClusterHAResources{
SID: sid,
Type: "vm",
Comment: "drs-managed",
Comment: "crs-managed",
MaxRelocate: 10,
MaxRestart: 10,
Group: haGroupPin,
Expand Down

0 comments on commit 2ab8cb4

Please sign in to comment.