Skip to content

PCP-6208: Enhance MaaS machine handling during commissioning phase & add ip check before compose#324

Open
Kun483 wants to merge 4 commits intospectro-masterfrom
PCP-6208
Open

PCP-6208: Enhance MaaS machine handling during commissioning phase & add ip check before compose#324
Kun483 wants to merge 4 commits intospectro-masterfrom
PCP-6208

Conversation

@Kun483
Copy link
Copy Markdown
Collaborator

@Kun483 Kun483 commented Mar 11, 2026

  • Added a new error handling for machine commissioning state to improve clarity.
  • Updated the reconcile logic to handle the commissioning state, allowing for retries of static IP configuration after commissioning completes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enhances MaaS machine reconciliation during commissioning by introducing a dedicated commissioning error and handling it in the controller to enable safe retries of static IP configuration once commissioning completes.

Changes:

  • Add a new sentinel error (ErrMachineCommissioning) returned when a machine is in MaaS “Commissioning” state during static IP configuration.
  • Update MaasMachineReconciler to detect this error, mark the machine as deploying, and requeue after a short delay.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/maas/machine/machine.go Introduces ErrMachineCommissioning and returns it when static IP configuration is attempted during commissioning.
controllers/maasmachine_controller.go Adds error-specific reconcile handling to requeue and update conditions while commissioning is in progress.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 828 to 832
// Special handling for Commissioning state: skip static IP configuration to avoid blocking commissioning
if machineState == "Commissioning" {
s.scope.Info("Machine is commissioning, skipping static IP configuration to avoid interfering with commissioning process. Will configure after commissioning completes", "systemID", systemID)
// Return error to requeue - static IP will be configured after commissioning completes
return fmt.Errorf("machine is commissioning, static IP configuration will be retried after commissioning completes")
return ErrMachineCommissioning
}
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

Consider adding a unit test for this commissioning-path in setMachineStaticIP. Right now there are no tests asserting that when MAAS reports State() == "Commissioning", the method returns ErrMachineCommissioning (and that the error remains detectable via errors.Is after any wrapping). This is an important behavioral contract because the controller reconciliation flow depends on it for requeue behavior.

Copilot uses AI. Check for mistakes.
@Kun483 Kun483 changed the title PCP-6208: Enhance MaaS machine handling during commissioning phase PCP-6208: Enhance MaaS machine handling during commissioning phase & add ip check before compose Mar 19, 2026
Kun483 added 3 commits March 19, 2026 12:09
… for NetworkInterfaces, IPAddresses, Tags, VMHosts, and Subnets in client mock. Enhance static IP handling in machine service during VM composition.
…cileNormal method to streamline error handling during VM creation.
github.com/onsi/gomega v1.36.3
github.com/pkg/errors v0.9.1
github.com/spectrocloud/maas-client-go v0.1.4-beta1
github.com/spectrocloud/maas-client-go v0.1.4-beta2
Copy link
Copy Markdown
Contributor

@AmitSahastra AmitSahastra Mar 24, 2026

Choose a reason for hiding this comment

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

any reason to go for beta2 naming instead of updating minor version?

Also, maas client go release looks wrong, its a public repo we can avoid PCP taging there.
v0.1.4-beta2: Merge pull request #44 from spectrocloud/PCP-6208

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Got it. I'll add a new feature in maas-client-go and update the minor version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants