storagepool.rng 9.0 KB
Newer Older
A
Aron Griffis 已提交
1
<!-- A Relax NG schema for the libvirt storage pool XML format -->
2 3 4 5 6 7 8 9 10 11
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name='pool'/>
  </start>


  <define name='pool'>
    <element name='pool'>
      <choice>
12 13 14 15 16 17 18 19
        <ref name='pooldir'/>
        <ref name='poolfs'/>
        <ref name='poolnetfs'/>
        <ref name='poollogical'/>
        <ref name='pooldisk'/>
        <ref name='pooliscsi'/>
        <ref name='poolscsi'/>
        <ref name='poolmpath'/>
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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
      </choice>
    </element>
  </define>

  <define name='pooldir'>
    <attribute name='type'>
      <value>dir</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcedir'/>
    <ref name='target'/>
  </define>

  <define name='poolfs'>
    <attribute name='type'>
      <value>fs</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcefs'/>
    <ref name='target'/>
  </define>

  <define name='poolnetfs'>
    <attribute name='type'>
      <value>netfs</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcenetfs'/>
    <ref name='target'/>
  </define>

  <define name='poollogical'>
    <attribute name='type'>
      <value>logical</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcelogical'/>
    <ref name='target'/>
  </define>

  <define name='pooldisk'>
    <attribute name='type'>
      <value>disk</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcedisk'/>
    <ref name='target'/>
  </define>

  <define name='pooliscsi'>
    <attribute name='type'>
      <value>iscsi</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourceiscsi'/>
    <ref name='target'/>
  </define>

  <define name='poolscsi'>
    <attribute name='type'>
      <value>scsi</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcescsi'/>
    <ref name='target'/>
  </define>

94 95 96 97 98 99 100 101 102 103 104 105
  <define name='poolmpath'>
    <attribute name='type'>
      <value>mpath</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <optional>
      <ref name='sourcempath'/>
    </optional>
    <ref name='target'/>
  </define>

106 107 108 109 110 111
  <define name='commonmetadata'>
    <element name='name'>
      <ref name='name'/>
    </element>
    <optional>
      <element name='uuid'>
112
        <ref name='uuid'/>
113 114 115 116 117 118 119
      </element>
    </optional>
  </define>

  <define name='sizing'>
    <optional>
      <element name='capacity'>
120
        <ref name='uint'/>
121 122 123 124
      </element>
    </optional>
    <optional>
      <element name='allocation'>
125
        <ref name='uint'/>
126 127 128 129
      </element>
    </optional>
    <optional>
      <element name='available'>
130
        <ref name='uint'/>
131 132 133 134 135 136 137
      </element>
    </optional>
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
138 139 140 141 142 143 144 145 146 147 148 149 150 151
        <element name='mode'>
          <ref name='uint'/>
        </element>
        <element name='owner'>
          <ref name='uint'/>
        </element>
        <element name='group'>
          <ref name='uint'/>
        </element>
        <optional>
          <element name='label'>
            <text/>
        </element>
        </optional>
152 153 154 155 156 157 158
      </element>
    </optional>
  </define>

  <define name='target'>
    <element name='target'>
      <optional>
159 160 161
        <element name='path'>
          <ref name='path'/>
        </element>
162 163 164 165 166 167 168 169
      </optional>
      <ref name='permissions'/>
    </element>
  </define>

  <define name='sourceinfohost'>
    <element name='host'>
      <attribute name='name'>
170
        <text/>
171 172 173 174 175 176 177 178
      </attribute>
      <empty/>
    </element>
  </define>

  <define name='sourceinfodev'>
    <element name='device'>
      <attribute name='path'>
179 180 181 182
        <choice>
          <ref name='path'/>
          <ref name='name'/>
        </choice>
183 184
      </attribute>
      <choice>
185 186
        <empty/>
        <ref name='devextents'/>
187 188 189 190
      </choice>
    </element>
  </define>

D
David Allan 已提交
191 192 193
  <define name='initiatorinfoiqn'>
    <element name='iqn'>
      <attribute name='name'>
194
        <text/>
D
David Allan 已提交
195 196 197 198 199
      </attribute>
      <empty/>
    </element>
  </define>

200 201 202
  <define name='devextents'>
    <oneOrMore>
      <element name='freeExtent'>
203 204 205 206 207 208
        <attribute name='start'>
          <ref name='uint'/>
        </attribute>
        <attribute name='end'>
          <ref name='uint'/>
        </attribute>
209 210 211 212 213 214 215
      </element>
    </oneOrMore>
  </define>

  <define name='sourceinfodir'>
    <element name='dir'>
      <attribute name='path'>
216
        <ref name='path'/>
217 218 219 220 221 222 223 224
      </attribute>
      <empty/>
    </element>
  </define>

  <define name='sourceinfoadapter'>
    <element name='adapter'>
      <attribute name='name'>
225
        <text/>
226 227 228 229 230 231 232 233 234 235 236
      </attribute>
      <empty/>
    </element>
  </define>

  <define name='sourceinfoname'>
    <element name='name'>
      <text/>
    </element>
  </define>

237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
  <define name='sourceinfoauth'>
    <element name='auth'>
      <attribute name='type'>
        <choice>
          <value>chap</value>
        </choice>
      </attribute>
      <attribute name='login'>
        <text/>
      </attribute>
      <attribute name='passwd'>
        <text/>
      </attribute>
    </element>
  </define>

253 254 255
  <define name='sourcefmtfs'>
    <optional>
      <element name='format'>
256 257 258 259 260
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>ext2</value>
            <value>ext3</value>
261
            <value>ext4</value>
262 263 264
            <value>ufs</value>
            <value>iso9660</value>
            <value>udf</value>
265
            <value>gfs</value>
266 267 268 269 270 271 272
            <value>gfs2</value>
            <value>vfat</value>
            <value>hfs+</value>
            <value>xfs</value>
            <value>ocfs2</value>
          </choice>
        </attribute>
273 274 275 276 277 278 279 280
      </element>
    </optional>
  </define>


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
281 282 283 284 285 286
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
          </choice>
        </attribute>
287 288 289 290 291 292 293 294
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
295 296 297 298 299 300 301 302 303 304 305 306 307
        <attribute name='type'>
          <choice>
            <value>none</value>
            <value>dos</value>
            <value>dvh</value>
            <value>gpt</value>
            <value>mac</value>
            <value>bsd</value>
            <value>pc98</value>
            <value>sun</value>
            <value>lvm2</value>
          </choice>
        </attribute>
308 309 310 311 312 313 314 315
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
316 317 318 319 320 321
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>lvm2</value>
          </choice>
        </attribute>
322 323 324 325 326 327 328 329
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
330
        <empty/>
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
      </element>
    </optional>
  </define>
  <define name='sourcefs'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtfs'/>
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodir'/>
      <ref name='sourcefmtnetfs'/>
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
351 352 353 354 355 356 357 358
      <oneOrMore>
        <optional>
          <ref name='sourceinfoname'/>
        </optional>
        <optional>
          <ref name='sourceinfodev'/>
        </optional>
      </oneOrMore>
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
      <ref name='sourcefmtlogical'/>
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtdisk'/>
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodev'/>
D
David Allan 已提交
374 375 376
      <optional>
      <ref name='initiatorinfoiqn'/>
      </optional>
377 378 379
      <optional>
        <ref name='sourceinfoauth'/>
      </optional>
380 381 382 383 384
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
385
      <ref name='sourceinfoadapter'/>
386 387 388
    </element>
  </define>

389 390 391 392 393
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424

  <define name='name'>
    <data type='string'>
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
  <define name='uuid'>
    <choice>
      <data type='string'>
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
      <data type='string'>
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
  </define>

  <define name='uint'>
    <data type='string'>
      <param name="pattern">[0-9]+</param>
    </data>
  </define>

  <define name='path'>
    <data type='string'>
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
    </data>
  </define>


</grammar>