Skip to content

Commit

Permalink
Do not support reserved storage for block-type disks
Browse files Browse the repository at this point in the history
Longhorn 7234

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit authored and David Ko committed Dec 1, 2023
1 parent e33e38d commit 7a0c3ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions webhook/resources/node/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ func (n *nodeValidator) Create(request *admission.Request, newObj runtime.Object
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported since v2 data engine is disabled", name, disk.Type), "")
}
}

if disk.Type == longhorn.DiskTypeBlock {
if disk.StorageReserved != 0 {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to reserve storage", name, disk.Type), "")
}
}
}

return nil
Expand Down Expand Up @@ -148,6 +154,11 @@ func (n *nodeValidator) Update(request *admission.Request, oldObj runtime.Object
newNode.Name, name, disk.Path), "")
}
}
if disk.Type == longhorn.DiskTypeBlock {
if disk.StorageReserved != 0 {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to reserve storage", name, disk.Type), "")
}
}
}

// Validate delete disks
Expand Down

0 comments on commit 7a0c3ed

Please sign in to comment.