storagevol.rng 5.3 KB
Newer Older
E
Eric Blake 已提交
1
<?xml version="1.0"?>
A
Aron Griffis 已提交
2
<!-- A Relax NG schema for the libvirt storage volume XML format -->
3 4
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
E
Eric Blake 已提交
5
  <include href='basictypes.rng'/>
6 7 8 9
  <start>
    <ref name='vol'/>
  </start>

10
  <include href='storagecommon.rng'/>
11

12 13 14

  <define name='vol'>
    <element name='volume'>
15 16 17 18 19 20 21
      <optional>
        <attribute name='type'>
          <choice>
            <value>file</value>
            <value>block</value>
            <value>dir</value>
            <value>network</value>
22
            <value>netdir</value>
23 24 25
          </choice>
        </attribute>
      </optional>
26 27 28
      <interleave>
        <element name='name'>
          <ref name='volName'/>
29
        </element>
30 31 32 33 34 35 36 37 38 39 40 41 42 43
        <optional>
          <element name='key'>
            <text/>
          </element>
        </optional>
        <optional>
          <ref name='source'/>
        </optional>
        <ref name='sizing'/>
        <ref name='target'/>
        <optional>
          <ref name='backingStore'/>
        </optional>
      </interleave>
44 45 46 47
    </element>
  </define>

  <define name='sizing'>
48 49 50 51 52 53 54 55 56 57 58
    <interleave>
      <optional>
        <element name='capacity'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
      <optional>
        <element name='allocation'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
59 60 61 62 63
      <optional>
        <element name='physical'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
64
    </interleave>
65 66
  </define>

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
  <define name='timestamps'>
    <optional>
      <element name='timestamps'>
        <interleave>
          <optional>
            <element name='atime'>
              <ref name='timestamp'/>
            </element>
          </optional>
          <optional>
            <element name='btime'>
              <ref name='timestamp'/>
            </element>
          </optional>
          <optional>
            <element name='ctime'>
              <ref name='timestamp'/>
            </element>
          </optional>
          <optional>
            <element name='mtime'>
              <ref name='timestamp'/>
            </element>
          </optional>
        </interleave>
      </element>
    </optional>
  </define>

  <define name='timestamp'>
    <data type='string'>
      <param name="pattern">[0-9]+(\.[0-9]{0,9})?</param>
    </data>
  </define>

102 103
  <define name='target'>
    <element name='target'>
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
      <interleave>
        <optional>
          <element name='path'>
            <choice>
              <data type='anyURI'/>
              <ref name='absFilePath'/>
            </choice>
          </element>
        </optional>
        <ref name='format'/>
        <ref name='permissions'/>
        <ref name='timestamps'/>
        <optional>
          <ref name='encryption'/>
        </optional>
        <optional>
          <ref name='compat'/>
        </optional>
C
Chunyan Liu 已提交
122 123 124 125 126
        <optional>
          <element name='nocow'>
            <empty/>
          </element>
        </optional>
127 128 129 130
        <optional>
          <ref name='fileFormatFeatures'/>
        </optional>
      </interleave>
131 132 133 134 135
    </element>
  </define>

  <define name='backingStore'>
    <element name='backingStore'>
136 137 138 139 140 141 142
      <interleave>
        <element name='path'>
          <ref name='absFilePath'/>
        </element>
        <ref name='format'/>
        <ref name='permissions'/>
      </interleave>
143 144 145 146 147 148 149
    </element>
  </define>


  <define name='source'>
    <element name='source'>
      <zeroOrMore>
150
        <ref name='sourcedev'/>
151 152 153 154 155 156 157
      </zeroOrMore>
    </element>
  </define>

  <define name='sourcedev'>
    <element name='device'>
      <attribute name='path'>
E
Eric Blake 已提交
158
        <ref name='absFilePath'/>
159 160
      </attribute>
      <choice>
161 162
        <empty/>
        <ref name='devextents'/>
163 164 165 166 167 168 169
      </choice>
    </element>
  </define>

  <define name='devextents'>
    <oneOrMore>
      <element name='extent'>
170
        <attribute name='start'>
E
Eric Blake 已提交
171
          <ref name='unsignedLong'/>
172 173
        </attribute>
        <attribute name='end'>
E
Eric Blake 已提交
174
          <ref name='unsignedLong'/>
175
        </attribute>
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
      </element>
    </oneOrMore>
  </define>

  <define name='formatdev'>
    <choice>
      <value>none</value>
      <value>auto</value>
      <value>ext2</value>
      <value>ext3</value>
      <value>ext4</value>
      <value>ufs</value>
      <value>iso9660</value>
      <value>udf</value>
      <value>gfs</value>
      <value>gfs2</value>
      <value>vfat</value>
      <value>hfs+</value>
      <value>xfs</value>
195
      <value>ocfs2</value>
196 197 198 199 200
    </choice>
  </define>

  <define name='formatfile'>
    <choice>
201
      <value>unknown</value>
202
      <ref name='storageFormat'/>
203 204 205
    </choice>
  </define>

206 207 208 209 210 211 212 213 214 215 216 217 218
  <define name='formatdisk'>
    <choice>
      <value>none</value>
      <value>linux</value>
      <value>fat16</value>
      <value>fat32</value>
      <value>linux-swap</value>
      <value>linux-lvm</value>
      <value>linux-raid</value>
      <value>extended</value>
    </choice>
  </define>

219 220 221
  <define name='format'>
    <optional>
      <element name='format'>
222 223 224 225
        <attribute name='type'>
          <choice>
            <ref name='formatfile'/>
            <ref name='formatdev'/>
226
            <ref name='formatdisk'/>
227 228
          </choice>
        </attribute>
229 230 231 232 233
      </element>
    </optional>
  </define>

</grammar>