{
  "type": "object",
  "$schema": "http://json-schema.org/draft-06/schema",
  "title": "Input Parameters",
  "properties": {
    "enable-device-hotplug": {
      "title": "Enable device hotplug mode",
      "description": "Allows to increase amount of RAM (ram-size) and CPU (cmp-count) without restart of the VM process, up to defined maximums (ram-max-size and cpu-max-count). Operation system have to support online addition of RAM and CPU.",
      "type": "boolean",
      "default": false
    },
    "ram-size": {
      "title": "RAM size",
      "description": "RAM size, in MB.",
      "type": "integer",
      "default": 4096,
      "minimum": 1024,
      "multipleOf": 512
    },
    "ram-max-size": {
      "title": "Maximum RAM size, in MB",
      "description": "Define the maximum size of the memory. The size is in MB and should be a multiple of 512. Defaults to ram-size + 512",
      "type": "integer",
      "default": 4608,
      "minimum": 1024,
      "multipleOf": 512
    },
    "ram-hotplug-slot-size": {
      "title": "Size of Hotpluggable RAM slot, in MB",
      "description": "Define the RAM size to plug on one hotpluggable slot in MB, understand the size of one RAM bar. The RAM hotplugged on each slot will always have the same RAM size.",
      "type": "integer",
      "default": 512,
      "minimum": 512,
      "multipleOf": 512
    },
    "auto-ballooning": {
      "title": "Enable qemu auto ballooning.",
      "description": "Enable virtio balloon device to allows KVM guests to reduce/re-increase their memory size.",
      "type": "boolean",
      "default": true
    },
    "disk-size": {
      "title": "Disk size",
      "description": "Disk size, in GB.",
      "type": "integer",
      "default": 40,
      "minimum": 1
    },
    "disk-type": {
      "title": "Disk type",
      "description": "Type of QEMU disk drive.",
      "type": "string",
      "default": "virtio",
      "enum": [
        "ide",
        "scsi",
        "sd",
        "mtd",
        "floppy",
        "pflash",
        "virtio"
      ]
    },
    "disk-format": {
      "title": "Type of disk drive to create by QEMU.",
      "description": "Type of QEMU disk drive, to create.",
      "type": "string",
      "default": "qcow2",
      "enum": [
        "qcow2",
        "raw",
        "vdi",
        "vmdk",
        "cloop",
        "qed"
      ]
    },
    "disk-cache": {
      "title": "Cache option to use with Disk.",
      "description": "Disk cache controls how the host cache is used to access block data.",
      "type": "string",
      "default": "writeback",
      "enum": [
        "none",
        "writeback",
        "unsafe",
        "directsync",
        "writethrough"
      ]
    },
    "disk-aio": {
      "title": "Disk aio to use.",
      "description": "Selects between pthread based disk I/O and native Linux AIO.",
      "type": "string",
      "default": "threads",
      "enum": [
        "threads",
        "native"
      ]
    },
    "cpu-count": {
      "title": "CPU count",
      "description": "Number of CPU cores.",
      "type": "integer",
      "minimum": 1,
      "default": 2
    },
    "cpu-max-count": {
      "title": "Maximum CPU amount",
      "description": "Specifies the maximum number of CPUs. Defaults to cpu-count + 1",
      "type": "integer",
      "minimum": 1
    },
    "numa": {
      "title": "Simulate a multi node NUMA system.",
      "description": "Simulate a multi node NUMA system. If mem and cpus are omitted, resources are split equally. Each numa option are separated by space: node,nodeid=4,cpus=40-49,mem=64g node,nodeid=1,cpus=10-19,mem=128g. Set this option if you know what you're doing.",
      "type": "string"
    },
    "machine-options": {
      "title": "Machine options.",
      "description": "Select the emulated machine by name. Ex: pc-i440fx-2.4,accel=kvm",
      "type": "string"
    },
    "cpu-model": {
      "title": "CPU model.",
      "description": "Select the emulated CPU model. Ex: SandyBridge,+erms,+smep,+smx,+vmx",
      "type": "string",
      "default": "host"
    },
    "network-adapter": {
      "title": "Network adapter",
      "description": "Network adapter provided to the guest. Allows to support legacy guests, which do not have drivers for default virtio-net-pci.",
      "type": "string",
      "default": "virtio-net-pci",
      "enum": [
        "virtio-net-pci",
        "e1000",
        "ne2k_isa",
        "ne2k_pci",
        "pcnet",
        "rtl8139",
        "usb-net",
        "vmxnet3"
      ]
    },
    "nbd-host": {
      "title": "NBD hostname",
      "description": "hostname (or IP) of the NBD server containing the boot image.",
      "type": "string",
      "format": "internet-address"
    },
    "nbd-port": {
      "title": "NBD port",
      "description": "Port of the NBD server containing the boot image.",
      "type": "integer",
      "default": 1024,
      "minimum": 1,
      "maximum": 65535
    },
    "nbd2-host": {
      "title": "Second NBD hostname",
      "description": "hostname (or IP) of the second NBD server (containing drivers for example).",
      "type": "string",
      "format": "internet-address"
    },
    "nbd2-port": {
      "title": "Second NBD port",
      "description": "Port of the second NBD server containing the boot image.",
      "type": "integer",
      "minimum": 1,
      "maximum": 65535
    },
    "virtual-hard-drive-url": {
      "title": "Existing disk image URL",
      "description": "If specified, will download an existing disk image (qcow2, raw, ...), and will use it as main virtual hard drive. Can be used to download and use an already installed and customized virtual hard drive.",
      "format": "uri",
      "type": "string"
    },
    "virtual-hard-drive-md5sum": {
      "title": "Checksum of virtual hard drive",
      "description": "MD5 checksum of virtual hard drive, required if virtual-hard-drive-url is specified.",
      "type": "string"
    },
    "virtual-hard-drive-gzipped": {
      "title": "Define if virtual hard drive to download is gzipped",
      "description": "Define if virtual hard drive to download is gzipped using gzip. This help to reduce size of file to download.",
      "type": "boolean",
      "default": false
    },
    "wipe-disk-ondestroy": {
      "title": "Wipe disks when destroy the VM",
      "description": "Say if disks should be wiped by writing new data over every single bit before delete them. This option is used to securely delete VM disks",
      "type": "boolean",
      "default": false
    },
    "wipe-disk-iterations": {
      "title": "Wipe disk iterations",
      "description": "Number of disk overwrite iterations with random data. Default is 1. WARNING: Increase this value will slow down partition destruction and increase IO.",
      "type": "integer",
      "default": 1,
      "minimum": 1
    },
    "use-tap": {
      "title": "Use QEMU TAP network interface",
      "description": "Use QEMU TAP network interface, requires taps creation on SlapOS Node.",
      "type": "boolean",
      "default": true
    },
    "use-nat": {
      "title": "Use QEMU USER Mode interface (NAT)",
      "description": "Use QEMU user-mode network stack (NAT).",
      "type": "boolean",
      "default": true
    },
    "nat-rules": {
      "title": "List of rules for NAT of QEMU user mode network stack.",
      "description": "List of rules for NAT of QEMU user mode network stack, as space-separated list of ports (with optional protocol). For each port specified, it will redirect port x of the VM (example: \"80 udp:53\") to the port x + 10000 of the public IPv6 of the host (example: \"10080 udp:10053\").",
      "type": "string",
      "default": "22 80 443"
    },
    "nat-restrict-mode": {
      "title": "Isolate the NAT Interface (No Internet access)",
      "description": "If this option is enabled, the NAT interface will be isolated, i.e. it will not be able to contact the host and no guest IP packets will be routed over the host to the outside. This option does not affect any explicitly set nat rules.",
      "type": "boolean",
      "default": false
    },
    "enable-vhost": {
      "title": "Use vhost-net to improve network performance of tap interface",
      "description": "The vhost-net provides much improved network performance for your VM. Only work if the vhost-net kernel module is loaded and available on host machine, please keep this option off if you're not shure.",
      "type": "boolean",
      "default": false
    },
    "monitor-interface-url": {
      "title": "Monitor Web Interface URL",
      "description": "Give Url of HTML web interface that will be used to render this monitor instance.",
      "type": "string",
      "format": "uri",
      "default": "https://monitor.app.officejs.com"
    },
    "monitor-cors-domains": {
      "title": "Monitor CORS domains",
      "description": "List of cors domains separated with space. Needed for ajax query on this monitor instance from a different domain.",
      "type": "string",
      "default": "monitor.app.officejs.com"
    },
    "enable-http-server": {
      "title": "Enable local http server",
      "description": "Set if local http server which serve files to the vm should be deployed. If set to true, get file into the vm with URL: http://10.0.2.100/FILE.",
      "type": "boolean",
      "default": false
    },
    "httpd-port": {
      "title": "Local http server port",
      "description": "Port of the local http server used to share files.",
      "type": "integer",
      "default": 8081,
      "minimum": 1,
      "maximum": 65535
    },
    "authorized-key": {
      "title": "Public keys to get from all virtual machines.",
      "description": "Set the public keys to add in your virtual machine. The public key file will be available in the VM via url http://10.0.2.100/authorized_keys if you keep the NAT interface enabled",
      "type": "string"
    },
    "bootstrap-script-url": {
      "title": "VM bootstrap script URL.",
      "description": "If dedicaced disk image is used, this script will be downloaded and run at first boot of the virtual machine. Set md5sum to URL like: http://example.com/file#MD5SUM. Get file in vm at http://10.0.2.100/vm-bootstrap.",
      "type": "string",
      "format": "uri"
    },
    "data-to-vm": {
      "title": "Text content to send to this virtual machine.",
      "description": "Text content which will be written in a file 'data' of http server of this virtual machine instance. The file will be available via URL: http://10.0.2.100/data in the VM.",
      "type": "string",
      "textarea": true
    },
    "frontend-instance-guid": {
      "title": "Frontend Instance ID",
      "description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".",
      "type": "string"
    },
    "frontend-software-type": {
      "title": "Frontend Software Type",
      "description": "Type of the frontend instance, like \"frontend\".",
      "type": "string",
      "default": "RootSoftwareInstance"
    },
    "frontend-software-url": {
      "title": "Frontend Software URL",
      "description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
      "type": "string",
      "format": "uri",
      "default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
    },
    "frontend-additional-instance-guid": {
      "title": "Additional Frontend Instance ID",
      "description": "Unique identifier of the additional frontend instance, like \"SOFTINST-11031\", if empty won't be requested.",
      "type": "string"
    },
    "frontend-additional-software-type": {
      "title": "Additional Frontend Software Type",
      "description": "Type of the frontend instance, like \"frontend\".",
      "type": "string",
      "default": "RootSoftwareInstance"
    },
    "frontend-additional-software-url": {
      "title": "Additional Frontend Software URL",
      "description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
      "type": "string",
      "format": "uri",
      "default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
    },
    "boot-image-url-list": {
      "title": "Boot image list",
      "description": "The list shall be list of direct URLs to images, followed by hash (#), then by image MD5SUM. Each image shall appear on newline, like: \"https://example.com/image.iso#06226c7fac5bacfa385872a19bb99684<newline>https://example.com/another-image.iso#31b40d58b18e038498ddb46caea1361c\". They will be provided in KVM image list according to the order on the list. After updating the list, the instance has to be restarted to refresh it. Amount of images is limited to 4, and one image can be maximum 10G. Image will be downloaded and checked against its MD5SUM 4 times, then it will be considered as impossible to download with given MD5SUM. Each image has to be downloaded in time shorter than 4 hours, so in case of very slow images to access, it can take up to 16 hours to download all of them. Note: The instance has to be restarted in order to update the list of available images in the VM. Note: Maximum 3 ISOs are supported.",
      "type": "string",
      "textarea": true
    },
    "boot-image-url-select": {
      "title": "Boot image",
      "type": "array",
      "oneOf": [
        {
          "const": [
            "https://shacache.nxdcdn.com/bc469019b9057073d36ff8f5402c95ff0a0363657358336dc9a05fc6af66276229aa727ec46cf17b84d308f44b825de7f24ea1a256062a14e0f605cd70bae02f#2dcf188877075d7b58ca46e27ca31bb9"
          ],
          "title": "Debian Buster 10.12 netinst x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/ce5ddfdbdaccdf929b7fe321212356347d82a02f6b7733427282b416f113d91e587682b003e9d376ac189c3b731595c50c236962aadf2720c16d9f36913577c0#23bf2a2d60271e553e63525e794415f1"
          ],
          "title": "Centos 8.2004 Minimal x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/8017c532ed74586b718662d8b11cf8c34fa638b0affd0413ed38623989b8f98ffd0bcb475246e279ea2f3c194a3e33c55e0f376a9727de13e4bfd87e75e47b5d#e8d2a77c51b599c10651608a5d8c286f"
          ],
          "title": "Ubuntu Jammy 22.04.1 Live Server x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/302c990c6d69575ff24c96566e5c7e26bf36908abb0cd546e22687c46fb07bf8dba595bf77a9d4fd9ab63e75c0437c133f35462fd41ea77f6f616140cd0e5e6a#f3a306f40e4a313fb5a584d73b3dee8f"
          ],
          "title": "Ubuntu Focal 20.04.1 Live Server x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/6635269a7eb6fbd6b85fda40cd94f14a27bf53cb1fc82ffcce9fe386a025a43e1ab681db7e8cec50416bfbfc90262f0d95273686a101c74b3f17646f0a34c85b#3708a59af6cf820a95cafe0ae73ac399"
          ],
          "title": "openSUSE Leap 15.2 NET x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/fc17e8c6ae0790162f4beb8fa6226d945cff638429588999b3a08493ff27b280dc2939fba825ae04be1d9082ea8d7c3c002c5e4c39fbbcf88b8ab5104619e28a#ebcdb2223a77f098af3923fe1fa180aa"
          ],
          "title": "Arch Linux 2020.09.01 x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/c5a511f349a1146b615e6fab9c24f9be4362046adcf24f0ff82c470d361fac5f6628895e2110ebf8ff87db49d4c413a0a332699da6b1bec64275e0c17a15b999#ca7a1e555c04b4d9a549065fa2ddf713"
          ],
          "title": "Fedora Server 32-1.6 netinst x86_64"
        },
        {
          "const": [
            "https://shacache.nxdcdn.com/6c355def68b3c0427f21598cb054ffc893568902f205601ac60f192854769b31bc9cff8eeb6ce99ef975a8fb887d8d3e56fc6cd5ea5cb4b3bba1175c520047cb#57088b77f795ca44b00971e44782ee23"
          ],
          "title": "FreeBSD 12.1 RELEASE bootonly x86_64"
        }
      ]
    },
    "whitelist-domains": {
      "title": "Whitelist domains",
      "description": "List of whitelisted domain names to be accessed from the VM. They will be resolved to IPs depending on where the VM end up. IPs can be used too.",
      "type": "string",
      "textarea": true
    },
    "external-disk": {
      "title": "External disks",
      "description": "Allows to set paths and types of manually provided external disks. Use index to order disks. Changing this parameter leads to kvm process restart.",
      "type": "object",
      "default": {},
      "patternProperties": {
        ".*": {
          "properties": {
            "path": {
              "title": "Path of the provided image",
              "description": "Absolute or relative path (to the partition root path) of the provided image. Image has to be provided, with read and write permissions of the partition user. Please note, that if the name starts with 'rbd:' it's considered special and won't be used as relative path.",
              "type": "string"
            },
            "format": {
              "title": "Format of a disk image",
              "description": "Format of a disk image. Note: rbd type is experimental.",
              "type": "string",
              "default": "autodetect",
              "enum": [
                "autodetect",
                "qcow2",
                "rbd",
                "raw",
                "vdi",
                "vmdk",
                "cloop",
                "qed"
              ]
            },
            "cache": {
              "title": "Cache value for the disk",
              "description": "Cache value directly passed to the kvm -drive invocation as cache=value.",
              "type": "string",
              "default": "writeback",
              "enum": [
                "writeback",
                "none",
                "unsafe",
                "directsync",
                "writethrough"
              ]
            },
            "index": {
              "title": "Index of a disk",
              "description": "An index value used to order disks for the VM, required if more than one disk is used to have stable ordering.",
              "type": "integer",
              "default": 0
            }
          }
        }
      }
    }
  }
}
