Skip to content

Commit 83dfe8e

Browse files
committed
roachprod: fix label propagation on workload machines
Previously, label propagation did not take the boot-disk-only parameter of workload machines into account. This change fixes the propagation to skip trying to add labels to non-existent persistent disks if the boot-disk-only flag has been passed to the provider. Epic: None Release note: None
1 parent 5fdc01e commit 83dfe8e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/roachprod/vm/gce/gcloud.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,8 @@ func (p *Provider) Create(
18471847
return nil, err
18481848
}
18491849
}
1850-
return vmList, propagateDiskLabels(l, project, labels, zoneToHostNames, opts.SSDOpts.UseLocalSSD, providerOpts.PDVolumeCount)
1850+
return vmList, propagateDiskLabels(l, project, labels, zoneToHostNames, opts.SSDOpts.UseLocalSSD,
1851+
providerOpts.PDVolumeCount, providerOpts.BootDiskOnly)
18511852
}
18521853

18531854
// computeGrowDistribution computes the distribution of new nodes across the
@@ -2019,7 +2020,7 @@ func (p *Provider) Grow(
20192020
labelsJoined += fmt.Sprintf("%s=%s", key, value)
20202021
}
20212022
err = propagateDiskLabels(l, project, labelsJoined, zoneToHostNames, len(vms[0].LocalDisks) != 0,
2022-
len(vms[0].NonBootAttachedVolumes))
2023+
len(vms[0].NonBootAttachedVolumes), false /* bootDiskOnly: always false here since we probe the VMs. */)
20232024
if err != nil {
20242025
return nil, err
20252026
}
@@ -2511,7 +2512,9 @@ func propagateDiskLabels(
25112512
zoneToHostNames map[string][]string,
25122513
useLocalSSD bool,
25132514
pdVolumeCount int,
2515+
bootDiskOnly bool,
25142516
) error {
2517+
25152518
g := newLimitedErrorGroup()
25162519

25172520
l.Printf("Propagating labels across all disks")
@@ -2539,7 +2542,7 @@ func propagateDiskLabels(
25392542
return nil
25402543
})
25412544

2542-
if !useLocalSSD {
2545+
if !useLocalSSD && !bootDiskOnly {
25432546
// The persistent disks are already created. The disks are suffixed with an offset
25442547
// which starts from 1. A total of "pdVolumeCount" disks are created.
25452548
g.Go(func() error {

0 commit comments

Comments
 (0)