diff --git a/controller/engine_image_controller.go b/controller/engine_image_controller.go index 30718715ca..90c8bb204e 100644 --- a/controller/engine_image_controller.go +++ b/controller/engine_image_controller.go @@ -515,7 +515,8 @@ func (ic *EngineImageController) canDoOfflineEngineImageUpgrade(v *longhorn.Volu // 3. Volume is not a DR volume AND // 4. Volume is not expanding AND // 5. Volume is not migrating AND -// 6. The current volume's engine image is compatible with the new engine image +// 6. Volume is not strict-local AND +// 7. The current volume's engine image is compatible with the new engine image func (ic *EngineImageController) canDoLiveEngineImageUpgrade(v *longhorn.Volume, newEngineImageResource *longhorn.EngineImage) bool { if v.Status.State != longhorn.VolumeStateAttached { return false @@ -532,6 +533,9 @@ func (ic *EngineImageController) canDoLiveEngineImageUpgrade(v *longhorn.Volume, if util.IsVolumeMigrating(v) { return false } + if v.Spec.DataLocality == longhorn.DataLocalityStrictLocal { + return false + } oldEngineImageResource, err := ic.ds.GetEngineImage(types.GetEngineImageChecksumName(v.Status.CurrentImage)) if err != nil { return false diff --git a/manager/volume.go b/manager/volume.go index fda7d8c971..274f23f867 100644 --- a/manager/volume.go +++ b/manager/volume.go @@ -805,6 +805,10 @@ func (m *VolumeManager) EngineUpgrade(volumeName, image string) (v *longhorn.Vol return nil, fmt.Errorf("cannot do live upgrade for a unhealthy volume %v", v.Name) } + if v.Status.State == longhorn.VolumeStateAttached && v.Spec.DataLocality == longhorn.DataLocalityStrictLocal { + return nil, fmt.Errorf("cannot do live upgrade for an attached strict-local volume %v", v.Name) + } + oldImage := v.Spec.Image v.Spec.Image = image