Correctly handle migrations to a VHD setup

This commit is contained in:
Dane Everitt
2021-07-04 12:25:38 -07:00
committed by DaneEveritt
parent 265f8a6b39
commit d8a7bf2dde
4 changed files with 14 additions and 13 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"os"
"os/exec"
"path/filepath"
"strings"
"emperror.dev/errors"
@@ -32,7 +31,7 @@ func newMigrateVHDCommand() *cobra.Command {
},
Run: func(cmd *cobra.Command, args []string) {
client := remote.NewFromConfig(config.Get())
manager, err := server.NewManager(cmd.Context(), client)
manager, err := server.NewManager(cmd.Context(), client, true)
if err != nil {
log.WithField("error", err).Fatal("failed to create new server manager")
}
@@ -48,11 +47,6 @@ func newMigrateVHDCommand() *cobra.Command {
// Run executes the migration command.
func (m *MigrateVHDCommand) Run(ctx context.Context) error {
root := filepath.Join(config.Get().System.Data, ".disks")
if err := os.MkdirAll(root, 0600); err != nil {
return errors.Wrap(err, "failed to create root directory for virtual disks")
}
for _, s := range m.manager.All() {
s.Log().Debug("starting migration of server contents to virtual disk...")

View File

@@ -139,7 +139,7 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
log.WithField("error", err).Fatal("failed to initialize database")
}
manager, err := server.NewManager(cmd.Context(), pclient)
manager, err := server.NewManager(cmd.Context(), pclient, false)
if err != nil {
log.WithField("error", err).Fatal("failed to load server configurations")
}