2
0
Эх сурвалжийг харах

Define storage mappings schema.

Nashwan Azhari 7 жил өмнө
parent
commit
b12aab8177

+ 4 - 0
coriolis/schemas.py

@@ -27,6 +27,7 @@ _CORIOLIS_VM_NETWORK_SCHEMA_NAME = "vm_network_schema.json"
 _SCHEDULE_API_BODY_SCHEMA_NAME = "replica_schedule_schema.json"
 _CORIOLIS_DESTINATION_OPTIONS_SCHEMA_NAME = "destination_options_schema.json"
 _CORIOLIS_NETWORK_MAP_SCHEMA_NAME = "network_map_schema.json"
+_CORIOLIS_STORAGE_MAPPINGS_SCHEMA_NAME = "storage_mappings_schema.json"
 
 
 def get_schema(package_name, schema_name,
@@ -89,3 +90,6 @@ CORIOLIS_DESTINATION_ENVIRONMENT = get_schema(
 
 CORIOLIS_NETWORK_MAP_SCHEMA = get_schema(
     __name__, _CORIOLIS_NETWORK_MAP_SCHEMA_NAME)
+
+CORIOLIS_STORAGE_MAPPINGS_SCHEMA = get_schema(
+    __name__, _CORIOLIS_STORAGE_MAPPINGS_SCHEMA_NAME)

+ 43 - 0
coriolis/schemas/storage_mappings_schema.json

@@ -0,0 +1,43 @@
+{
+  "$schema": "http://cloudbase.it/coriolis/schemas/storage_mappings#",
+  "description": "Mapping combinations for disk storage backends of migrated/replicated VMs. The order of precendence of mapping is per-disk, per-backend, and finally the default option.",
+  "type": "object",
+  "properties": {
+    "default": {
+      "type": "string"
+    },
+    "backend_mappings": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "properties": {
+          "source": {
+            "type": "string"
+          },
+          "destination": {
+            "type": "string"
+          }
+        },
+        "required": ["source", "destination"],
+        "additionalProperties": false
+      }
+    },
+    "disk_mappings": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "properties": {
+          "disk_id": {
+            "type": "string"
+          },
+          "destination": {
+            "type": "string"
+          }
+        },
+        "required": ["disk_id", "destination"],
+        "additionalProperties": false
+      }
+    }
+  },
+  "additionalProperties": false
+}