Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxd: Minor fixes #14183

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lxd/patches.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ func patchVMRenameUUIDKey(name string, d *Daemon) error {
newUUIDKey: uuid,
}

logger.Debugf("Renaming config key %q to %q for VM %q (Project %q)", oldUUIDKey, newUUIDKey, inst.Name, inst.Project)
logger.Debugf("Renaming config key %q to %q for VM %q (project %q)", oldUUIDKey, newUUIDKey, inst.Name, inst.Project)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use logger.Ctx here instead?

Copy link
Member Author

@tomponline tomponline Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, but outside of the scope of this PR, happy to see a separate PR for it.
These were just a couple of things I noticed whilst working on another issue.

err := tx.UpdateInstanceConfig(inst.ID, changes)
if err != nil {
return fmt.Errorf("Failed renaming config key %q to %q for VM %q (Project %q): %w", oldUUIDKey, newUUIDKey, inst.Name, inst.Project, err)
return fmt.Errorf("Failed renaming config key %q to %q for VM %q (project %q): %w", oldUUIDKey, newUUIDKey, inst.Name, inst.Project, err)
}
}

Expand All @@ -518,10 +518,10 @@ func patchVMRenameUUIDKey(name string, d *Daemon) error {
newUUIDKey: uuid,
}

logger.Debugf("Renaming config key %q to %q for VM %q (Project %q)", oldUUIDKey, newUUIDKey, snap.Name, snap.Project)
logger.Debugf("Renaming config key %q to %q for VM %q (project %q)", oldUUIDKey, newUUIDKey, snap.Name, snap.Project)
err = tx.UpdateInstanceSnapshotConfig(snap.ID, changes)
if err != nil {
return fmt.Errorf("Failed renaming config key %q to %q for VM %q (Project %q): %w", oldUUIDKey, newUUIDKey, snap.Name, snap.Project, err)
return fmt.Errorf("Failed renaming config key %q to %q for VM %q (project %q): %w", oldUUIDKey, newUUIDKey, snap.Name, snap.Project, err)
}
}
}
Expand Down Expand Up @@ -1394,14 +1394,14 @@ func patchInstanceRemoveVolatileLastStateIPAddresses(_ string, d *Daemon) error
l.Debug("Removing config key from instance", logger.Ctx{"key": k})
err := tx.UpdateInstanceConfig(dbInst.ID, changes)
if err != nil {
return fmt.Errorf("Failed removing config key %q for instance %q (Project %q): %w", k, dbInst.Name, dbInst.Project, err)
return fmt.Errorf("Failed removing config key %q for instance %q (project %q): %w", k, dbInst.Name, dbInst.Project, err)
}
}

// Get snapshots for instance so we can check those too.
dbSnaps, err := tx.GetInstanceSnapshotsWithName(ctx, dbInst.Project, dbInst.Name)
if err != nil {
return fmt.Errorf("Failed getting snapshots for %q (Project %q): %w", dbInst.Name, dbInst.Project, err)
return fmt.Errorf("Failed getting snapshots for %q (project %q): %w", dbInst.Name, dbInst.Project, err)
}

for _, dbSnap := range dbSnaps {
Expand All @@ -1423,7 +1423,7 @@ func patchInstanceRemoveVolatileLastStateIPAddresses(_ string, d *Daemon) error
l.Debug("Removing config key from instance snapshot", logger.Ctx{"snapshot": dbSnap.Name, "key": k})
err := tx.UpdateInstanceSnapshotConfig(dbSnap.ID, changes)
if err != nil {
return fmt.Errorf("Failed removing config key %q for instance %q (Project %q): %w", k, dbSnap.Name, dbSnap.Project, err)
return fmt.Errorf("Failed removing config key %q for instance %q (project %q): %w", k, dbSnap.Name, dbSnap.Project, err)
}
}
}
Expand Down
Loading