From 849754c16e6be3b3a4d0a0b00a76cabde85baa1c Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Fri, 30 Oct 2020 15:29:16 -0400 Subject: [PATCH] csi: minimal change to make test case pass --- nomad/structs/csi.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nomad/structs/csi.go b/nomad/structs/csi.go index b0c5796cafb..07e5d46a868 100644 --- a/nomad/structs/csi.go +++ b/nomad/structs/csi.go @@ -314,6 +314,9 @@ func (v *CSIVolume) newStructs() { if v.Parameters == nil { v.Parameters = map[string]string{} } + if v.MountOptions == nil { + v.MountOptions = &CSIMountOptions{} + } if v.Secrets == nil { v.Secrets = CSISecrets{} } @@ -416,13 +419,26 @@ func (v *CSIVolume) Copy() *CSIVolume { for k, v := range v.Secrets { out.Secrets[k] = v } + mo := *v.MountOptions + out.MountOptions = &mo for k, v := range v.ReadAllocs { - out.ReadAllocs[k] = v + if v != nil { + a := *v + out.ReadAllocs[k] = &a + } else { + out.ReadAllocs[k] = nil + } } for k, v := range v.WriteAllocs { - out.WriteAllocs[k] = v + if v != nil { + a := *v + out.WriteAllocs[k] = &a + } else { + out.WriteAllocs[k] = nil + } + } for k, v := range v.ReadClaims {