storagepool.rng 10.4 KB
Newer Older
1
<?xml version="1.0"?>
A
Aron Griffis 已提交
2
<!-- A Relax NG schema for the libvirt storage pool XML format -->
3 4 5 6 7 8 9 10 11 12
<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>
13 14 15 16 17 18 19 20
        <ref name='pooldir'/>
        <ref name='poolfs'/>
        <ref name='poolnetfs'/>
        <ref name='poollogical'/>
        <ref name='pooldisk'/>
        <ref name='pooliscsi'/>
        <ref name='poolscsi'/>
        <ref name='poolmpath'/>
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 94
      </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>

95 96 97 98 99 100 101 102 103 104 105 106
  <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>

107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
  <define name='sourceinfovendor'>
    <optional>
      <element name='vendor'>
        <attribute name='name'>
          <text/>
        </attribute>
      </element>
    </optional>
    <optional>
      <element name='product'>
        <attribute name='name'>
          <text/>
        </attribute>
      </element>
    </optional>
  </define>

124 125 126 127 128 129
  <define name='commonmetadata'>
    <element name='name'>
      <ref name='name'/>
    </element>
    <optional>
      <element name='uuid'>
130
        <ref name='uuid'/>
131 132 133 134 135 136 137
      </element>
    </optional>
  </define>

  <define name='sizing'>
    <optional>
      <element name='capacity'>
138
        <ref name='uint'/>
139 140 141 142
      </element>
    </optional>
    <optional>
      <element name='allocation'>
143
        <ref name='uint'/>
144 145 146 147
      </element>
    </optional>
    <optional>
      <element name='available'>
148
        <ref name='uint'/>
149 150 151 152 153 154 155
      </element>
    </optional>
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
156 157 158 159 160 161 162 163 164 165 166 167 168 169
        <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>
170 171 172 173 174 175 176
      </element>
    </optional>
  </define>

  <define name='target'>
    <element name='target'>
      <optional>
177 178 179
        <element name='path'>
          <ref name='path'/>
        </element>
180 181 182 183 184 185 186 187
      </optional>
      <ref name='permissions'/>
    </element>
  </define>

  <define name='sourceinfohost'>
    <element name='host'>
      <attribute name='name'>
188
        <text/>
189
      </attribute>
190 191 192 193 194
      <optional>
        <attribute name='port'>
          <ref name="PortNumber"/>
        </attribute>
      </optional>
195 196 197 198 199 200 201
      <empty/>
    </element>
  </define>

  <define name='sourceinfodev'>
    <element name='device'>
      <attribute name='path'>
202 203 204 205
        <choice>
          <ref name='path'/>
          <ref name='name'/>
        </choice>
206 207
      </attribute>
      <choice>
208 209
        <empty/>
        <ref name='devextents'/>
210 211 212 213
      </choice>
    </element>
  </define>

D
David Allan 已提交
214 215 216 217 218 219 220 221
  <define name='initiatorinfo'>
    <element name='initiator'>
      <element name='iqn'>
        <attribute name='name'>
          <text/>
        </attribute>
        <empty/>
      </element>
D
David Allan 已提交
222 223 224
    </element>
  </define>

225 226 227
  <define name='devextents'>
    <oneOrMore>
      <element name='freeExtent'>
228 229 230 231 232 233
        <attribute name='start'>
          <ref name='uint'/>
        </attribute>
        <attribute name='end'>
          <ref name='uint'/>
        </attribute>
234 235 236 237 238 239 240
      </element>
    </oneOrMore>
  </define>

  <define name='sourceinfodir'>
    <element name='dir'>
      <attribute name='path'>
241
        <ref name='path'/>
242 243 244 245 246 247 248 249
      </attribute>
      <empty/>
    </element>
  </define>

  <define name='sourceinfoadapter'>
    <element name='adapter'>
      <attribute name='name'>
250
        <text/>
251 252 253 254 255 256 257 258 259 260 261
      </attribute>
      <empty/>
    </element>
  </define>

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

262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
  <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>

278 279 280
  <define name='sourcefmtfs'>
    <optional>
      <element name='format'>
281 282 283 284 285
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>ext2</value>
            <value>ext3</value>
286
            <value>ext4</value>
287 288 289
            <value>ufs</value>
            <value>iso9660</value>
            <value>udf</value>
290
            <value>gfs</value>
291 292 293 294 295 296 297
            <value>gfs2</value>
            <value>vfat</value>
            <value>hfs+</value>
            <value>xfs</value>
            <value>ocfs2</value>
          </choice>
        </attribute>
298 299 300 301 302 303 304 305
      </element>
    </optional>
  </define>


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
306 307 308 309 310 311
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
          </choice>
        </attribute>
312 313 314
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
315 316 317 318 319 320 321 322
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
323 324 325 326 327 328 329 330 331 332 333 334 335
        <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>
336 337 338
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
339 340 341 342 343 344 345 346
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
347 348 349 350 351 352
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>lvm2</value>
          </choice>
        </attribute>
353 354 355
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
356 357 358 359 360 361 362 363
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
364
        <empty/>
365 366 367
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
368 369 370
      </element>
    </optional>
  </define>
371

372 373 374 375
  <define name='sourcefs'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtfs'/>
376 377 378
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
379 380 381 382 383 384 385 386
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodir'/>
      <ref name='sourcefmtnetfs'/>
387 388 389
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
390 391 392 393 394
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
395 396 397 398 399 400 401 402
      <oneOrMore>
        <optional>
          <ref name='sourceinfoname'/>
        </optional>
        <optional>
          <ref name='sourceinfodev'/>
        </optional>
      </oneOrMore>
403
      <ref name='sourcefmtlogical'/>
404 405 406
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
407 408 409 410 411 412 413
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtdisk'/>
414 415 416
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
417 418 419 420 421 422 423
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodev'/>
D
David Allan 已提交
424
      <optional>
D
David Allan 已提交
425
        <ref name='initiatorinfo'/>
D
David Allan 已提交
426
      </optional>
427 428 429
      <optional>
        <ref name='sourceinfoauth'/>
      </optional>
430 431 432
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
433 434 435 436 437
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
438
      <ref name='sourceinfoadapter'/>
439 440 441 442
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>

443 444 445
    </element>
  </define>

446 447 448 449 450
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479

  <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>

480 481 482 483 484
  <define name="PortNumber">
    <data type="short">
      <param name="minInclusive">-1</param>
    </data>
  </define>
485 486

</grammar>