storagepool.rng 13.7 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
  <include href='storagecommon.rng'/>
7 8 9 10 11 12 13 14
  <start>
    <ref name='pool'/>
  </start>


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

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

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

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

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

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

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

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

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

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

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

E
Eric Blake 已提交
151 152 153 154 155 156 157 158 159 160 161
  <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 已提交
162 163 164 165 166 167 168 169
  <define name='poolzfs'>
    <attribute name='type'>
      <value>zfs</value>
    </attribute>
    <interleave>
      <ref name='commonmetadata'/>
      <ref name='sizing'/>
      <ref name='sourcezfs'/>
170 171 172
      <optional>
        <ref name='target'/>
      </optional>
R
Roman Bogorodskiy 已提交
173 174 175
    </interleave>
  </define>

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

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

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

  <define name='target'>
    <element name='target'>
E
Eric Blake 已提交
230 231 232 233 234 235
      <interleave>
        <element name='path'>
          <ref name='absFilePath'/>
        </element>
        <ref name='permissions'/>
      </interleave>
236 237 238
    </element>
  </define>

239 240
  <define name='targetlogical'>
    <element name='target'>
E
Eric Blake 已提交
241 242 243 244 245 246 247 248
      <interleave>
        <optional>
          <element name='path'>
            <ref name='absFilePath'/>
          </element>
        </optional>
        <ref name='permissions'/>
      </interleave>
249 250 251
    </element>
  </define>

252
  <define name='sourceinfohost'>
253 254 255 256
    <oneOrMore>
      <element name='host'>
        <attribute name='name'>
          <text/>
257
        </attribute>
258 259 260 261 262 263 264 265
        <optional>
          <attribute name='port'>
            <ref name="PortNumber"/>
          </attribute>
        </optional>
        <empty/>
      </element>
    </oneOrMore>
266 267 268 269 270
  </define>

  <define name='sourceinfodev'>
    <element name='device'>
      <attribute name='path'>
271
        <choice>
E
Eric Blake 已提交
272
          <ref name='absFilePath'/>
273
          <ref name='genericName'/>
274
          <ref name='IscsiQualifiedName'/>
275
        </choice>
276 277
      </attribute>
      <choice>
278 279
        <empty/>
        <ref name='devextents'/>
280 281 282 283
      </choice>
    </element>
  </define>

D
David Allan 已提交
284 285 286 287 288 289 290 291
  <define name='initiatorinfo'>
    <element name='initiator'>
      <element name='iqn'>
        <attribute name='name'>
          <text/>
        </attribute>
        <empty/>
      </element>
D
David Allan 已提交
292 293 294
    </element>
  </define>

295 296 297
  <define name='devextents'>
    <oneOrMore>
      <element name='freeExtent'>
298
        <attribute name='start'>
E
Eric Blake 已提交
299
          <ref name='unsignedLong'/>
300 301
        </attribute>
        <attribute name='end'>
E
Eric Blake 已提交
302
          <ref name='unsignedLong'/>
303
        </attribute>
304 305 306 307 308 309 310
      </element>
    </oneOrMore>
  </define>

  <define name='sourceinfodir'>
    <element name='dir'>
      <attribute name='path'>
E
Eric Blake 已提交
311
        <ref name='absDirPath'/>
312 313 314 315 316
      </attribute>
      <empty/>
    </element>
  </define>

317
  <define name='sourceinfonetrelativepath'>
318 319 320 321 322 323 324 325
    <element name='dir'>
      <attribute name='path'>
        <ref name='dirPath'/>
      </attribute>
      <empty/>
    </element>
  </define>

326 327 328 329 330 331
  <define name='sourceinfoname'>
    <element name='name'>
      <text/>
    </element>
  </define>

332 333 334 335 336
  <define name='sourceinfoauth'>
    <element name='auth'>
      <attribute name='type'>
        <choice>
          <value>chap</value>
337
          <value>ceph</value>
338 339
        </choice>
      </attribute>
340 341 342 343
      <attribute name='username'>
        <text/>
      </attribute>
      <ref name='sourceinfoauthsecret'/>
344 345 346 347 348 349 350 351 352 353 354 355 356
    </element>
  </define>

  <define name='sourceinfoauthsecret'>
    <element name='secret'>
      <choice>
        <attribute name='uuid'>
          <text/>
        </attribute>
        <attribute name='usage'>
          <text/>
        </attribute>
      </choice>
357 358 359
    </element>
  </define>

R
Roman Bogorodskiy 已提交
360 361 362 363
  <define name='sourcezfs'>
    <element name='source'>
      <interleave>
        <ref name='sourceinfoname'/>
364 365 366
        <optional>
          <ref name='sourceinfodev'/>
        </optional>
R
Roman Bogorodskiy 已提交
367 368 369 370
      </interleave>
    </element>
  </define>

371 372 373
  <define name='sourcefmtfs'>
    <optional>
      <element name='format'>
374 375 376 377 378
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>ext2</value>
            <value>ext3</value>
379
            <value>ext4</value>
380 381 382
            <value>ufs</value>
            <value>iso9660</value>
            <value>udf</value>
383
            <value>gfs</value>
384 385 386 387 388 389 390
            <value>gfs2</value>
            <value>vfat</value>
            <value>hfs+</value>
            <value>xfs</value>
            <value>ocfs2</value>
          </choice>
        </attribute>
391 392 393 394 395 396 397 398
      </element>
    </optional>
  </define>


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
399 400 401 402 403 404
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
          </choice>
        </attribute>
405 406 407 408 409 410 411 412
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
413 414
        <attribute name='type'>
          <choice>
J
John Ferlan 已提交
415
            <value>unknown</value>
416 417 418 419 420 421 422 423 424 425
            <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>
426 427 428
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
429 430 431 432 433 434 435 436
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
437 438
        <attribute name='type'>
          <choice>
439
            <value>unknown</value> <!-- back-compat requires keeping 'unknown' not 'auto' -->
440 441 442
            <value>lvm2</value>
          </choice>
        </attribute>
443 444 445
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
446 447 448 449 450 451 452 453
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
454
        <empty/>
455 456 457
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
458 459 460
      </element>
    </optional>
  </define>
461

462 463
  <define name='sourcefs'>
    <element name='source'>
E
Eric Blake 已提交
464 465 466 467 468 469 470
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtfs'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
471 472 473 474 475
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
476 477 478 479 480 481 482 483 484 485 486 487 488 489
      <choice>
        <group>
          <interleave>
            <ref name='sourceinfohost'/>
            <ref name='sourceinfodir'/>
            <ref name='sourcefmtnetfs'/>
            <optional>
                <ref name='sourceinfovendor'/>
            </optional>
          </interleave>
        </group>
        <group>
          <interleave>
            <ref name='sourceinfohost'/>
490
            <ref name='sourceinfonetrelativepath'/>
491 492
            <element name='format'>
              <attribute name='type'>
493 494 495 496
                <choice>
                  <value>cifs</value>
                  <value>glusterfs</value>
                </choice>
497 498 499 500 501 502 503 504
              </attribute>
            </element>
            <optional>
                <ref name='sourceinfovendor'/>
            </optional>
          </interleave>
        </group>
      </choice>
505 506 507 508 509
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
E
Eric Blake 已提交
510 511 512 513 514 515 516 517 518 519
      <interleave>
        <oneOrMore>
          <optional>
            <ref name='sourceinfoname'/>
          </optional>
          <optional>
            <ref name='sourceinfodev'/>
          </optional>
        </oneOrMore>
        <ref name='sourcefmtlogical'/>
520
        <optional>
E
Eric Blake 已提交
521
          <ref name='sourceinfovendor'/>
522
        </optional>
E
Eric Blake 已提交
523
      </interleave>
524 525 526 527 528
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
E
Eric Blake 已提交
529 530 531 532 533 534 535
      <interleave>
        <ref name='sourceinfodev'/>
        <ref name='sourcefmtdisk'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
536 537 538 539 540
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
E
Eric Blake 已提交
541 542 543 544 545 546 547 548 549 550 551 552 553
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfodev'/>
        <optional>
          <ref name='initiatorinfo'/>
        </optional>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
554 555 556 557 558
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
E
Eric Blake 已提交
559 560 561 562 563 564
      <interleave>
        <ref name='sourceinfoadapter'/>
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
      </interleave>
565 566 567
    </element>
  </define>

568 569 570 571 572
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
573

574 575
  <define name='sourcerbd'>
    <element name='source'>
E
Eric Blake 已提交
576 577 578 579 580 581 582
      <interleave>
        <ref name='sourceinfoname'/>
        <ref name='sourceinfohost'/>
        <optional>
          <ref name='sourceinfoauth'/>
        </optional>
      </interleave>
583 584 585
    </element>
  </define>

586 587
  <define name='sourcesheepdog'>
    <element name='source'>
E
Eric Blake 已提交
588 589 590 591
      <interleave>
        <ref name='sourceinfohost'/>
        <ref name='sourceinfoname'/>
      </interleave>
592 593 594
    </element>
  </define>

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

607 608 609 610 611 612
  <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>

613
</grammar>