checking in - xsd doesn't seem to properly detect duplicate pv/lv elems

This commit is contained in:
brent s 2019-10-31 22:35:31 -04:00
parent 1ea84cbac0
commit 799ef58667
3 changed files with 94 additions and 108 deletions

135
aif.xsd
View File

@ -324,7 +324,7 @@
maxOccurs="unbounded" maxOccurs="unbounded"
type="aif:t_part_flags"/> type="aif:t_part_flags"/>
</xs:sequence> </xs:sequence>
<xs:attribute name="id" type="aif:t_nonempty" <xs:attribute name="id" type="xs:ID"
use="required"/> use="required"/>
<xs:attribute name="name" type="aif:t_nonempty" <xs:attribute name="name" type="aif:t_nonempty"
use="optional"/> use="optional"/>
@ -361,7 +361,7 @@
<xs:element name="opt" minOccurs="0" maxOccurs="unbounded" <xs:element name="opt" minOccurs="0" maxOccurs="unbounded"
type="aif:t_cmdopts"/> type="aif:t_cmdopts"/>
</xs:sequence> </xs:sequence>
<xs:attribute name="source" type="aif:t_nonempty" use="required"/> <xs:attribute name="source" type="xs:IDREF" use="required"/>
<!-- We validate this in-code because there's way too many and <!-- We validate this in-code because there's way too many and
it's way too variable per-host. --> it's way too variable per-host. -->
<xs:attribute name="type" type="aif:t_nonempty" use="required"/> <xs:attribute name="type" type="aif:t_nonempty" use="required"/>
@ -401,9 +401,9 @@
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
<xs:attribute name="id" type="aif:t_nonempty" use="required"/> <xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="aif:t_nonempty" use="required"/> <xs:attribute name="name" type="aif:t_nonempty" use="required"/>
<xs:attribute name="source" type="aif:t_nonempty" use="required"/> <xs:attribute name="source" type="xs:IDREF" use="required"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
@ -417,94 +417,74 @@
<!-- BEGIN LVM --> <!-- BEGIN LVM -->
<xs:element name="lvm" minOccurs="0" maxOccurs="1"> <xs:element name="lvm" minOccurs="0" maxOccurs="1">
<xs:complexType> <xs:complexType>
<xs:all minOccurs="1" maxOccurs="1"> <xs:sequence>
<xs:element name="physicals" minOccurs="1" maxOccurs="1"> <xs:element name="volumeGroup" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="pv">
<xs:complexType>
<xs:attribute name="id" type="aif:t_nonempty"
use="required"/>
<xs:attribute name="source" type="aif:t_nonempty"
use="required"/>
<xs:attribute name="vg" type="aif:t_nonempty"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_pv_id">
<xs:selector xpath="aif:pv"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:unique name="uniq_pv_src">
<xs:selector xpath="aif:pv"/>
<xs:field xpath="@source"/>
</xs:unique>
</xs:element>
<xs:element name="volumes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="vg">
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element name="tags" minOccurs="0" maxOccurs="1"> <xs:element name="physicalVolumes" minOccurs="1" maxOccurs="1">
<xs:complexType> <xs:complexType>
<xs:sequence minOccurs="1" <xs:sequence>
<xs:element name="pv" minOccurs="1"
maxOccurs="unbounded"> maxOccurs="unbounded">
<xs:element name="tag" <xs:complexType>
minOccurs="1" <xs:attribute name="id" type="xs:ID"
maxOccurs="unbounded" use="required"/>
type="aif:t_nonempty"/> <xs:attribute name="source" type="xs:IDREF"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="logicals" minOccurs="1" <xs:element name="logicalVolumes" minOccurs="1" maxOccurs="1">
maxOccurs="1">
<xs:complexType> <xs:complexType>
<xs:sequence minOccurs="1" <xs:sequence>
maxOccurs="unbounded">
<xs:element name="lv" minOccurs="1" <xs:element name="lv" minOccurs="1"
maxOccurs="unbounded"> maxOccurs="unbounded">
<xs:complexType> <xs:complexType>
<xs:attribute name="id" <xs:attribute name="id" type="xs:ID"
type="aif:t_nonempty"
use="required"/> use="required"/>
<xs:attribute name="name" <xs:attribute name="name" type="aif:t_nonempty"
type="aif:t_nonempty"
use="required"/> use="required"/>
<xs:attribute name="size" <xs:attribute name="size" type="aif:t_disksize"
type="aif:t_disksize"
use="required"/> use="required"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="tags" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="tag" type="aif:t_nonempty"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all> </xs:all>
<xs:attribute name="id" type="aif:t_nonempty" <xs:attribute name="id" type="xs:ID" use="required"/>
use="required"/> <xs:attribute name="name" type="aif:t_nonempty" use="required"/>
<xs:attribute name="name" type="aif:t_nonempty"
use="required"/>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_vg_tag"> <xs:unique name="uniq_vg_tags">
<xs:selector xpath="aif:tags"/> <xs:selector xpath="tags"/>
<xs:field xpath="tag"/> <xs:field xpath="tag"/>
</xs:unique> </xs:unique>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_vg_id"> <xs:unique name="uniq_vg_names">
<xs:selector xpath="aif:vg"/> <xs:selector xpath="volumeGroup"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:unique name="uniq_vg_name">
<xs:selector xpath="aif:vg"/>
<xs:field xpath="@name"/> <xs:field xpath="@name"/>
</xs:unique> </xs:unique>
</xs:element> <!-- ??? doesn't seem to work. -->
</xs:all> <xs:unique name="uniq_vg_lv">
</xs:complexType> <xs:selector xpath="volumeGroup/logicalVolumes/lv"/>
<xs:field xpath="@name"/>
</xs:unique>
<xs:unique name="uniq_vg_pv">
<xs:selector xpath="pv"/>
<xs:field xpath="@source"/>
</xs:unique>
</xs:element> </xs:element>
<!-- END LVM --> <!-- END LVM -->
<!-- BEGIN MDADM --> <!-- BEGIN MDADM -->
@ -516,12 +496,12 @@
<xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="member" minOccurs="1" maxOccurs="unbounded"> <xs:element name="member" minOccurs="1" maxOccurs="unbounded">
<xs:complexType> <xs:complexType>
<xs:attribute name="source" type="aif:t_nonempty" <xs:attribute name="source" type="xs:IDREF"
use="required"/> use="required"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
<xs:attribute name="id" use="required" type="aif:t_nonempty"/> <xs:attribute name="id" use="required" type="xs:ID"/>
<xs:attribute name="name" use="required" type="aif:t_nonempty"/> <xs:attribute name="name" use="required" type="aif:t_nonempty"/>
<xs:attribute name="meta" use="optional" default="1.2" <xs:attribute name="meta" use="optional" default="1.2"
type="aif:t_raid_meta"/> type="aif:t_raid_meta"/>
@ -537,10 +517,6 @@
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_array_id">
<xs:selector xpath="array"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:unique name="uniq_array_name"> <xs:unique name="uniq_array_name">
<xs:selector xpath="array"/> <xs:selector xpath="array"/>
<xs:field xpath="@name"/> <xs:field xpath="@name"/>
@ -557,12 +533,15 @@
<xs:element name="opt" minOccurs="1" maxOccurs="unbounded" <xs:element name="opt" minOccurs="1" maxOccurs="unbounded"
type="aif:t_cmdopts"/> type="aif:t_cmdopts"/>
</xs:sequence> </xs:sequence>
<xs:attribute name="source" type="aif:t_nonempty" use="required"/> <xs:attribute name="source" type="xs:IDREF" use="required"/>
<xs:attribute name="target" type="aif:t_filepath" use="required"/> <xs:attribute name="target" type="aif:t_filepath" use="required"/>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_mnts"> <xs:unique name="uniq_mnts_src">
<xs:selector xpath="aif:mount"/> <xs:selector xpath="aif:mount"/>
<xs:field xpath="@source"/> <xs:field xpath="@source"/>
</xs:unique>
<xs:unique name="uniq_mnts_tgt">
<xs:selector xpath="aif:mount"/>
<xs:field xpath="@target"/> <xs:field xpath="@target"/>
</xs:unique> </xs:unique>
</xs:element> </xs:element>
@ -748,6 +727,10 @@
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_repo">
<xs:selector xpath="aif:repo"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element> </xs:element>
<xs:element name="mirrorList" maxOccurs="1" minOccurs="0"> <xs:element name="mirrorList" maxOccurs="1" minOccurs="0">
<xs:complexType> <xs:complexType>
@ -771,10 +754,6 @@
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_repos">
<xs:selector xpath="aif:repos"/>
<xs:field xpath="repo"/>
</xs:unique>
<xs:unique name="uniq_mirror"> <xs:unique name="uniq_mirror">
<xs:selector xpath="aif:mirrorList"/> <xs:selector xpath="aif:mirrorList"/>
<xs:field xpath="mirror"/> <xs:field xpath="mirror"/>
@ -828,10 +807,6 @@
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:unique name="uniq_script">
<xs:selector xpath="aif:script"/>
<xs:field xpath="@order"/>
</xs:unique>
</xs:element> </xs:element>
<!-- END SCRIPTS --> <!-- END SCRIPTS -->
</xs:all> </xs:all>

5
docs/urls Normal file
View File

@ -0,0 +1,5 @@
libblockdev/python gobject-introspection ("gi") API reference:
https://lazka.github.io/pgi-docs/

example of using above for LVM:
https://github.com/storaged-project/libblockdev/blob/master/tests/lvm_test.py

View File

@ -55,20 +55,26 @@
</luksDev> </luksDev>
</luks> </luks>
<lvm> <lvm>
<physicals> <volumeGroup id="vg1" name="group1">
<!-- "size" refers to the size used of the LV for this VG. -->
<pv id="pv1" source="lvm_member1" vg="vg1"/>
</physicals>
<volumes>
<vg id="vg1" name="group1">
<tags> <tags>
<tag>data</tag> <tag>data</tag>
<tag>misc</tag>
</tags> </tags>
<logicals> <physicalVolumes>
<pv id="pv1" source="lvm_member1"/>
</physicalVolumes>
<logicalVolumes>
<lv id="lv1" name="logical1" size="100%"/> <lv id="lv1" name="logical1" size="100%"/>
</logicals> </logicalVolumes>
</vg> </volumeGroup>
</volumes> <volumeGroup id="vg2" name="group2">
<physicalVolumes>
<pv id="pv2" source="lvm_member1"/>
</physicalVolumes>
<logicalVolumes>
<lv id="lv2" name="logical1" size="100%"/>
</logicalVolumes>
</volumeGroup>
</lvm> </lvm>
<mdadm> <mdadm>
<!-- level can be 0, 1, 4, 5, 6, or 10. RAID 1+0 (which is different from mdadm RAID10) would be done by <!-- level can be 0, 1, 4, 5, 6, or 10. RAID 1+0 (which is different from mdadm RAID10) would be done by