storagepool.rng 14.1 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
<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 10 11 12 13
  <start>
    <ref name='pool'/>
  </start>


  <define name='pool'>
    <element name='pool'>
      <choice>
14 15 16 17 18 19 20 21
        <ref name='pooldir'/>
        <ref name='poolfs'/>
        <ref name='poolnetfs'/>
        <ref name='poollogical'/>
        <ref name='pooldisk'/>
        <ref name='pooliscsi'/>
        <ref name='poolscsi'/>
        <ref name='poolmpath'/>
22
        <ref name='poolrbd'/>
23
        <ref name='poolsheepdog'/>
E
Eric Blake 已提交
24
        <ref name='poolgluster'/>
R
Roman Bogorodskiy 已提交
25
        <ref name='poolzfs'/>
26 27 28 29 30 31 32 33
      </choice>
    </element>
  </define>

  <define name='pooldir'>
    <attribute name='type'>
      <value>dir</value>
    </attribute>
E
Eric Blake 已提交
34 35 36 37 38 39
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcedir'/>
      <ref name='target'/>
    </interleave>
40 41 42 43 44 45
  </define>

  <define name='poolfs'>
    <attribute name='type'>
      <value>fs</value>
    </attribute>
E
Eric Blake 已提交
46 47 48 49 50 51
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcefs'/>
      <ref name='target'/>
    </interleave>
52 53 54 55 56 57
  </define>

  <define name='poolnetfs'>
    <attribute name='type'>
      <value>netfs</value>
    </attribute>
E
Eric Blake 已提交
58 59 60 61 62 63
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcenetfs'/>
      <ref name='target'/>
    </interleave>
64 65 66 67 68 69
  </define>

  <define name='poollogical'>
    <attribute name='type'>
      <value>logical</value>
    </attribute>
E
Eric Blake 已提交
70 71 72 73 74 75
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcelogical'/>
      <ref name='targetlogical'/>
    </interleave>
76 77 78 79 80 81
  </define>

  <define name='pooldisk'>
    <attribute name='type'>
      <value>disk</value>
    </attribute>
E
Eric Blake 已提交
82 83 84 85 86 87
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcedisk'/>
      <ref name='target'/>
    </interleave>
88 89 90 91 92 93
  </define>

  <define name='pooliscsi'>
    <attribute name='type'>
      <value>iscsi</value>
    </attribute>
E
Eric Blake 已提交
94 95 96 97 98 99
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourceiscsi'/>
      <ref name='target'/>
    </interleave>
100 101 102 103 104 105
  </define>

  <define name='poolscsi'>
    <attribute name='type'>
      <value>scsi</value>
    </attribute>
E
Eric Blake 已提交
106 107 108 109 110 111
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcescsi'/>
      <ref name='target'/>
    </interleave>
112 113
  </define>

114 115 116 117
  <define name='poolmpath'>
    <attribute name='type'>
      <value>mpath</value>
    </attribute>
E
Eric Blake 已提交
118 119 120 121 122 123 124 125
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <optional>
        <ref name='sourcempath'/>
      </optional>
      <ref name='target'/>
    </interleave>
126 127
  </define>

128 129 130 131
  <define name='poolrbd'>
    <attribute name='type'>
      <value>rbd</value>
    </attribute>
E
Eric Blake 已提交
132 133 134 135 136
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcerbd'/>
    </interleave>
137 138
  </define>

139 140 141 142
  <define name='poolsheepdog'>
    <attribute name='type'>
      <value>sheepdog</value>
    </attribute>
E
Eric Blake 已提交
143 144 145 146 147
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcesheepdog'/>
    </interleave>
148 149
  </define>

E
Eric Blake 已提交
150 151 152 153 154 155 156 157 158 159 160
  <define name='poolgluster'>
    <attribute name='type'>
      <value>gluster</value>
    </attribute>
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcegluster'/>
    </interleave>
  </define>

R
Roman Bogorodskiy 已提交
161 162 163 164 165 166 167 168 169 170 171
  <define name='poolzfs'>
    <attribute name='type'>
      <value>zfs</value>
    </attribute>
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcezfs'/>
    </interleave>
  </define>

172
  <define name='sourceinfovendor'>
E
Eric Blake 已提交
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
    <interleave>
      <optional>
        <element name='vendor'>
          <attribute name='name'>
            <text/>
          </attribute>
        </element>
      </optional>
      <optional>
        <element name='product'>
          <attribute name='name'>
            <text/>
          </attribute>
        </element>
      </optional>
    </interleave>
189 190
  </define>

191
  <define name='commonmetadata'>
E
Eric Blake 已提交
192 193 194
    <interleave>
      <element name='name'>
        <ref name='genericName'/>
195
      </element>
E
Eric Blake 已提交
196 197 198 199 200 201
      <optional>
        <element name='uuid'>
          <ref name='UUID'/>
        </element>
      </optional>
    </interleave>
202 203 204
  </define>

  <define name='sizing'>
E
Eric Blake 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
    <interleave>
      <optional>
        <element name='capacity'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
      <optional>
        <element name='allocation'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
      <optional>
        <element name='available'>
          <ref name='scaledInteger'/>
        </element>
      </optional>
    </interleave>
222 223 224 225 226
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
E
Eric Blake 已提交
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
        <interleave>
          <element name='mode'>
            <ref name='octalMode'/>
          </element>
          <element name='owner'>
            <choice>
              <ref name='unsignedInt'/>
              <value>-1</value>
            </choice>
          </element>
          <element name='group'>
            <choice>
              <ref name='unsignedInt'/>
              <value>-1</value>
            </choice>
          </element>
          <optional>
            <element name='label'>
              <text/>
            </element>
          </optional>
        </interleave>
249 250 251 252 253 254
      </element>
    </optional>
  </define>

  <define name='target'>
    <element name='target'>
E
Eric Blake 已提交
255 256 257 258 259 260
      <interleave>
        <element name='path'>
          <ref name='absFilePath'/>
        </element>
        <ref name='permissions'/>
      </interleave>
261 262 263
    </element>
  </define>

264 265
  <define name='targetlogical'>
    <element name='target'>
E
Eric Blake 已提交
266 267 268 269 270 271 272 273
      <interleave>
        <optional>
          <element name='path'>
            <ref name='absFilePath'/>
          </element>
        </optional>
        <ref name='permissions'/>
      </interleave>
274 275 276
    </element>
  </define>

277
  <define name='sourceinfohost'>
278 279 280 281
    <oneOrMore>
      <element name='host'>
        <attribute name='name'>
          <text/>
282
        </attribute>
283 284 285 286 287 288 289 290
        <optional>
          <attribute name='port'>
            <ref name="PortNumber"/>
          </attribute>
        </optional>
        <empty/>
      </element>
    </oneOrMore>
291 292 293 294 295
  </define>

  <define name='sourceinfodev'>
    <element name='device'>
      <attribute name='path'>
296
        <choice>
E
Eric Blake 已提交
297
          <ref name='absFilePath'/>
298
          <ref name='genericName'/>
299
          <ref name='IscsiQualifiedName'/>
300
        </choice>
301 302
      </attribute>
      <choice>
303 304
        <empty/>
        <ref name='devextents'/>
305 306 307 308
      </choice>
    </element>
  </define>

D
David Allan 已提交
309 310 311 312 313 314 315 316
  <define name='initiatorinfo'>
    <element name='initiator'>
      <element name='iqn'>
        <attribute name='name'>
          <text/>
        </attribute>
        <empty/>
      </element>
D
David Allan 已提交
317 318 319
    </element>
  </define>

320 321 322
  <define name='devextents'>
    <oneOrMore>
      <element name='freeExtent'>
323
        <attribute name='start'>
E
Eric Blake 已提交
324
          <ref name='unsignedLong'/>
325 326
        </attribute>
        <attribute name='end'>
E
Eric Blake 已提交
327
          <ref name='unsignedLong'/>
328
        </attribute>
329 330 331 332 333 334 335
      </element>
    </oneOrMore>
  </define>

  <define name='sourceinfodir'>
    <element name='dir'>
      <attribute name='path'>
E
Eric Blake 已提交
336
        <ref name='absDirPath'/>
337 338 339 340 341
      </attribute>
      <empty/>
    </element>
  </define>

342 343 344 345 346 347 348 349 350
  <define name='sourceinfonetfsgluster'>
    <element name='dir'>
      <attribute name='path'>
        <ref name='dirPath'/>
      </attribute>
      <empty/>
    </element>
  </define>

351 352 353 354 355 356
  <define name='sourceinfoname'>
    <element name='name'>
      <text/>
    </element>
  </define>

357 358 359 360 361
  <define name='sourceinfoauth'>
    <element name='auth'>
      <attribute name='type'>
        <choice>
          <value>chap</value>
362
          <value>ceph</value>
363 364
        </choice>
      </attribute>
365 366 367 368
      <attribute name='username'>
        <text/>
      </attribute>
      <ref name='sourceinfoauthsecret'/>
369 370 371 372 373 374 375 376 377 378 379 380 381
    </element>
  </define>

  <define name='sourceinfoauthsecret'>
    <element name='secret'>
      <choice>
        <attribute name='uuid'>
          <text/>
        </attribute>
        <attribute name='usage'>
          <text/>
        </attribute>
      </choice>
382 383 384
    </element>
  </define>

R
Roman Bogorodskiy 已提交
385 386 387 388 389 390 391 392
  <define name='sourcezfs'>
    <element name='source'>
      <interleave>
        <ref name='sourceinfoname'/>
      </interleave>
    </element>
  </define>

393 394 395
  <define name='sourcefmtfs'>
    <optional>
      <element name='format'>
396 397 398 399 400
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>ext2</value>
            <value>ext3</value>
401
            <value>ext4</value>
402 403 404
            <value>ufs</value>
            <value>iso9660</value>
            <value>udf</value>
405
            <value>gfs</value>
406 407 408 409 410 411 412
            <value>gfs2</value>
            <value>vfat</value>
            <value>hfs+</value>
            <value>xfs</value>
            <value>ocfs2</value>
          </choice>
        </attribute>
413 414 415 416 417 418 419 420
      </element>
    </optional>
  </define>


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
421 422 423 424
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
425
            <value>cifs</value>
426 427
          </choice>
        </attribute>
428 429 430 431 432 433 434 435
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
436 437 438 439 440 441 442 443 444 445 446 447 448
        <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>
449 450 451
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
452 453 454 455 456 457 458 459
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
460 461 462 463 464 465
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>lvm2</value>
          </choice>
        </attribute>
466 467 468
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
469 470 471 472 473 474 475 476
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
477
        <empty/>
478 479 480
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
481 482 483
      </element>
    </optional>
  </define>
484

485 486
  <define name='sourcefs'>
    <element name='source'>
E
Eric Blake 已提交
487 488 489 490 491 492 493
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtfs'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
494 495 496 497 498
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
      <choice>
        <group>
          <interleave>
            <ref name='sourceinfohost'/>
            <ref name='sourceinfodir'/>
            <ref name='sourcefmtnetfs'/>
            <optional>
                <ref name='sourceinfovendor'/>
            </optional>
          </interleave>
        </group>
        <group>
          <interleave>
            <ref name='sourceinfohost'/>
            <ref name='sourceinfonetfsgluster'/>
            <element name='format'>
              <attribute name='type'>
                <value>glusterfs</value>
              </attribute>
            </element>
            <optional>
                <ref name='sourceinfovendor'/>
            </optional>
          </interleave>
        </group>
      </choice>
525 526 527 528 529
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
E
Eric Blake 已提交
530 531 532 533 534 535 536 537 538 539
      <interleave>
        <oneOrMore>
          <optional>
            <ref name='sourceinfoname'/>
          </optional>
          <optional>
            <ref name='sourceinfodev'/>
          </optional>
        </oneOrMore>
        <ref name='sourcefmtlogical'/>
540
        <optional>
E
Eric Blake 已提交
541
          <ref name='sourceinfovendor'/>
542
        </optional>
E
Eric Blake 已提交
543
      </interleave>
544 545 546 547 548
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
E
Eric Blake 已提交
549 550 551 552 553 554 555
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtdisk'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
556 557 558 559 560
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
E
Eric Blake 已提交
561 562 563 564 565 566 567 568 569 570 571 572 573
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfodev'/>
        <optional>
          <ref name='initiatorinfo'/>
        </optional>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
574 575 576 577 578
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
E
Eric Blake 已提交
579 580 581 582 583 584
      <interleave>
        <ref name='sourceinfoadapter'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
585 586 587
    </element>
  </define>

588 589 590 591 592
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
593

594 595
  <define name='sourcerbd'>
    <element name='source'>
E
Eric Blake 已提交
596 597 598 599 600 601 602
      <interleave>
        <ref name='sourceinfoname'/>
        <ref name='sourceinfohost'/>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
      </interleave>
603 604 605
    </element>
  </define>

606 607
  <define name='sourcesheepdog'>
    <element name='source'>
E
Eric Blake 已提交
608 609 610 611
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfoname'/>
      </interleave>
612 613 614
    </element>
  </define>

E
Eric Blake 已提交
615 616 617 618 619 620 621 622 623 624 625 626
  <define name='sourcegluster'>
    <element name='source'>
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfoname'/>
        <optional>
          <ref name='sourceinfodir'/>
        </optional>
      </interleave>
    </element>
  </define>

627 628 629 630 631 632
  <define name='IscsiQualifiedName'>
    <data type='string'>
      <param name="pattern">iqn\.[0-9]{4}-(0[1-9]|1[0-2])\.[a-zA-Z0-9\.\-]+(:.+)?</param>
    </data>
  </define>

633
</grammar>