Skip to content

Commit 0f5b0f7

Browse files
mpywelllbajolet-hashicorp
authored andcommitted
common: restore default disk backup behaviour
In testing it was observed that the upstream disk API changes are excluding disks from Proxmox backup jobs by default (setting backup=0). This commit reinstates the behaviour of previous versions of this packer-plugin-proxmox where disks created by Packer are enabled for backup by default. A new ExcludeFromBackup disk field has been added to opt out of this behaviour.
1 parent 29c0fb9 commit 0f5b0f7

File tree

7 files changed

+132
-53
lines changed

7 files changed

+132
-53
lines changed

.web-docs/components/builder/clone/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ Example:
447447
- `asyncio` (string) - Configure Asynchronous I/O. Can be `native`, `threads`, or `io_uring`.
448448
Defaults to io_uring.
449449

450+
- `exclude_from_backup` (bool) - Exclude disk from Proxmox backup jobs
451+
Defaults to false.
452+
450453
- `discard` (bool) - Relay TRIM commands to the underlying storage. Defaults
451454
to false. See the
452455
[Proxmox documentation](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_hard_disk_discard)

.web-docs/components/builder/iso/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ Example:
587587
- `asyncio` (string) - Configure Asynchronous I/O. Can be `native`, `threads`, or `io_uring`.
588588
Defaults to io_uring.
589589

590+
- `exclude_from_backup` (bool) - Exclude disk from Proxmox backup jobs
591+
Defaults to false.
592+
590593
- `discard` (bool) - Relay TRIM commands to the underlying storage. Defaults
591594
to false. See the
592595
[Proxmox documentation](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_hard_disk_discard)

builder/proxmox/common/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ type diskConfig struct {
362362
// Configure Asynchronous I/O. Can be `native`, `threads`, or `io_uring`.
363363
// Defaults to io_uring.
364364
AsyncIO string `mapstructure:"asyncio"`
365+
// Exclude disk from Proxmox backup jobs
366+
// Defaults to false.
367+
ExcludeFromBackup bool `mapstructure:"exclude_from_backup"`
365368
// Relay TRIM commands to the underlying storage. Defaults
366369
// to false. See the
367370
// [Proxmox documentation](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_hard_disk_discard)

builder/proxmox/common/config.hcl2spec.go

Lines changed: 22 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/proxmox/common/step_start_vm.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
299299
case "K":
300300
size = proxmox.QemuDiskSize(tmpSize)
301301
}
302+
backup := true
303+
if disks[idx].ExcludeFromBackup {
304+
backup = false
305+
}
302306

303307
switch disks[idx].Type {
304308
case "ide":
@@ -311,6 +315,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
311315
Format: proxmox.QemuDiskFormat(disks[idx].DiskFormat),
312316
Discard: disks[idx].Discard,
313317
EmulateSSD: disks[idx].SSD,
318+
Backup: backup,
314319
},
315320
}
316321
for {
@@ -371,6 +376,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
371376
Discard: disks[idx].Discard,
372377
EmulateSSD: disks[idx].SSD,
373378
IOThread: disks[idx].IOThread,
379+
Backup: backup,
374380
},
375381
}
376382
for {
@@ -400,6 +406,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
400406
Format: proxmox.QemuDiskFormat(disks[idx].DiskFormat),
401407
Discard: disks[idx].Discard,
402408
EmulateSSD: disks[idx].SSD,
409+
Backup: backup,
403410
},
404411
}
405412
for {
@@ -429,6 +436,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
429436
Format: proxmox.QemuDiskFormat(disks[idx].DiskFormat),
430437
Discard: disks[idx].Discard,
431438
IOThread: disks[idx].IOThread,
439+
Backup: backup,
432440
},
433441
}
434442
for {

0 commit comments

Comments
 (0)