Skip to content

Commit cd9e5a4

Browse files
authored
Merge pull request #423 from wearespindle/master
Add HA Group option to schema & docs
2 parents 84f1434 + 931dae6 commit cd9e5a4

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

docs/resources/lxc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ The following arguments may be optionally defined when using this resource:
174174
* `force` - A boolean that allows the overwriting of pre-existing containers.
175175
* `full` - When cloning, create a full copy of all disks. This is always done when you clone a normal CT. For CT template it creates a linked clone by default.
176176
* `hastate` - Requested HA state for the resource. One of "started", "stopped", "enabled", "disabled", or "ignored". See the [docs about HA](https://pve.proxmox.com/pve-docs/chapter-ha-manager.html#ha_manager_resource_config) for more info.
177+
* `hagroup` - The HA group identifier the resource belongs to (requires `hastate` to be set!). See the [docs about HA](https://pve.proxmox.com/pve-docs/chapter-ha-manager.html#ha_manager_resource_config) for more info.
177178
* `hookscript` - A string containing [a volume identifier to a script](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hookscripts_2) that will be executed during various steps throughout the container's lifetime. The script must be an executable file.
178179
* `hostname` - Specifies the host name of the container.
179180
* `ignore_unpack_errors` - A boolean that determines if template extraction errors are ignored during container creation.

docs/resources/vm_qemu.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The following arguments are supported in the top level resource block.
9595
| `clone` | `str` | | The base VM from which to clone to create the new VM. |
9696
| `full_clone` | `bool` | `true` | Set to `true` to create a full clone, or `false` to create a linked clone. See the [docs about cloning](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_copy_and_clone) for more info. Only applies when `clone` is set. |
9797
| `hastate` | `str` | | Requested HA state for the resource. One of "started", "stopped", "enabled", "disabled", or "ignored". See the [docs about HA](https://pve.proxmox.com/pve-docs/chapter-ha-manager.html#ha_manager_resource_config) for more info. |
98+
| `hagroup` | `str` | | The HA group identifier the resource belongs to (requires `hastate` to be set!). See the [docs about HA](https://pve.proxmox.com/pve-docs/chapter-ha-manager.html#ha_manager_resource_config) for more info.|
9899
| `qemu_os` | `str` | `"l26"` | The type of OS in the guest. Set properly to allow Proxmox to enable optimizations for the appropriate guest OS. It takes the value from the source template and ignore any changes to resource configuration parameter. |
99100
| `memory` | `int` | `512` | The amount of memory to allocate to the VM in Megabytes. |
100101
| `balloon` | `int` | `0` | The minimum amount of memory to allocate to the VM in Megabytes, when Automatic Memory Allocation is desired. Proxmox will enable a balloon device on the guest to manage dynamic allocation. See the [docs about memory](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_memory) for more info. |

proxmox/resource_lxc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ func resourceLxc() *schema.Resource {
113113
Type: schema.TypeString,
114114
Optional: true,
115115
},
116+
"hagroup": {
117+
Type: schema.TypeString,
118+
Optional: true,
119+
},
116120
"hookscript": {
117121
Type: schema.TypeString,
118122
Optional: true,
@@ -430,6 +434,7 @@ func resourceLxcCreate(d *schema.ResourceData, meta interface{}) error {
430434
config.Force = d.Get("force").(bool)
431435
config.Full = d.Get("full").(bool)
432436
config.HaState = d.Get("hastate").(string)
437+
config.HaGroup = d.Get("hagroup").(string)
433438
config.Hookscript = d.Get("hookscript").(string)
434439
config.Hostname = d.Get("hostname").(string)
435440
config.IgnoreUnpackErrors = d.Get("ignore_unpack_errors").(bool)
@@ -578,6 +583,7 @@ func resourceLxcUpdate(d *schema.ResourceData, meta interface{}) error {
578583
}
579584
config.Force = d.Get("force").(bool)
580585
config.HaState = d.Get("hastate").(string)
586+
config.HaGroup = d.Get("hagroup").(string)
581587
config.Hookscript = d.Get("hookscript").(string)
582588
config.Hostname = d.Get("hostname").(string)
583589
config.IgnoreUnpackErrors = d.Get("ignore_unpack_errors").(bool)
@@ -769,6 +775,7 @@ func _resourceLxcRead(d *schema.ResourceData, meta interface{}) error {
769775
d.Set("description", config.Description)
770776
d.Set("force", config.Force)
771777
d.Set("hastate", vmr.HaState)
778+
d.Set("hagroup", vmr.HaGroup)
772779
d.Set("hookscript", config.Hookscript)
773780
d.Set("hostname", config.Hostname)
774781
d.Set("ignore_unpack_errors", config.IgnoreUnpackErrors)

proxmox/resource_vm_qemu.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func resourceVmQemu() *schema.Resource {
116116
Type: schema.TypeString,
117117
Optional: true,
118118
},
119+
"hagroup": {
120+
Type: schema.TypeString,
121+
Optional: true,
122+
},
119123
"qemu_os": {
120124
Type: schema.TypeString,
121125
Optional: true,
@@ -684,6 +688,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
684688
Hotplug: d.Get("hotplug").(string),
685689
Scsihw: d.Get("scsihw").(string),
686690
HaState: d.Get("hastate").(string),
691+
HaGroup: d.Get("hagroup").(string),
687692
QemuOs: d.Get("qemu_os").(string),
688693
Tags: d.Get("tags").(string),
689694
Args: d.Get("args").(string),
@@ -968,6 +973,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
968973
Hotplug: d.Get("hotplug").(string),
969974
Scsihw: d.Get("scsihw").(string),
970975
HaState: d.Get("hastate").(string),
976+
HaGroup: d.Get("hagroup").(string),
971977
QemuOs: d.Get("qemu_os").(string),
972978
Tags: d.Get("tags").(string),
973979
Args: d.Get("args").(string),
@@ -1229,6 +1235,7 @@ func _resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
12291235
d.Set("hotplug", config.Hotplug)
12301236
d.Set("scsihw", config.Scsihw)
12311237
d.Set("hastate", vmr.HaState())
1238+
d.Set("hagroup", vmr.HaGroup())
12321239
d.Set("qemu_os", config.QemuOs)
12331240
d.Set("tags", config.Tags)
12341241
d.Set("args", config.Args)

0 commit comments

Comments
 (0)