Преглед на файлове

Add basic plugin for Proxmox Import Provider.

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Nashwan Azhari преди 2 години
родител
ревизия
55c7ffd28e

+ 8 - 0
config.ts

@@ -106,6 +106,12 @@ const conf: Config = {
       requiredFields: ["import_datacenter"],
       relistFields: ["import_cluster", "migr_minion_cluster"],
     },
+    {
+      name: "proxmox",
+      types: ["destination"],
+      requiredFields: ["import_node"],
+      relistFields: ["linux_template", "windows_template"],
+    },
   ],
 
   /*
@@ -128,6 +134,7 @@ const conf: Config = {
     olvm: 3,
     opca: 3,
     o3c: 3,
+    proxmox: 3,
     rhev: 3,
     metal: 4,
     lxd: 4,
@@ -150,6 +157,7 @@ const conf: Config = {
     metal: "Bare Metal",
     rhev: "Red Hat",
     lxd: "LXD",
+    proxmox: "Proxmox VE",
   },
 
   // The list of providers for which to disable setting the 'Execute Now Options' field

+ 2 - 0
server/api/resources/providerLogos/proxmox-128-disabled.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 2 - 0
server/api/resources/providerLogos/proxmox-128.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 2 - 0
server/api/resources/providerLogos/proxmox-32-white.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 2 - 0
server/api/resources/providerLogos/proxmox-32.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 2 - 0
server/api/resources/providerLogos/proxmox-42.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 2 - 0
server/api/resources/providerLogos/proxmox-64.svg

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 192 192" xmlns="http://www.w3.org/2000/svg"><path d="M172.133 50.595s-15.355-11.338-25.145-.284c-9.79 11.054-41.378 45.127-41.378 45.127l41.143 44.813s11.078 8.066 24.519-.277c.806-.5-39.947-44.374-39.947-44.374zm-75.775 54.249 48.75 53.547s-11.607 9.527-22.433-.679c-9.806-9.244-26.179-27.13-26.179-27.13l-25.869 26.781s-10.476 9.503-22.88 1.028c-.658-.45 48.611-53.547 48.611-53.547zm-.111-18.807 48.75-53.547s-11.607-9.527-22.433.679c-9.806 9.244-26.18 27.13-26.18 27.13L70.517 33.517s-10.476-9.503-22.88-1.028c-.658.45 48.611 53.547 48.611 53.547zM20.312 50.64s15.355-11.338 25.145-.284c9.79 11.054 41.378 45.128 41.378 45.128l-41.143 44.812s-11.078 8.066-24.519-.276c-.806-.5 39.947-44.375 39.947-44.375z" style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:57.5;paint-order:stroke markers fill"/></svg>

+ 42 - 0
src/plugins/proxmox/OptionsSchemaPlugin.ts

@@ -0,0 +1,42 @@
+/*
+Copyright (C) 2021  Cloudbase Solutions SRL
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Affero General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+import type { Field } from "@src/@types/Field";
+import type { SchemaProperties, SchemaDefinitions } from "@src/@types/Schema";
+import OptionsSchemaPluginBase from "../default/OptionsSchemaPlugin";
+
+export default class OptionsSchemaParser extends OptionsSchemaPluginBase {
+  override parseSchemaToFields(opts: {
+    schema: SchemaProperties;
+    schemaDefinitions?: SchemaDefinitions | null | undefined;
+    dictionaryKey?: string;
+    requiresWindowsImage?: boolean;
+  }) {
+    return super.parseSchemaToFields(opts);
+  }
+
+  override sortFields(fields: Field[]) {
+    super.sortFields(fields);
+    fields.sort((f1, f2) => {
+      // sort import node field first
+      if (f1.name === "import_node") {
+        return -1;
+      }
+      if (f2.name === "import_node") {
+        return 1;
+      }
+      return 0;
+    });
+  }
+}