storagepool.rng 14.3 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
  <define name='poolzfs'>
    <attribute name='type'>
      <value>zfs</value>
    </attribute>
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcezfs'/>
169 170 171
      <optional>
        <ref name='target'/>
      </optional>
R
Roman Bogorodskiy 已提交
172 173 174
    </interleave>
  </define>

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

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

  <define name='sizing'>
E
Eric Blake 已提交
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
    <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>
225 226 227 228 229
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
E
Eric Blake 已提交
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
        <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>
252 253 254 255 256 257
      </element>
    </optional>
  </define>

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

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

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

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

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

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

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

345 346 347 348 349 350 351 352 353
  <define name='sourceinfonetfsgluster'>
    <element name='dir'>
      <attribute name='path'>
        <ref name='dirPath'/>
      </attribute>
      <empty/>
    </element>
  </define>

354 355 356 357 358 359
  <define name='sourceinfoname'>
    <element name='name'>
      <text/>
    </element>
  </define>

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

  <define name='sourceinfoauthsecret'>
    <element name='secret'>
      <choice>
        <attribute name='uuid'>
          <text/>
        </attribute>
        <attribute name='usage'>
          <text/>
        </attribute>
      </choice>
385 386 387
    </element>
  </define>

R
Roman Bogorodskiy 已提交
388 389 390 391
  <define name='sourcezfs'>
    <element name='source'>
      <interleave>
        <ref name='sourceinfoname'/>
392 393 394
        <optional>
          <ref name='sourceinfodev'/>
        </optional>
R
Roman Bogorodskiy 已提交
395 396 397 398
      </interleave>
    </element>
  </define>

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


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
427 428 429 430
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
431
            <value>cifs</value>
432 433
          </choice>
        </attribute>
434 435 436 437 438 439 440 441
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
442 443 444 445 446 447 448 449 450 451 452 453 454
        <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>
455 456 457
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
458 459 460 461 462 463 464 465
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
466 467 468 469 470 471
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>lvm2</value>
          </choice>
        </attribute>
472 473 474
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
475 476 477 478 479 480 481 482
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
483
        <empty/>
484 485 486
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
487 488 489
      </element>
    </optional>
  </define>
490

491 492
  <define name='sourcefs'>
    <element name='source'>
E
Eric Blake 已提交
493 494 495 496 497 498 499
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtfs'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
500 501 502 503 504
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530
      <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>
531 532 533 534 535
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
E
Eric Blake 已提交
536 537 538 539 540 541 542 543 544 545
      <interleave>
        <oneOrMore>
          <optional>
            <ref name='sourceinfoname'/>
          </optional>
          <optional>
            <ref name='sourceinfodev'/>
          </optional>
        </oneOrMore>
        <ref name='sourcefmtlogical'/>
546
        <optional>
E
Eric Blake 已提交
547
          <ref name='sourceinfovendor'/>
548
        </optional>
E
Eric Blake 已提交
549
      </interleave>
550 551 552 553 554
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
E
Eric Blake 已提交
555 556 557 558 559 560 561
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtdisk'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
562 563 564 565 566
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
E
Eric Blake 已提交
567 568 569 570 571 572 573 574 575 576 577 578 579
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfodev'/>
        <optional>
          <ref name='initiatorinfo'/>
        </optional>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
580 581 582 583 584
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
E
Eric Blake 已提交
585 586 587 588 589 590
      <interleave>
        <ref name='sourceinfoadapter'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
591 592 593
    </element>
  </define>

594 595 596 597 598
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
599

600 601
  <define name='sourcerbd'>
    <element name='source'>
E
Eric Blake 已提交
602 603 604 605 606 607 608
      <interleave>
        <ref name='sourceinfoname'/>
        <ref name='sourceinfohost'/>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
      </interleave>
609 610 611
    </element>
  </define>

612 613
  <define name='sourcesheepdog'>
    <element name='source'>
E
Eric Blake 已提交
614 615 616 617
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfoname'/>
      </interleave>
618 619 620
    </element>
  </define>

E
Eric Blake 已提交
621 622 623 624 625 626 627 628 629 630 631 632
  <define name='sourcegluster'>
    <element name='source'>
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfoname'/>
        <optional>
          <ref name='sourceinfodir'/>
        </optional>
      </interleave>
    </element>
  </define>

633 634 635 636 637 638
  <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>

639
</grammar>