Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cluster.evacuate as instance and profile configuration #1079

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/forms/MigrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import { getConfigurationRow } from "components/ConfigurationRow";
import ScrollableConfigurationTable from "components/forms/ScrollableConfigurationTable";
import { getInstanceKey } from "util/instanceConfigFields";
import { optionRenderer } from "util/formFields";
import { optionAllowDeny } from "util/instanceOptions";
import {
clusterEvacuationOptions,
optionAllowDeny,
} from "util/instanceOptions";
import { CreateInstanceFormValues } from "pages/instances/CreateInstance";

export interface MigrationFormValues {
migration_stateful?: string;
cluster_evacuate?: string;
}

export const migrationPayload = (values: InstanceAndProfileFormValues) => {
return {
[getInstanceKey("migration_stateful")]: values.migration_stateful,
[getInstanceKey("cluster_evacuate")]: values.cluster_evacuate,
};
};

Expand Down Expand Up @@ -49,6 +54,15 @@ const MigrationForm: FC<Props> = ({ formik }) => {
<Select options={optionAllowDeny} disabled={isVmOnlyDisabled} />
),
}),
getConfigurationRow({
formik,
label: "Cluster evacuation",
name: "cluster_evacuate",
defaultValue: "auto",
readOnlyRenderer: (val) =>
optionRenderer(val, clusterEvacuationOptions),
children: <Select options={clusterEvacuationOptions} />,
}),
]}
/>
);
Expand Down
1 change: 1 addition & 0 deletions src/util/instanceConfigFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const instanceConfigFormFieldsToPayload: Record<string, string> = {
snapshots_schedule: "snapshots.schedule",
snapshots_schedule_stopped: "snapshots.schedule.stopped",
migration_stateful: "migration.stateful",
cluster_evacuate: "cluster.evacuate",
boot_autostart: "boot.autostart",
boot_autostart_delay: "boot.autostart.delay",
boot_autostart_priority: "boot.autostart.priority",
Expand Down
1 change: 1 addition & 0 deletions src/util/instanceEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const getEditValues = (
snapshots_schedule_stopped: item.config["snapshots.schedule.stopped"],

migration_stateful: item.config["migration.stateful"],
cluster_evacuate: item.config["cluster.evacuate"],

boot_autostart: item.config["boot.autostart"],
boot_autostart_delay: item.config["boot.autostart.delay"],
Expand Down
24 changes: 24 additions & 0 deletions src/util/instanceOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,27 @@ export const proxyAddressTypeOptions = [
value: "unix",
},
];

export const clusterEvacuationOptions = [
{
label: "Select option",
value: "",
disabled: true,
},
{
label: "auto",
value: "auto",
},
{
label: "live-migrate",
value: "live-migrate",
},
{
label: "migrate",
value: "migrate",
},
{
label: "stop",
value: "stop",
},
];
2 changes: 1 addition & 1 deletion tests/iso-volumes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test("use custom iso for instance launch", async ({ page, lxdVersion }) => {
await page
.getByRole("combobox", { name: "Stateful migration" })
.selectOption("Deny");
await page.getByRole("button", { name: "Create" }).click();
await page.getByRole("button", { name: "Create", exact: true }).click();

await page.waitForSelector(`text=Created instance ${instance}.`);

Expand Down