Skip to content
Merged
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 .web-docs/components/builder/clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ Example:

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; -->


Expand Down
3 changes: 3 additions & 0 deletions .web-docs/components/builder/iso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ Example:

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; -->


Expand Down
3 changes: 3 additions & 0 deletions builder/proxmox/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,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 @@ -465,6 +465,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 @@ -478,6 +482,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 @@ -518,6 +523,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 @@ -551,6 +557,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 @@ -584,6 +591,7 @@ func generateProxmoxDisks(disks []diskConfig, isos []ISOsConfig, cloneSourceDisk
Discard: disks[idx].Discard,
IOThread: disks[idx].IOThread,
Backup: backup,
Replicate: replicate,
},
}
for {
Expand Down
95 changes: 95 additions & 0 deletions builder/proxmox/common/step_start_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
EmulateSSD: false,
IOThread: false,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -633,6 +634,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
EmulateSSD: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -672,6 +674,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -711,6 +714,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -748,6 +752,83 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: false,
Replicate: true,
},
},
},
},
},
{
"skip disk replication",
[]diskConfig{
{
Type: "virtio",
StoragePool: "local-lvm",
Size: "10G",
CacheMode: "none",
DiskFormat: "qcow2",
IOThread: true,
Discard: false,
SSD: false,
SkipReplication: true,
},
},
[]ISOsConfig{},
[]string{},
false,
&proxmox.QemuStorages{
Ide: &proxmox.QemuIdeDisks{},
Sata: &proxmox.QemuSataDisks{},
Scsi: &proxmox.QemuScsiDisks{},
VirtIO: &proxmox.QemuVirtIODisks{
Disk_0: &proxmox.QemuVirtIOStorage{
Disk: &proxmox.QemuVirtIODisk{
SizeInKibibytes: 10485760,
Storage: "local-lvm",
Cache: proxmox.QemuDiskCache("none"),
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
IOThread: true,
Backup: true,
Replicate: false,
},
},
},
},
},
{
"do not skip disk replication",
[]diskConfig{
{
Type: "virtio",
StoragePool: "local-lvm",
Size: "10G",
CacheMode: "none",
DiskFormat: "qcow2",
IOThread: true,
Discard: false,
SSD: false,
SkipReplication: false,
},
},
[]ISOsConfig{},
[]string{},
false,
&proxmox.QemuStorages{
Ide: &proxmox.QemuIdeDisks{},
Sata: &proxmox.QemuSataDisks{},
Scsi: &proxmox.QemuScsiDisks{},
VirtIO: &proxmox.QemuVirtIODisks{
Disk_0: &proxmox.QemuVirtIOStorage{
Disk: &proxmox.QemuVirtIODisk{
SizeInKibibytes: 10485760,
Storage: "local-lvm",
Cache: proxmox.QemuDiskCache("none"),
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -1118,6 +1199,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuIdeStorage{
Expand All @@ -1128,6 +1210,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -1140,6 +1223,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuSataStorage{
Expand All @@ -1150,6 +1234,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -1163,6 +1248,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuScsiStorage{
Expand All @@ -1174,6 +1260,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -1187,6 +1274,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuVirtIOStorage{
Expand All @@ -1198,6 +1286,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
Expand Down Expand Up @@ -1273,6 +1362,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuIdeStorage{
Expand All @@ -1283,6 +1373,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_2: &proxmox.QemuIdeStorage{
Expand All @@ -1293,6 +1384,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
},
Expand All @@ -1305,6 +1397,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_1: &proxmox.QemuSataStorage{
Expand All @@ -1315,6 +1408,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Format: proxmox.QemuDiskFormat("qcow2"),
Discard: false,
Backup: true,
Replicate: true,
},
},
Disk_2: &proxmox.QemuSataStorage{
Expand All @@ -1336,6 +1430,7 @@ func TestGenerateProxmoxDisks(t *testing.T) {
Discard: false,
IOThread: true,
Backup: true,
Replicate: true,
},
},
},
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; -->
Loading