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

Feature: Optional HA settings #317

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Tinyblargon
Copy link
Collaborator

Add support for all guest HA options.

These HA settings have been added as an optional substructure to ConfigQemu and ConfigLxc, not setting this means that the HA settings won't be updated.

The following type changes where made:

Before:

type VmRef struct {
 haState string
 haGroup string
}
type HAGroup struct {
 Group string // The HA group identifier.
}

After:

type VmRef struct {
 haState HaState
 haGroup HaGroupName
}
type HAGroup struct {
 Group HaGroupName // The HA group identifier.
}

Marked the following as deprecated *Client.ReadVMHA() *Client.UpdateVMHA()

Will make a corresponding pr to the Terraform provider as well.

Closes #314

@Tinyblargon
Copy link
Collaborator Author

To keep compatibility with the Terraform provider all settings in GuestHA must be optional.

Reallocates and Restarts will default to 0 otherwise. Making them optional means that they won't be set in the api call, and proxmox will enforce a default.

Might as well make Comment and Group optional.

The new schema would look like this:

type GuestHA struct {
	Comment     *string      `json:"comment"`          // Description.
	Delete      bool         `json:"remove,omitempty"` // When true, remove HA settings for the Guest.
	Group       *HaGroupName `json:"group"`            // May be empty, in which case the guest is not part of a group.
	Reallocates *HaRelocate  `json:"reallocates"`
	Restarts    *HaRestart   `json:"restarts"`
	State       *HaState     `json:"state"`
}

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

Successfully merging this pull request may close these issues.

Feature: Optional HA settings
2 participants