storagevol.rng 5.7 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 59
    <interleave>
      <optional>
        <element name='capacity'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
      <optional>
        <element name='allocation'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
    </interleave>
60 61 62 63 64
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
        <interleave>
          <element name='mode'>
            <ref name='octalMode'/>
          </element>
          <element name='owner'>
            <ref name='unsignedInt'/>
          </element>
          <element name='group'>
            <ref name='unsignedInt'/>
          </element>
          <optional>
            <element name='label'>
              <text/>
            </element>
          </optional>
        </interleave>
81 82 83 84
      </element>
    </optional>
  </define>

85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
  <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>

120 121
  <define name='target'>
    <element name='target'>
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
      <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 已提交
140 141 142 143 144
        <optional>
          <element name='nocow'>
            <empty/>
          </element>
        </optional>
145 146 147 148
        <optional>
          <ref name='fileFormatFeatures'/>
        </optional>
      </interleave>
149 150 151 152 153
    </element>
  </define>

  <define name='backingStore'>
    <element name='backingStore'>
154 155 156 157 158 159 160
      <interleave>
        <element name='path'>
          <ref name='absFilePath'/>
        </element>
        <ref name='format'/>
        <ref name='permissions'/>
      </interleave>
161 162 163 164 165 166 167
    </element>
  </define>


  <define name='source'>
    <element name='source'>
      <zeroOrMore>
168
        <ref name='sourcedev'/>
169 170 171 172 173 174 175
      </zeroOrMore>
    </element>
  </define>

  <define name='sourcedev'>
    <element name='device'>
      <attribute name='path'>
E
Eric Blake 已提交
176
        <ref name='absFilePath'/>
177 178
      </attribute>
      <choice>
179 180
        <empty/>
        <ref name='devextents'/>
181 182 183 184 185 186 187
      </choice>
    </element>
  </define>

  <define name='devextents'>
    <oneOrMore>
      <element name='extent'>
188
        <attribute name='start'>
E
Eric Blake 已提交
189
          <ref name='unsignedLong'/>
190 191
        </attribute>
        <attribute name='end'>
E
Eric Blake 已提交
192
          <ref name='unsignedLong'/>
193
        </attribute>
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
      </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>
213
      <value>ocfs2</value>
214 215 216 217 218
    </choice>
  </define>

  <define name='formatfile'>
    <choice>
219
      <value>unknown</value>
220
      <ref name='storageFormat'/>
221 222 223
    </choice>
  </define>

224 225 226 227 228 229 230 231 232 233 234 235 236
  <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>

237 238 239
  <define name='format'>
    <optional>
      <element name='format'>
240 241 242 243
        <attribute name='type'>
          <choice>
            <ref name='formatfile'/>
            <ref name='formatdev'/>
244
            <ref name='formatdisk'/>
245 246
          </choice>
        </attribute>
247 248 249 250 251
      </element>
    </optional>
  </define>

</grammar>