Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions builder/proxmox/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ type diskConfig struct {
//
// This cannot work with virtio disks.
SSD bool `mapstructure:"ssd"`
// Exclude disk from replication jobs.
// Defaults to false.
SkipReplication bool `mapstructure:"skip_replication"`
}

// Set the efidisk storage options.
Expand Down
2 changes: 2 additions & 0 deletions builder/proxmox/common/config.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions builder/proxmox/common/step_start_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
if disks[idx].ExcludeFromBackup {
backup = false
}
replicate := true
if disks[idx].SkipReplication {
replicate = false
}

switch disks[idx].Type {
case "ide":
Expand All @@ -448,6 +452,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
Discard: disks[idx].Discard,
EmulateSSD: disks[idx].SSD,
Backup: backup,
Replicate: replicate,
},
}
for {
Expand Down Expand Up @@ -488,6 +493,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
EmulateSSD: disks[idx].SSD,
IOThread: disks[idx].IOThread,
Backup: backup,
Replicate: replicate,
},
}
for {
Expand Down Expand Up @@ -521,6 +527,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
Discard: disks[idx].Discard,
EmulateSSD: disks[idx].SSD,
Backup: backup,
Replicate: replicate,
},
}
for {
Expand Down Expand Up @@ -554,6 +561,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
Discard: disks[idx].Discard,
IOThread: disks[idx].IOThread,
Backup: backup,
Replicate: replicate,
},
}
for {
Expand Down
12 changes: 11 additions & 1 deletion builder/proxmox/common/step_start_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
SSD: false,
ExcludeFromBackup: false,
SkipReplication: false,
},
},
[]ISOsConfig{},
Expand All @@ -541,6 +542,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
EmulateSSD: false,
IOThread: false,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -560,6 +562,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
SSD: false,
ExcludeFromBackup: false,
SkipReplication: false,
},
},
[]ISOsConfig{},
Expand All @@ -580,6 +583,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
EmulateSSD: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -599,6 +603,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
SSD: false,
ExcludeFromBackup: false,
SkipReplication: false,
},
},
[]ISOsConfig{},
Expand All @@ -619,6 +624,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -638,6 +644,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
SSD: false,
ExcludeFromBackup: false,
SkipReplication: false,
},
},
[]ISOsConfig{},
Expand All @@ -658,13 +665,14 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
},
},
{
"exclude disk from backup",
"exclude disk from backup and skip for replication jobs",
[]diskConfig{
{
Type: "virtio",
Expand All @@ -676,6 +684,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
SSD: false,
ExcludeFromBackup: true,
SkipReplication: true,
},
},
[]ISOsConfig{},
Expand All @@ -695,6 +704,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: false,
Replicate: false,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@

This cannot work with virtio disks.

- `skip_replication` (bool) - Exclude disk from replication jobs.
Defaults to false.

<!-- End of code generated from the comments of the diskConfig struct in builder/proxmox/common/config.go; -->