Skip to content

Commit

Permalink
fix(instance) remove read and write limits for custom storage volumes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
edlerd committed Oct 21, 2024
1 parent 4e7a35c commit 4a72af1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 117 deletions.
82 changes: 0 additions & 82 deletions src/components/forms/DiskDeviceFormCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,88 +191,6 @@ const DiskDeviceFormCustom: FC<Props> = ({ formik, project, profiles }) => {
}),
);
}

rows.push(
getConfigurationRowBase({
className: "no-border-top inherited-with-form",
configuration: (
<Label forId={`devices.${index}.limits.read`}>Read limit</Label>
),
inherited: readOnly ? (
<div className="custom-disk-read-mode">
<div className="mono-font custom-disk-value">
<b>
{formVolume.limits?.read
? `${formVolume.limits.read} IOPS`
: "none"}
</b>
</div>
{editButton(`devices.${index}.limits.read`)}
</div>
) : (
<div className="custom-disk-device-limits">
<Input
id={`devices.${index}.limits.read`}
name={`devices.${index}.limits.read`}
onBlur={formik.handleBlur}
onChange={(e) => {
void formik.setFieldValue(
`devices.${index}.limits.read`,
e.target.value,
);
}}
value={formVolume.limits?.read}
type="number"
placeholder="Enter number"
className="u-no-margin--bottom"
/>
<div>IOPS</div>
</div>
),
override: "",
}),
);

rows.push(
getConfigurationRowBase({
className: "no-border-top inherited-with-form",
configuration: (
<Label forId={`devices.${index}.limits.write`}>Write limit</Label>
),
inherited: readOnly ? (
<div className="custom-disk-read-mode">
<div className="mono-font custom-disk-value">
<b>
{formVolume.limits?.write
? `${formVolume.limits.write} IOPS`
: "none"}
</b>
</div>
{editButton(`devices.${index}.limits.write`)}
</div>
) : (
<div className="custom-disk-device-limits">
<Input
id={`devices.${index}.limits.write`}
name={`devices.${index}.limits.write`}
onBlur={formik.handleBlur}
onChange={(e) => {
void formik.setFieldValue(
`devices.${index}.limits.write`,
e.target.value,
);
}}
value={formVolume.limits?.write}
type="number"
placeholder="Enter number"
className="u-no-margin--bottom"
/>
<div>IOPS</div>
</div>
),
override: "",
}),
);
});

return (
Expand Down
22 changes: 0 additions & 22 deletions src/components/forms/DiskDeviceFormInherited.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@ const DiskDeviceFormInherited: FC<Props> = ({ 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 ? (
Expand Down
13 changes: 0 additions & 13 deletions src/util/formDevices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 4a72af1

Please sign in to comment.