Skip to content

Commit

Permalink
lxd-to-incus: Fix various issues
Browse files Browse the repository at this point in the history
Normal static anlysis tests weren't properly running on lxd-to-incus as
it was treated as a separated Go module.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Jan 23, 2024
1 parent 07f05b7 commit ceb3aa6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/lxd-to-incus/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func lz4Uncompress(zfilename string) error {
}

if n != 4 {
return fmt.Errorf("Read only %n bytes from %q: %w", n, zfilename)
return fmt.Errorf("Read only %d bytes from %q", n, zfilename)
}

// Check the file magic, and return now if it's not an lz4 file.
Expand Down
9 changes: 4 additions & 5 deletions cmd/lxd-to-incus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ func (c *cmdMigrate) Run(app *cobra.Command, args []string) error {
fmt.Println(`
The migration is now ready to proceed.
At this point, the source server and all its instances will be stopped.
Instances will come back online once the migration is complete.
`)
Instances will come back online once the migration is complete.`)

ok, err := c.global.asker.AskBool("Proceed with the migration? [default=no]: ", "no")
if err != nil {
Expand All @@ -415,8 +414,7 @@ Manual action will be needed on each of the server prior to Incus being function
It will then convert the current server over to Incus and then wait for the other servers to be converted.
Do not attempt to manually run this tool on any of the other servers in the cluster.
Instead this tool will be providing specific commands for each of the servers.
`)
Instead this tool will be providing specific commands for each of the servers.`)

ok, err := c.global.asker.AskBool("Proceed with the migration? [default=no]: ", "no")
if err != nil {
Expand Down Expand Up @@ -693,7 +691,8 @@ Instead this tool will be providing specific commands for each of the servers.
if !c.flagClusterMember {
_, _ = logFile.WriteString("Waiting for user to run command on other cluster members\n")

fmt.Println("=> Waiting for other cluster servers\n")
fmt.Println("=> Waiting for other cluster servers")
fmt.Println("")
fmt.Printf("Please run `lxd-to-incus --cluster-member` on all other servers in the cluster\n\n")
for {
ok, err := c.global.asker.AskBool("The command has been started on all other servers? [default=no]: ", "no")
Expand Down
4 changes: 2 additions & 2 deletions cmd/lxd-to-incus/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (c *cmdMigrate) validate(source Source, target Target) error {

instances, err := c.GetInstances(api.InstanceTypeAny)
if err != nil {
fmt.Errorf("Couldn't list instances in project %q: %w", err)
return fmt.Errorf("Couldn't list instances in project %q: %w", project.Name, err)
}

for _, inst := range instances {
Expand All @@ -320,7 +320,7 @@ func (c *cmdMigrate) validate(source Source, target Target) error {

profiles, err := c.GetProfiles()
if err != nil {
fmt.Errorf("Couldn't list profiles in project %q: %w", err)
return fmt.Errorf("Couldn't list profiles in project %q: %w", project.Name, err)
}

for _, profile := range profiles {
Expand Down

0 comments on commit ceb3aa6

Please sign in to comment.