Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
whywaita committed Feb 19, 2024
1 parent ad95064 commit 28e2636
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/pkg/api/server_add_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan
op, err := client.UpdateInstanceState(instanceName, reqState, "")
if err != nil {
// Do rollback
l.Info("failed to start instance, will delete", "err", err.Error(), "failed_method", "client.UpdateInstanceState()")
if _, err := client.DeleteInstance(instanceName); err != nil {
l.Warn("failed to delete instance", "err", err.Error())
}
Expand All @@ -88,6 +89,7 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan
}
if err := op.Wait(); err != nil && !strings.EqualFold(err.Error(), "The instance is already running") {
// Do rollback
l.Info("failed to start instance, will delete", "err", err.Error(), "failed_method", "op.Wait()")
if _, err := client.DeleteInstance(instanceName); err != nil {
l.Warn("failed to delete instance", "err", err.Error())
}
Expand Down

0 comments on commit 28e2636

Please sign in to comment.