Skip to content

Commit 7d2467e

Browse files
committed
Add cloudstack provider
1 parent 06707f4 commit 7d2467e

5 files changed

Lines changed: 57 additions & 1 deletion

File tree

config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ const conf: Config = {
141141
types: ["destination"],
142142
requiredFields: ["cluster"],
143143
},
144+
{
145+
name: "cloudstack",
146+
types: ["destination"],
147+
requiredFields: ["zone"],
148+
relistFields: ["linux_template", "windows_template"],
149+
},
144150
],
145151

146152
/*
@@ -170,6 +176,7 @@ const conf: Config = {
170176
metal: 4,
171177
lxd: 4,
172178
libvirt: 4,
179+
cloudstack: 4,
173180
},
174181

175182
providerNames: {
@@ -193,6 +200,7 @@ const conf: Config = {
193200
lxd: "LXD",
194201
proxmox: "Proxmox VE",
195202
libvirt: "Libvirt",
203+
cloudstack: "Cloudstack",
196204
},
197205

198206
// The list of providers for which to disable setting the 'Execute Now Options' field

src/@types/Providers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export type ProviderTypes =
3232
| "metal"
3333
| "rhev"
3434
| "lxd"
35-
| "libvirt";
35+
| "libvirt"
36+
| "cloudstack";
3637

3738
export type Providers = {
3839
[provider in ProviderTypes]: {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright (C) 2026 Cloudbase Solutions SRL
3+
This program is free software: you can redistribute it and/or modify
4+
it under the terms of the GNU Affero General Public License as
5+
published by the Free Software Foundation, either version 3 of the
6+
License, or (at your option) any later version.
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU Affero General Public License for more details.
11+
You should have received a copy of the GNU Affero General Public License
12+
along with this program. If not, see <http://www.gnu.org/licenses/>.
13+
*/
14+
15+
import type { Field } from "@src/@types/Field";
16+
import type { SchemaProperties, SchemaDefinitions } from "@src/@types/Schema";
17+
import OptionsSchemaPluginBase from "../default/OptionsSchemaPlugin";
18+
19+
export default class OptionsSchemaParser extends OptionsSchemaPluginBase {
20+
override parseSchemaToFields(opts: {
21+
schema: SchemaProperties;
22+
schemaDefinitions?: SchemaDefinitions | null | undefined;
23+
dictionaryKey?: string;
24+
requiresWindowsImage?: boolean;
25+
}) {
26+
return super.parseSchemaToFields(opts);
27+
}
28+
29+
override sortFields(fields: Field[]) {
30+
super.sortFields(fields);
31+
fields.sort((f1, f2) => {
32+
// sort zone field first
33+
if (f1.name === "zone") {
34+
return -1;
35+
}
36+
if (f2.name === "zone") {
37+
return 1;
38+
}
39+
return 0;
40+
});
41+
}
42+
}

src/plugins/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import VHIOptionsSchemaPlugin from "./vhi/OptionsSchemaPlugin";
3939
import OlvmOptionsSchemaPlugin from "./olvm/OptionsSchemaPlugin";
4040
import RhevOptionsSchemaPlugin from "./rhev/OptionsSchemaPlugin";
4141
import AzureOptionsSchemaPlugin from "./azure/OptionsSchemaPlugin";
42+
import CloudstackOptionsSchemaPlugin from "./cloudstack/OptionsSchemaPlugin";
4243

4344
import DefaultInstanceInfoPlugin from "./default/InstanceInfoPlugin";
4445
import OciInstanceInfoPlugin from "./oci/InstanceInfoPlugin";
@@ -63,6 +64,7 @@ export const ConnectionSchemaPlugin = {
6364
kubevirt: new KubevirtConnectionSchemaPlugin(),
6465
harvester: new HarvesterConnectionSchemaPlugin(),
6566
libvirt: new LibvirtConnectionSchemaPlugin(),
67+
cloudstack: new CloudstackOptionsSchemaPlugin(),
6668
};
6769
if (hasKey(map, provider)) {
6870
return map[provider];

tests/mocks/ProvidersMock.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ export const PROVIDERS_MOCK: Providers = {
6262
vhi: {
6363
types: [],
6464
},
65+
cloudstack: {
66+
types: [],
67+
},
6568
};

0 commit comments

Comments
 (0)