storagepool.rng 11.0 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 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 95 96
      </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>

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

109 110 111 112 113 114 115 116 117
  <define name='poolrbd'>
    <attribute name='type'>
      <value>rbd</value>
    </attribute>
    <ref name='commonmetadata'/>
    <ref name='sizing'/>
    <ref name='sourcerbd'/>
  </define>

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
  <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>

135 136 137 138 139 140
  <define name='commonmetadata'>
    <element name='name'>
      <ref name='name'/>
    </element>
    <optional>
      <element name='uuid'>
E
Eric Blake 已提交
141
        <ref name='UUID'/>
142 143 144 145 146 147 148
      </element>
    </optional>
  </define>

  <define name='sizing'>
    <optional>
      <element name='capacity'>
E
Eric Blake 已提交
149
        <ref name='scaledInteger'/>
150 151 152 153
      </element>
    </optional>
    <optional>
      <element name='allocation'>
E
Eric Blake 已提交
154
        <ref name='scaledInteger'/>
155 156 157 158
      </element>
    </optional>
    <optional>
      <element name='available'>
E
Eric Blake 已提交
159
        <ref name='scaledInteger'/>
160 161 162 163 164 165 166
      </element>
    </optional>
  </define>

  <define name='permissions'>
    <optional>
      <element name='permissions'>
167
        <element name='mode'>
E
Eric Blake 已提交
168
          <ref name='unsignedInt'/>
169 170
        </element>
        <element name='owner'>
E
Eric Blake 已提交
171
          <ref name='unsignedInt'/>
172 173
        </element>
        <element name='group'>
E
Eric Blake 已提交
174
          <ref name='unsignedInt'/>
175 176 177 178 179 180
        </element>
        <optional>
          <element name='label'>
            <text/>
        </element>
        </optional>
181 182 183 184 185 186 187
      </element>
    </optional>
  </define>

  <define name='target'>
    <element name='target'>
      <optional>
188
        <element name='path'>
E
Eric Blake 已提交
189
          <ref name='absFilePath'/>
190
        </element>
191 192 193 194 195 196
      </optional>
      <ref name='permissions'/>
    </element>
  </define>

  <define name='sourceinfohost'>
197 198 199 200
    <oneOrMore>
      <element name='host'>
        <attribute name='name'>
          <text/>
201
        </attribute>
202 203 204 205 206 207 208 209
        <optional>
          <attribute name='port'>
            <ref name="PortNumber"/>
          </attribute>
        </optional>
        <empty/>
      </element>
    </oneOrMore>
210 211 212 213 214
  </define>

  <define name='sourceinfodev'>
    <element name='device'>
      <attribute name='path'>
215
        <choice>
E
Eric Blake 已提交
216
          <ref name='absFilePath'/>
217 218
          <ref name='name'/>
        </choice>
219 220
      </attribute>
      <choice>
221 222
        <empty/>
        <ref name='devextents'/>
223 224 225 226
      </choice>
    </element>
  </define>

D
David Allan 已提交
227 228 229 230 231 232 233 234
  <define name='initiatorinfo'>
    <element name='initiator'>
      <element name='iqn'>
        <attribute name='name'>
          <text/>
        </attribute>
        <empty/>
      </element>
D
David Allan 已提交
235 236 237
    </element>
  </define>

238 239 240
  <define name='devextents'>
    <oneOrMore>
      <element name='freeExtent'>
241
        <attribute name='start'>
E
Eric Blake 已提交
242
          <ref name='unsignedLong'/>
243 244
        </attribute>
        <attribute name='end'>
E
Eric Blake 已提交
245
          <ref name='unsignedLong'/>
246
        </attribute>
247 248 249 250 251 252 253
      </element>
    </oneOrMore>
  </define>

  <define name='sourceinfodir'>
    <element name='dir'>
      <attribute name='path'>
E
Eric Blake 已提交
254
        <ref name='absFilePath'/>
255 256 257 258 259 260 261 262
      </attribute>
      <empty/>
    </element>
  </define>

  <define name='sourceinfoadapter'>
    <element name='adapter'>
      <attribute name='name'>
263
        <text/>
264 265 266 267 268 269 270 271 272 273 274
      </attribute>
      <empty/>
    </element>
  </define>

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

275 276 277 278 279
  <define name='sourceinfoauth'>
    <element name='auth'>
      <attribute name='type'>
        <choice>
          <value>chap</value>
280
          <value>ceph</value>
281 282
        </choice>
      </attribute>
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
      <choice>
        <attribute name='login'>
          <text/>
        </attribute>
        <attribute name='username'>
          <text/>
        </attribute>
      </choice>
      <optional>
        <attribute name='passwd'>
          <text/>
        </attribute>
      </optional>
      <optional>
        <ref name='sourceinfoauthsecret'/>
      </optional>
    </element>
  </define>

  <define name='sourceinfoauthsecret'>
    <element name='secret'>
      <choice>
        <attribute name='uuid'>
          <text/>
        </attribute>
        <attribute name='usage'>
          <text/>
        </attribute>
      </choice>
312 313 314
    </element>
  </define>

315 316 317
  <define name='sourcefmtfs'>
    <optional>
      <element name='format'>
318 319 320 321 322
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>ext2</value>
            <value>ext3</value>
323
            <value>ext4</value>
324 325 326
            <value>ufs</value>
            <value>iso9660</value>
            <value>udf</value>
327
            <value>gfs</value>
328 329 330 331 332 333 334
            <value>gfs2</value>
            <value>vfat</value>
            <value>hfs+</value>
            <value>xfs</value>
            <value>ocfs2</value>
          </choice>
        </attribute>
335 336 337 338 339 340 341 342
      </element>
    </optional>
  </define>


  <define name='sourcefmtnetfs'>
    <optional>
      <element name='format'>
343 344 345 346 347 348
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>nfs</value>
          </choice>
        </attribute>
349 350 351
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
352 353 354 355 356 357 358 359
      </element>
    </optional>
  </define>


  <define name='sourcefmtdisk'>
    <optional>
      <element name='format'>
360 361 362 363 364 365 366 367 368 369 370 371 372
        <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>
373 374 375
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
376 377 378 379 380 381 382 383
      </element>
    </optional>
  </define>


  <define name='sourcefmtlogical'>
    <optional>
      <element name='format'>
384 385 386 387 388 389
        <attribute name='type'>
          <choice>
            <value>auto</value>
            <value>lvm2</value>
          </choice>
        </attribute>
390 391 392
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
393 394 395 396 397 398 399 400
      </element>
    </optional>
  </define>


  <define name='sourcedir'>
    <optional>
      <element name='source'>
401
        <empty/>
402 403 404
        <optional>
          <ref name='sourceinfovendor'/>
        </optional>
405 406 407
      </element>
    </optional>
  </define>
408

409 410 411 412
  <define name='sourcefs'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtfs'/>
413 414 415
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
416 417 418 419 420 421 422 423
    </element>
  </define>

  <define name='sourcenetfs'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodir'/>
      <ref name='sourcefmtnetfs'/>
424 425 426
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
427 428 429 430 431
    </element>
  </define>

  <define name='sourcelogical'>
    <element name='source'>
432 433 434 435 436 437 438 439
      <oneOrMore>
        <optional>
          <ref name='sourceinfoname'/>
        </optional>
        <optional>
          <ref name='sourceinfodev'/>
        </optional>
      </oneOrMore>
440
      <ref name='sourcefmtlogical'/>
441 442 443
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
444 445 446 447 448 449 450
    </element>
  </define>

  <define name='sourcedisk'>
    <element name='source'>
      <ref name='sourceinfodev'/>
      <ref name='sourcefmtdisk'/>
451 452 453
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
454 455 456 457 458 459 460
    </element>
  </define>

  <define name='sourceiscsi'>
    <element name='source'>
      <ref name='sourceinfohost'/>
      <ref name='sourceinfodev'/>
D
David Allan 已提交
461
      <optional>
D
David Allan 已提交
462
        <ref name='initiatorinfo'/>
D
David Allan 已提交
463
      </optional>
464 465 466
      <optional>
        <ref name='sourceinfoauth'/>
      </optional>
467 468 469
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>
470 471 472 473 474
    </element>
  </define>

  <define name='sourcescsi'>
    <element name='source'>
475
      <ref name='sourceinfoadapter'/>
476 477 478 479
      <optional>
        <ref name='sourceinfovendor'/>
      </optional>

480 481 482
    </element>
  </define>

483 484 485 486 487
  <define name='sourcempath'>
    <element name='source'>
      <empty/>
    </element>
  </define>
488

489 490 491 492 493 494 495 496 497 498
  <define name='sourcerbd'>
    <element name='source'>
      <ref name='sourceinfoname'/>
      <ref name='sourceinfohost'/>
      <optional>
        <ref name='sourceinfoauth'/>
      </optional>
    </element>
  </define>

499 500 501 502 503 504
  <define name='name'>
    <data type='string'>
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>

505 506 507 508 509
  <define name="PortNumber">
    <data type="short">
      <param name="minInclusive">-1</param>
    </data>
  </define>
510 511

</grammar>