<storage> done

This commit is contained in:
brent s 2017-03-08 05:04:21 -05:00
parent f7404b0aa3
commit 130d5214e0
3 changed files with 46 additions and 14 deletions

2
TODO
View File

@ -9,6 +9,8 @@ bf566e594a2ad3e488fef7cfa6832d4ba857d8129b0c00fe3a096e9fbb85e92c268368a201f12f22
...

- use sgdisk? scripting (generated by python) for disk partitioning (part types listed at http://www.rodsbooks.com/gdisk/walkthrough.html )
-- actually, might want to use parted --script instead? then we can do percentages. https://www.gnu.org/software/parted/manual/parted.html
https://unix.stackexchange.com/questions/200582/scripteable-gpt-partitions-using-parted
- add mkfs-ing

-support serverside "autoconfig"- a mechanism to let servers automatically generate xml build configs. e.g.:

56
aif.xsd
View File

@ -3,41 +3,71 @@
targetNamespace="https://aif.square-r00t.net"
xmlns="https://aif.square-r00t.net"
elementFormDefault="qualified">
<!-- GLOBAL CUSTOM DATA TYPES -->
<!-- GLOBAL CUSTOM DATA TYPES -->
<xs:simpleType name="diskdev">
<xs:restriction base="xs:string">
<xs:pattern value="^/dev/[A-Za-z_/]+[0-9]+" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="device" type="diskdev" />

<xs:simpleType name="diskfmt">
<xs:restriction base="xs:string">
<xs:pattern value="(gpt|bios)" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="disksize">
<xs:restriction base="xs:string">
<xs:pattern value="^(\+|-)[0-9]+([KMGTP]|%)" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="fstype">
<xs:restriction base="xs:token">
<xs:pattern value="^[a-z0-9]+$" />
</xs:restriction>
</xs:simpleType>
<!-- ROOT -->
<xs:element name="aif">
<xs:complexType>
<xs:all>
<!-- BEGIN STORAGE -->
<xs:element name="storage" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="disk" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute ref="device"/>
<xs:complexContent>
<xs:choice minOccurs="1">
<xs:element name="gpt" type="diskfmt" />
<xs:element name="bios" type="diskfmt" />
</xs:choice>
</xs:complexContent>
<xs:sequence>
<xs:element name="part" minOccurs="1">
<xs:complexType>
<xs:attribute name="num" type="xs:positiveInteger" />
<xs:attribute name="name" type="xs:token" />
<xs:attribute name="size" type="disksize" />
<xs:attribute name="fstype" type="fstype" />
</xs:complexType>
<xs:unique name="unique-partnum">
<xs:selector xpath="part"/>
<xs:field xpath="@num"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="device" type="diskdev" />
<xs:attribute name="diskfmt" type="diskfmt" />
</xs:complexType>
<xs:unique name="unique-diskdev">
<xs:selector xpath="disk"/>
<xs:field xpath="@device"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- END STORAGE -->
<!--

<xs:element ref="mount" maxOccurs="unbounded" minOccurs="1" />
<xs:element ref="network" maxOccurs="unbounded" minOccurs="1" />
<xs:element ref="scripts" maxOccurs="unbounded" minOccurs="0" />
<xs:element ref="scripts" maxOccurs="unbounded" minOccurs="0" />
-->
</xs:all>
</xs:complexType><!--

View File

@ -8,7 +8,7 @@
<xs:element name="storage"><!-- storage media related things. -->
<xs:element name="disk"><!-- a disk device. -->
<xs:element name="type" type="xs:string" /><!-- TODO: custom type. gpt, bios, etc. -->
<xs:element name="name" type="xs:string" /><!-- device, e.g. 'sda' -->
<xs:element name="device" type="xs:string" /><!-- device, e.g. 'sda' -->
<xs:element name="part"><!-- define a partition -->
<xs:element name="num" type="xs:positiveInteger" /><!-- partition number -->
<xs:element name="name" type="xs:string" /><!-- TODO: custom type. the filesystem or partition label. optional. -->