From 4a72af1d8e12c23f6ffdeaf19fb4b871d91778b2 Mon Sep 17 00:00:00 2001 From: David Edler Date: Mon, 21 Oct 2024 14:11:10 +0200 Subject: [PATCH] fix(instance) remove read and write limits for custom storage volumes 1. the limits are not applied to all possible storage drivers 2. a unit selector is missing in the ui for the limits, we wrongly advertise the number input as iops, but that is not correct, the default seems to be bytes/s when no unit is specified. Removing the limit support from the ui for now to resolve both issues as the feature seems not very important in the first place. Signed-off-by: David Edler --- src/components/forms/DiskDeviceFormCustom.tsx | 82 ------------------- .../forms/DiskDeviceFormInherited.tsx | 22 ----- src/util/formDevices.tsx | 13 --- 3 files changed, 117 deletions(-) diff --git a/src/components/forms/DiskDeviceFormCustom.tsx b/src/components/forms/DiskDeviceFormCustom.tsx index 180b08ecb9..1f1050d151 100644 --- a/src/components/forms/DiskDeviceFormCustom.tsx +++ b/src/components/forms/DiskDeviceFormCustom.tsx @@ -191,88 +191,6 @@ const DiskDeviceFormCustom: FC = ({ formik, project, profiles }) => { }), ); } - - rows.push( - getConfigurationRowBase({ - className: "no-border-top inherited-with-form", - configuration: ( - - ), - inherited: readOnly ? ( -
-
- - {formVolume.limits?.read - ? `${formVolume.limits.read} IOPS` - : "none"} - -
- {editButton(`devices.${index}.limits.read`)} -
- ) : ( -
- { - void formik.setFieldValue( - `devices.${index}.limits.read`, - e.target.value, - ); - }} - value={formVolume.limits?.read} - type="number" - placeholder="Enter number" - className="u-no-margin--bottom" - /> -
IOPS
-
- ), - override: "", - }), - ); - - rows.push( - getConfigurationRowBase({ - className: "no-border-top inherited-with-form", - configuration: ( - - ), - inherited: readOnly ? ( -
-
- - {formVolume.limits?.write - ? `${formVolume.limits.write} IOPS` - : "none"} - -
- {editButton(`devices.${index}.limits.write`)} -
- ) : ( -
- { - void formik.setFieldValue( - `devices.${index}.limits.write`, - e.target.value, - ); - }} - value={formVolume.limits?.write} - type="number" - placeholder="Enter number" - className="u-no-margin--bottom" - /> -
IOPS
-
- ), - override: "", - }), - ); }); return ( diff --git a/src/components/forms/DiskDeviceFormInherited.tsx b/src/components/forms/DiskDeviceFormInherited.tsx index 821a791bcb..5ed0c53200 100644 --- a/src/components/forms/DiskDeviceFormInherited.tsx +++ b/src/components/forms/DiskDeviceFormInherited.tsx @@ -92,28 +92,6 @@ const DiskDeviceFormInherited: FC = ({ formik, inheritedVolumes }) => { isDeactivated: isNoneDevice, }), ); - - rows.push( - getInheritedDeviceRow({ - label: "Read limit", - inheritValue: item.disk["limits.read"] - ? `${item.disk["limits.read"]} IOPS` - : "none", - readOnly: readOnly, - isDeactivated: isNoneDevice, - }), - ); - - rows.push( - getInheritedDeviceRow({ - label: "Write limit", - inheritValue: item.disk["limits.write"] - ? `${item.disk["limits.write"]} IOPS` - : "none", - readOnly: readOnly, - isDeactivated: isNoneDevice, - }), - ); }); return inheritedVolumes.length > 0 ? ( diff --git a/src/util/formDevices.tsx b/src/util/formDevices.tsx index ef9510b37b..66f412340c 100644 --- a/src/util/formDevices.tsx +++ b/src/util/formDevices.tsx @@ -85,15 +85,6 @@ export const formDeviceToPayload = (devices: FormDevice[]) => { [name]: item.bare, }; } - if ("limits" in item) { - if (item.limits?.read) { - item["limits.read"] = item.limits.read; - } - if (item.limits?.write) { - item["limits.write"] = item.limits.write; - } - delete item.limits; - } if (item.type === "disk") { const { bare, ...rest } = item; item = { ...bare, ...rest }; @@ -148,10 +139,6 @@ export const parseDevices = (devices: LxdDevices): FormDevice[] => { pool: item.pool, source: "source" in item ? item.source : undefined, size: "size" in item ? item.size : undefined, - limits: { - read: "limits.read" in item ? item["limits.read"] : undefined, - write: "limits.write" in item ? item["limits.write"] : undefined, - }, type: "disk", bare: item, };