agama/rust/agama-lib/share/storage.schema.json
2024-11-11 15:27:24 +00:00

851 lines
27 KiB
JSON

{
"$comment": "Based on doc/auto_storage.md",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "Config",
"description": "Storage config.",
"type": "object",
"additionalProperties": false,
"properties": {
"boot": { "$ref": "#/$defs/boot" },
"drives": {
"description": "Drives (disks, BIOS RAIDs and multipath devices).",
"type": "array",
"items": { "$ref": "#/$defs/driveElement" }
},
"volumeGroups": {
"description": "LVM volume groups.",
"type": "array",
"items": { "$ref": "#/$defs/volumeGroup" }
},
"guided": { "$ref": "#/$defs/guided" }
},
"$defs": {
"boot": {
"description": "Allows configuring boot partitions automatically.",
"type": "object",
"additionalProperties": false,
"required": ["configure"],
"properties": {
"configure": {
"description": "Whether to configure partitions for booting.",
"type": "boolean"
},
"device": {
"description": "The target installation device is used by default.",
"type": "string",
"examples": ["/dev/vda"]
}
}
},
"driveElement": {
"anyOf": [
{ "$ref": "#/$defs/formattedDrive" },
{ "$ref": "#/$defs/partitionedDrive" }
]
},
"formattedDrive": {
"description": "Drive without a partition table (e.g., directly formatted).",
"type": "object",
"additionalProperties": false,
"required": ["filesystem"],
"properties": {
"search": { "$ref": "#/$defs/searchElement" },
"alias": { "$ref": "#/$defs/alias" },
"encryption": { "$ref": "#/$defs/encryption" },
"filesystem": { "$ref": "#/$defs/filesystem" }
}
},
"partitionedDrive": {
"type": "object",
"additionalProperties": false,
"properties": {
"search": { "$ref": "#/$defs/searchElement" },
"alias": { "$ref": "#/$defs/alias" },
"ptableType": { "$ref": "#/$defs/ptableType" },
"partitions": {
"type": "array",
"items": { "$ref": "#/$defs/partitionElement" }
}
}
},
"ptableType": {
"description": "Partition table type.",
"$comment": "The partition table is created only if all the current partitions are deleted.",
"enum": ["gpt", "msdos", "dasd"]
},
"partitionElement": {
"anyOf": [
{ "$ref": "#/$defs/simpleVolumesGenerator" },
{ "$ref": "#/$defs/advancedPartitionsGenerator" },
{ "$ref": "#/$defs/regularPartition" },
{ "$ref": "#/$defs/partitionToDelete" },
{ "$ref": "#/$defs/PartitionToDeleteIfNeeded" }
]
},
"simpleVolumesGenerator": {
"description": "Automatically creates the default or mandatory volumes configured by the selected product.",
"type": "object",
"additionalProperties": false,
"required": ["generate"],
"properties": {
"generate": {
"enum": ["default", "mandatory"]
}
}
},
"advancedPartitionsGenerator": {
"description": "Creates the default or mandatory partitions configured by the selected product.",
"type": "object",
"additionalProperties": false,
"required": ["generate"],
"properties": {
"generate": {
"type": "object",
"additionalProperties": false,
"required": ["partitions"],
"properties": {
"partitions": {
"enum": ["default", "mandatory"]
},
"encryption": { "$ref": "#/$defs/encryption" }
}
}
}
},
"regularPartition": {
"type": "object",
"additionalProperties": false,
"properties": {
"search": { "$ref": "#/$defs/searchElement" },
"alias": { "$ref": "#/$defs/alias" },
"id": {
"title": "Partition id",
"enum": [
"linux",
"swap",
"lvm",
"raid",
"esp",
"prep",
"bios_boot"
]
},
"size": { "$ref": "#/$defs/size" },
"encryption": { "$ref": "#/$defs/encryption" },
"filesystem": { "$ref": "#/$defs/filesystem" }
}
},
"partitionToDelete": {
"type": "object",
"additionalProperties": false,
"required": ["delete", "search"],
"properties": {
"search": { "$ref": "#/$defs/searchElement" },
"delete": {
"description": "Delete the partition.",
"const": true
}
}
},
"PartitionToDeleteIfNeeded": {
"type": "object",
"additionalProperties": false,
"required": ["deleteIfNeeded", "search"],
"properties": {
"search": { "$ref": "#/$defs/searchElement" },
"deleteIfNeeded": {
"description": "Delete the partition if needed to make space.",
"const": true
},
"size": { "$ref": "#/$defs/size" }
}
},
"volumeGroup": {
"description": "LVM volume group.",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "Volume group name.",
"type": "string",
"examples": ["vg0"]
},
"extentSize": { "$ref": "#/$defs/sizeValue" },
"physicalVolumes": {
"description": "Devices to use as physical volumes.",
"type": "array",
"items": { "$ref": "#/$defs/physicalVolumeElement" }
},
"logicalVolumes": {
"type": "array",
"items": { "$ref": "#/$defs/logicalVolumeElement" }
}
}
},
"physicalVolumeElement": {
"anyOf": [
{ "$ref": "#/$defs/alias" },
{ "$ref": "#/$defs/simplePhysicalVolumesGenerator" },
{ "$ref": "#/$defs/advancedPhysicalVolumesGenerator" }
]
},
"simplePhysicalVolumesGenerator": {
"description": "Automatically creates the needed physical volumes in the indicated devices.",
"type": "object",
"additionalProperties": false,
"required": ["generate"],
"properties": {
"generate": {
"type": "array",
"items": { "$ref": "#/$defs/alias" }
}
}
},
"advancedPhysicalVolumesGenerator": {
"description": "Automatically creates the needed physical volumes in the indicated devices.",
"type": "object",
"additionalProperties": false,
"required": ["generate"],
"properties": {
"generate": {
"type": "object",
"additionalProperties": false,
"required": ["targetDevices"],
"properties": {
"targetDevices": {
"type": "array",
"items": { "$ref": "#/$defs/alias" }
},
"encryption": { "$ref": "#/$defs/encryption" }
}
}
}
},
"logicalVolumeElement": {
"anyOf": [
{ "$ref": "#/$defs/simpleVolumesGenerator" },
{ "$ref": "#/$defs/advancedLogicalVolumesGenerator" },
{ "$ref": "#/$defs/logicalVolume" },
{ "$ref": "#/$defs/thinPoolLogicalVolume" },
{ "$ref": "#/$defs/thinLogicalVolume" }
]
},
"advancedLogicalVolumesGenerator": {
"description": "Automatically creates the default or mandatory logical volumes configured by the selected product.",
"type": "object",
"additionalProperties": false,
"required": ["generate"],
"properties": {
"generate": {
"type": "object",
"additionalProperties": false,
"required": ["logicalVolumes"],
"properties": {
"logicalVolumes": {
"enum": ["default", "mandatory"]
},
"encryption": { "$ref": "#/$defs/encryption" },
"stripes": { "$ref": "#/$defs/logicalVolumeStripes" },
"stripeSize": { "$ref": "#/$defs/sizeValue" }
}
}
}
},
"logicalVolume": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "Logical volume name.",
"type": "string",
"examples": ["lv0"]
},
"size": { "$ref": "#/$defs/size" },
"stripes": { "$ref": "#/$defs/logicalVolumeStripes" },
"stripeSize": { "$ref": "#/$defs/sizeValue" },
"encryption": { "$ref": "#/$defs/encryption" },
"filesystem": { "$ref": "#/$defs/filesystem" }
}
},
"thinPoolLogicalVolume": {
"type": "object",
"additionalProperties": false,
"required": ["pool"],
"properties": {
"pool": {
"description": "LVM thin pool.",
"const": true
},
"alias": { "$ref": "#/$defs/alias" },
"name": {
"description": "Logical volume name.",
"type": "string",
"examples": ["lv0"]
},
"size": { "$ref": "#/$defs/size" },
"stripes": { "$ref": "#/$defs/logicalVolumeStripes" },
"stripeSize": { "$ref": "#/$defs/sizeValue" },
"encryption": { "$ref": "#/$defs/encryption" }
}
},
"thinLogicalVolume": {
"type": "object",
"additionalProperties": false,
"required": ["usedPool"],
"properties": {
"name": {
"description": "Thin logical volume name.",
"type": "string",
"examples": ["lv0"]
},
"size": { "$ref": "#/$defs/size" },
"usedPool": { "$ref": "#/$defs/alias" },
"encryption": { "$ref": "#/$defs/encryption" },
"filesystem": { "$ref": "#/$defs/filesystem" }
}
},
"logicalVolumeStripes": {
"description": "Number of stripes.",
"type": "integer",
"minimum": 1,
"maximum": 128
},
"searchElement": {
"anyOf": [
{ "$ref": "#/$defs/simpleSearchAll" },
{ "$ref": "#/$defs/simpleSearchByName" },
{ "$ref": "#/$defs/advancedSearch" }
]
},
"simpleSearchAll": {
"description": "Shortcut to match all devices if there is any (equivalent to specify no conditions and to skip the entry if no device is found).",
"const": "*"
},
"simpleSearchByName": {
"descrition": "Search by device name",
"type": "string",
"examples": ["/dev/vda", "/dev/disk/by-id/ata-WDC_WD3200AAKS-75L9"]
},
"advancedSearch": {
"description": "Advanced options for searching devices.",
"type": "object",
"additionalProperties": false,
"properties": {
"condition": {
"title": "Search condition",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": { "$ref": "#/$defs/simpleSearchByName" }
}
},
"max": {
"description": "Maximum devices to match.",
"type": "integer",
"minimum": 1
},
"ifNotFound": {
"title": "Search action",
"description": "How to handle the section if the device is not found.",
"enum": ["skip", "error"],
"default": "error"
}
}
},
"alias": {
"description": "Alias used to reference a device.",
"type": "string"
},
"size": {
"title": "Size",
"anyOf": [
{ "$ref": "#/$defs/sizeValue" },
{
"title": "Size tuple",
"description": "Lower size limit and optionally upper size limit.",
"type": "array",
"items": { "$ref": "#/$defs/sizeValueWithCurrent" },
"minItems": 1,
"maxItems": 2,
"examples": [
[1024, "current"],
["1 GiB", "5 GiB"],
[1024, "2 GiB"],
["2 GiB"]
]
},
{
"title": "Size range",
"description": "Size range.",
"type": "object",
"additionalProperties": false,
"required": ["min"],
"properties": {
"min": { "$ref": "#/$defs/sizeValueWithCurrent" },
"max": { "$ref": "#/$defs/sizeValueWithCurrent" }
}
}
]
},
"sizeValue": {
"anyOf": [
{ "$ref": "#/$defs/sizeString" },
{ "$ref": "#/$defs/sizeBytes" }
]
},
"sizeValueWithCurrent": {
"anyOf": [
{ "$ref": "#/$defs/sizeValue" },
{
"title": "Size current",
"description": "The current size of the device.",
"const": "current"
}
]
},
"sizeString": {
"description": "Human readable size.",
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?(\\s*([KkMmGgTtPpEeZzYy][iI]?)?[Bb])?$",
"examples": ["2 GiB", "1.5 TB", "1TIB", "1073741824 b", "1073741824"]
},
"sizeBytes": {
"description": "Size in bytes.",
"type": "integer",
"minimum": 0,
"examples": [1024, 2048]
},
"encryption": {
"anyOf": [
{ "$ref": "#/$defs/encryptionLuks1" },
{ "$ref": "#/$defs/encryptionLuks2" },
{ "$ref": "#/$defs/encryptionPervasiveLuks2" },
{ "$ref": "#/$defs/encryptionTPM" },
{ "$ref": "#/$defs/encryptionSwap" }
]
},
"encryptionLuks1": {
"description": "LUKS1 encryption.",
"type": "object",
"additionalProperties": false,
"required": ["luks1"],
"properties": {
"luks1": {
"type": "object",
"additionalProperties": false,
"required": ["password"],
"properties": {
"password": { "$ref": "#/$defs/encryptionPassword" },
"cipher": { "$ref": "#/$defs/encryptionCipher" },
"keySize": { "$ref": "#/$defs/encryptionKeySize" }
}
}
}
},
"encryptionLuks2": {
"description": "LUKS2 encryption.",
"type": "object",
"additionalProperties": false,
"required": ["luks2"],
"properties": {
"luks2": {
"type": "object",
"additionalProperties": false,
"required": ["password"],
"properties": {
"password": { "$ref": "#/$defs/encryptionPassword" },
"cipher": { "$ref": "#/$defs/encryptionCipher" },
"keySize": { "$ref": "#/$defs/encryptionKeySize" },
"pbkdFunction": { "$ref": "#/$defs/encryptionPbkdFunction" },
"label": {
"description": "LUKS2 label.",
"type": "string"
}
}
}
}
},
"encryptionPervasiveLuks2": {
"description": "LUKS2 pervasive encryption.",
"type": "object",
"additionalProperties": false,
"required": ["pervasiveLuks2"],
"properties": {
"pervasiveLuks2": {
"type": "object",
"additionalProperties": false,
"required": ["password"],
"properties": {
"password": { "$ref": "#/$defs/encryptionPassword" }
}
}
}
},
"encryptionTPM": {
"description": "TPM-Based Full Disk Encrytion.",
"type": "object",
"additionalProperties": false,
"required": ["tpmFde"],
"properties": {
"tpmFde": {
"type": "object",
"additionalProperties": false,
"required": ["password"],
"properties": {
"password": { "$ref": "#/$defs/encryptionPassword" }
}
}
}
},
"encryptionSwap": {
"description": "Swap encryptions.",
"enum": ["protected_swap", "secure_swap", "random_swap"]
},
"encryptionPassword": {
"description": "Password to use when creating a new encryption device.",
"type": "string"
},
"encryptionCipher": {
"description": "The value must be compatible with the --cipher argument of the command cryptsetup.",
"type": "string"
},
"encryptionKeySize": {
"description": "The value (in bits) has to be a multiple of 8. The possible key sizes are limited by the used cipher.",
"type": "integer"
},
"encryptionPbkdFunction": {
"enum": ["pbkdf2", "argon2i", "argon2id"]
},
"filesystem": {
"type": "object",
"additionalProperties": false,
"properties": {
"reuseIfPossible": {
"description": "Try to reuse the existing file system. In some cases the file system could not be reused, for example, if the device is re-encrypted.",
"type": "boolean",
"default": false
},
"type": { "$ref": "#/$defs/filesystemType" },
"label": {
"description": "File system label.",
"type": "string"
},
"path": {
"description": "Mount path.",
"type": "string",
"examples": ["/var/log"]
},
"mountBy": {
"title": "Mount by",
"description": "How to mount the device.",
"enum": ["device", "id", "label", "path", "uuid"]
},
"mkfsOptions": {
"description": "Options for creating the file system.",
"type": "array",
"items": {
"type": "string"
}
},
"mountOptions": {
"description": "Options to add to the fourth field of fstab.",
"type": "array",
"items": { "type": "string" }
}
}
},
"filesystemType": {
"anyOf": [
{ "$ref": "#/$defs/filesystemTypeAny" },
{ "$ref": "#/$defs/filesystemTypeBtrfs" }
]
},
"filesystemTypeAny": {
"enum": [
"bcachefs",
"btrfs",
"exfat",
"ext2",
"ext3",
"ext4",
"f2fs",
"jfs",
"nfs",
"nilfs2",
"ntfs",
"reiserfs",
"swap",
"tmpfs",
"vfat",
"xfs"
]
},
"filesystemTypeBtrfs": {
"description": "Btrfs file system.",
"type": "object",
"additionalProperties": false,
"required": ["btrfs"],
"properties": {
"btrfs": {
"type": "object",
"additionalProperties": false,
"properties": {
"snapshots": {
"description": "Whether to configrue Btrfs snapshots.",
"type": "boolean"
}
}
}
}
},
"guided": {
"title": "Guided settings",
"$comment": "This guided section will be extracted to a separate schema. Only storage and legacyAutoyastStorage will be offered as valid schemas for the storage config.",
"type": "object",
"additionalProperties": false,
"properties": {
"target": {
"anyOf": [
{
"title": "Target for installing",
"description": "Indicates whether to install in a disk or a new LVM.",
"enum": ["disk", "newLvmVg"]
},
{
"title": "Target disk",
"description": "Indicates to install in a specific disk device.",
"type": "object",
"additionalProperties": false,
"required": ["disk"],
"properties": {
"disk": {
"title": "Device name",
"type": "string",
"examples": ["/dev/vda"]
}
}
},
{
"title": "New LVM",
"description": "Indicates to install in a new LVM created over some specific devices.",
"type": "object",
"additionalProperties": false,
"required": ["newLvmVg"],
"properties": {
"newLvmVg": {
"description": "List of devices in which to create the physical volumes.",
"type": "array",
"items": {
"title": "Device name",
"type": "string",
"examples": ["/dev/vda"]
}
}
}
}
]
},
"boot": {
"$ref": "#/$defs/boot"
},
"encryption": {
"title": "Encryption",
"description": "Indicates the options for encrypting the new partitions.",
"type": "object",
"additionalProperties": false,
"required": ["password"],
"properties": {
"password": {
"$ref": "#/$defs/encryptionPassword"
},
"method": {
"title": "Encryption method",
"description": "Method used to encrypt the devices.",
"enum": ["luks2", "tpm_fde"]
},
"pbkdFunction": {
"$ref": "#/$defs/encryptionPbkdFunction"
}
}
},
"space": {
"title": "Space policy",
"description": "Indicates how to find space for the new partitions.",
"type": "object",
"additionalProperties": false,
"properties": {
"policy": {
"enum": ["delete", "resize", "keep", "custom"]
},
"actions": {
"type": "array"
}
},
"if": {
"properties": {
"policy": { "const": "custom" }
}
},
"then": {
"required": ["policy", "actions"],
"properties": {
"actions": {
"title": "Custom actions",
"description": "Indicates what to do with specific devices.",
"type": "array",
"items": {
"anyOf": [
{
"title": "Force delete",
"description": "Indicates to delete a specific device.",
"type": "object",
"required": ["forceDelete"],
"additionalProperties": false,
"properties": {
"forceDelete": {
"description": "Name of the device to delete.",
"type": "string",
"examples": ["/dev/vda"]
}
}
},
{
"title": "Allow shinking",
"description": "Indicates whether a specific device can be shrunk if needed.",
"type": "object",
"required": ["resize"],
"additionalProperties": false,
"properties": {
"resize": {
"description": "Name of the shrinkable device.",
"type": "string",
"examples": ["/dev/vda"]
}
}
}
]
}
}
}
},
"else": {
"required": ["policy"],
"properties": {
"actions": {
"type": "array",
"maxItems": 0
}
}
}
},
"volumes": {
"title": "System volumes",
"description": "List of volumes (file systems) to create.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["mount"],
"properties": {
"mount": {
"title": "Mount properties",
"type": "object",
"additionalProperties": false,
"required": ["path"],
"properties": {
"path": {
"title": "Mount path",
"type": "string",
"examples": ["/dev/vda"]
},
"options": {
"title": "Mount options",
"description": "Options to add to the fourth field of fstab.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"filesystem": {
"$ref": "#/$defs/filesystemType"
},
"size": {
"$ref": "#/$defs/size"
},
"target": {
"title": "Volume target",
"description": "Options to indicate the location of a volume.",
"anyOf": [
{
"title": "Default target",
"description": "The volume is created in the target device for installing.",
"const": "default"
},
{
"title": "New partition",
"description": "The volume is created over a new partition in a specific disk.",
"type": "object",
"required": ["newPartition"],
"additionalProperties": false,
"properties": {
"newPartition": {
"description": "Name of a disk device.",
"type": "string",
"examples": ["/dev/vda"]
}
}
},
{
"title": "Dedicated LVM volume group",
"description": "The volume is created over a new dedicated LVM.",
"type": "object",
"additionalProperties": false,
"required": ["newVg"],
"properties": {
"newVg": {
"description": "Name of a disk device.",
"type": "string",
"examples": ["/dev/vda"]
}
}
},
{
"title": "Re-used existing device",
"description": "The volume is created over an existing device.",
"type": "object",
"additionalProperties": false,
"required": ["device"],
"properties": {
"device": {
"description": "Name of a device.",
"type": "string",
"examples": ["/dev/vda1"]
}
}
},
{
"title": "Re-used existing file system",
"description": "An existing file system is reused (without formatting).",
"type": "object",
"additionalProperties": false,
"required": ["filesystem"],
"properties": {
"filesystem": {
"description": "Name of a device containing the file system.",
"type": "string",
"examples": ["/dev/vda1"]
}
}
}
]
}
}
}
}
}
}
}
}