Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions rust/share/device.storage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/device.storage.schema.json",
"title": "Storage device",
"description": "Schema to describe a device both in 'system' and 'proposal'.",
"type": "object",
"additionalProperties": false,
"required": ["sid", "name"],
"properties": {
"sid": { "type": "integer" },
"name": { "type": "string" },
"description": { "type": "string" },
"block": { "$ref": "#/$defs/block" },
"drive": { "$ref": "#/$defs/drive" },
"filesystem": { "$ref": "#/$defs/filesystem" },
"md": { "$ref": "#/$defs/md" },
"multipath": { "$ref": "#/$defs/multipath" },
"partitionTable": { "$ref": "#/$defs/partitionTable" },
"partition": { "$ref": "#/$defs/partition" },
"partitions": {
"type": "array",
"items": { "$ref": "#" }
},
"volumeGroup": { "$ref": "#/$defs/volumeGroup" },
"logicalVolumes": {
"type": "array",
"items": { "$ref": "#" }
}
},
"$defs": {
"block": {
"type": "object",
"additionalProperties": false,
"required": ["start", "size", "shrinking"],
"properties": {
"start": { "type": "integer" },
"size": { "type": "integer" },
"active": { "type": "boolean" },
"encrypted": { "type": "boolean" },
"udevIds": {
"type": "array",
"items": { "type": "string" }
},
"udevPaths": {
"type": "array",
"items": { "type": "string" }
},
"systems": {
"type": "array",
"items": { "type": "string" }
},
"shrinking": {
"anyOf": [
{ "$ref": "#/$defs/shrinkingSupported" },
{ "$ref": "#/$defs/shrinkingUnsupported" }
]
}
}
},
"shrinkingSupported": {
"type": "object",
"additionalProperties": false,
"properties": {
"supported": { "type": "integer" }
}
},
"shrinkingUnsupported": {
"type": "object",
"additionalProperties": false,
"properties": {
"unsupported": {
"type": "array",
"items": { "type": "string" }
}
}
},
"drive": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "enum": ["disk", "raid", "multipath", "dasd"] },
"vendor": { "type": "string" },
"model": { "type": "string" },
"transport": { "type": "string" },
"bus": { "type": "string" },
"busId": { "type": "string" },
"driver": {
"type": "array",
"items": { "type": "string" }
},
"info": { "$ref": "#/$defs/driveInfo" }
}
},
"driveInfo": {
"type": "object",
"additionalProperties": false,
"properties": {
"sdCard": { "type": "boolean" },
"dellBoss": { "type": "boolean" }
}
},
"filesystem": {
"type": "object",
"additionalProperties": false,
"required": ["sid", "type"],
"properties": {
"sid": { "type": "integer" },
"type": { "$ref": "#/$defs/filesystemType" },
"mountPath": { "type": "string" },
"label": { "type": "string" }
}
},
"filesystemType": {
"enum": [
"bcachefs",
"btrfs",
"exfat",
"ext2",
"ext3",
"ext4",
"f2fs",
"jfs",
"nfs",
"nilfs2",
"ntfs",
"reiserfs",
"swap",
"tmpfs",
"vfat",
"xfs"
]
},
"md": {
"type": "object",
"additionalProperties": false,
"required": ["level", "devices"],
"properties": {
"level": { "$ref": "#/$defs/mdRaidLevel" },
"devices": {
"type": "array",
"items": { "type": "integer" }
},
"uuid": { "type": "string" }
}
},
"mdRaidLevel": {
"title": "MD level",
"enum": [
"raid0",
"raid1",
"raid5",
"raid6",
"raid10"
]
},
"multipath": {
"type": "object",
"additionalProperties": false,
"required": ["wireNames"],
"properties": {
"wireNames": {
"type": "array",
"items": { "type": "string" }
}
}
},
"partitionTable": {
"type": "object",
"additionalProperties": false,
"required": ["type", "unusedSlots"],
"properties": {
"type": { "$ref": "#/$defs/ptableType" },
"unusedSlots": {
"type": "array",
"items": {
"type": "array",
"items": { "type": "integer" }
}
}
}
},
"ptableType": {
"enum": ["gpt", "msdos", "dasd"]
},
"partition": {
"type": "object",
"additionalProperties": false,
"required": ["efi"],
"properties": {
"efi": { "type": "boolean" }
}
},
"volumeGroup": {
"type": "object",
"additionalProperties": false,
"required": ["size", "physicalVolumes"],
"properties": {
"size": { "type": "integer" },
"physicalVolumes": {
"type": "array",
"items": { "type": "integer" }
}
}
}
}
}
34 changes: 34 additions & 0 deletions rust/share/proposal.storage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/proposal.storage.schema.json",
"title": "Proposal",
"description": "API description of the storage proposal.",
"type": "object",
"additionalProperties": false,
"properties": {
"devices": {
"description": "Expected layout of the system after the commit phase.",
"type": "array",
"items": { "$ref": "device.storage.schema.json" }
},
"actions": {
"description": "Sorted list of actions to execute during the commit phase.",
"type": "array",
"items": { "$ref": "#/$defs/action" }
}
},
"$defs": {
"action": {
"type": "object",
"additionalProperties": false,
"required": ["device", "text"],
"properties": {
"device": { "type": "integer" },
"text": { "type": "string" },
"subvol": { "type": "boolean" },
"delete": { "type": "boolean" },
"resize": { "type": "boolean" }
}
}
}
}
107 changes: 107 additions & 0 deletions rust/share/system.storage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/system.storage.schema.json",
"title": "System",
"description": "API description of the system",
"type": "object",
"additionalProperties": false,
"properties": {
"devices": {
"description": "All relevant devices on the system",
"type": "array",
"items": { "$ref": "device.storage.schema.json" }
},
"availableDrives": {
"description": "SIDs of the available drives",
"type": "array",
"items": { "type": "integer" }
},
"availableMdRaids": {
"description": "SIDs of the available MD RAIDs",
"type": "array",
"items": { "type": "integer" }
},
"candidateDrives": {
"description": "SIDs of the drives that are candidate for installation",
"type": "array",
"items": { "type": "integer" }
},
"candidateMdRaids": {
"description": "SIDs of the MD RAIDs that are candidate for installation",
"type": "array",
"items": { "type": "integer" }
},
"productMountPoints": {
"description": "Meaningful mount points for the current product",
"type": "array",
"items": { "type": "string" }
},
"encryptionMethods": {
"description": "Possible encryption methods for the current system and product",
"type": "array",
"items": { "type": "string" }
},
"volumeTemplates": {
"description": "Volumes defined by the product as templates",
"type": "array",
"items": { "$ref": "#/$defs/volume" }
},
"issues": {
"type": "array",
"items": { "$ref": "#/$defs/issue" }
}
},
"$defs": {
"volume": {
"type": "object",
"additionalProperties": false,
"required": ["mountPath", "minSize", "autoSize"],
"properties": {
"mountPath": { "type": "string" },
"mountOptions": {
"type": "array",
"items": { "type": "string" }
},
"fsType": { "$ref": "device.storage.schema.json#/$defs/filesystemType" },
"autoSize": { "type": "boolean" },
"minSize": { "type": "integer" },
"maxSize": { "type": "integer" },
"snapshots": { "type": "boolean" },
"transactional": { "type": "boolean" },
"outline": { "$ref": "#/$defs/volumeOutline" }
}
},
"volumeOutline": {
"type": "object",
"additionalProperties": false,
"required": ["required", "supportAutoSize"],
"properties": {
"required": { "type": "boolean" },
"supportAutoSize": { "type": "boolean" },
"fsTypes": {
"type": "array",
"items": { "$ref": "device.storage.schema.json#/$defs/filesystemType" }
},
"adjustByRam": { "type": "boolean" },
"snapshotsConfigurable": { "type": "boolean" },
"snapshotsAffectSizes": { "type": "boolean" },
"sizeRelevantVolumes": {
"type": "array",
"items": { "type": "string" }
}
}
},
"issue": {
"type": "object",
"additionalProperties": false,
"required": ["description"],
"properties": {
"description": { "type": "string" },
"class": { "type": "string" },
"details": { "type": "string" },
"source": { "enum": ["config", "system"] },
"severity": { "enum": ["warn", "error"] }
}
}
}
}
Loading