Commit 3bcd5b16 authored by mqliang's avatar mqliang

fix PrepareForUpdate bug for PV and PVC

parent a4e16319
...@@ -64,7 +64,7 @@ func (persistentvolumeStrategy) AllowCreateOnUpdate() bool { ...@@ -64,7 +64,7 @@ func (persistentvolumeStrategy) AllowCreateOnUpdate() bool {
// PrepareForUpdate sets the Status fields which is not allowed to be set by an end user updating a PV // PrepareForUpdate sets the Status fields which is not allowed to be set by an end user updating a PV
func (persistentvolumeStrategy) PrepareForUpdate(obj, old runtime.Object) { func (persistentvolumeStrategy) PrepareForUpdate(obj, old runtime.Object) {
newPv := obj.(*api.PersistentVolume) newPv := obj.(*api.PersistentVolume)
oldPv := obj.(*api.PersistentVolume) oldPv := old.(*api.PersistentVolume)
newPv.Status = oldPv.Status newPv.Status = oldPv.Status
} }
...@@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeStatusStrategy{Strategy} ...@@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeStatusStrategy{Strategy}
// PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status // PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status
func (persistentvolumeStatusStrategy) PrepareForUpdate(obj, old runtime.Object) { func (persistentvolumeStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
newPv := obj.(*api.PersistentVolume) newPv := obj.(*api.PersistentVolume)
oldPv := obj.(*api.PersistentVolume) oldPv := old.(*api.PersistentVolume)
newPv.Spec = oldPv.Spec newPv.Spec = oldPv.Spec
} }
......
...@@ -64,7 +64,7 @@ func (persistentvolumeclaimStrategy) AllowCreateOnUpdate() bool { ...@@ -64,7 +64,7 @@ func (persistentvolumeclaimStrategy) AllowCreateOnUpdate() bool {
// PrepareForUpdate sets the Status field which is not allowed to be set by end users on update // PrepareForUpdate sets the Status field which is not allowed to be set by end users on update
func (persistentvolumeclaimStrategy) PrepareForUpdate(obj, old runtime.Object) { func (persistentvolumeclaimStrategy) PrepareForUpdate(obj, old runtime.Object) {
newPvc := obj.(*api.PersistentVolumeClaim) newPvc := obj.(*api.PersistentVolumeClaim)
oldPvc := obj.(*api.PersistentVolumeClaim) oldPvc := old.(*api.PersistentVolumeClaim)
newPvc.Status = oldPvc.Status newPvc.Status = oldPvc.Status
} }
...@@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeclaimStatusStrategy{Strategy} ...@@ -86,7 +86,7 @@ var StatusStrategy = persistentvolumeclaimStatusStrategy{Strategy}
// PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status // PrepareForUpdate sets the Spec field which is not allowed to be changed when updating a PV's Status
func (persistentvolumeclaimStatusStrategy) PrepareForUpdate(obj, old runtime.Object) { func (persistentvolumeclaimStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
newPv := obj.(*api.PersistentVolumeClaim) newPv := obj.(*api.PersistentVolumeClaim)
oldPv := obj.(*api.PersistentVolumeClaim) oldPv := old.(*api.PersistentVolumeClaim)
newPv.Spec = oldPv.Spec newPv.Spec = oldPv.Spec
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment