nodedev.rng 12.3 KB
Newer Older
1
<?xml version="1.0"?>
2 3 4
<!-- A Relax NG schema for the libvirt node device XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
5
  <include href='basictypes.rng'/>
6 7 8 9 10 11 12 13 14
  <start>
    <ref name='device'/>
  </start>

  <define name='device'>
    <element name="device">
      <!-- The name of the network, used to refer to it through the API
         and in virsh -->
      <element name="name"><text/></element>
15 16 17
      <optional>
        <element name="path"><text/></element>
      </optional>
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
      <optional>
        <element name="devnode">
          <attribute name='type'>
            <value>dev</value>
          </attribute>
          <text/>
        </element>
      </optional>
      <zeroOrMore>
        <element name="devnode">
          <attribute name='type'>
            <value>link</value>
          </attribute>
          <text/>
        </element>
      </zeroOrMore>
34
      <optional>
35
        <ref name="parent"/>
36 37
      </optional>

38 39 40 41 42 43
      <optional>
        <element name="driver">
          <element name="name"><text/></element>
        </element>
      </optional>

44
      <zeroOrMore>
45
        <ref name="capability"/>
46 47 48 49
      </zeroOrMore>
    </element>
  </define>

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  <define name='parent'>
    <element name='parent'>
      <choice>
        <group>
          <attribute name='wwnn'>
            <ref name='wwn'/>
          </attribute>
          <attribute name='wwpn'>
            <ref name='wwn'/>
          </attribute>
          <empty/>
        </group>
        <group>
          <attribute name='fabric_wwn'>
            <ref name='wwn'/>
          </attribute>
          <empty/>
        </group>
        <text/>
      </choice>
    </element>
  </define>

73 74 75
  <define name='capability'>
    <element name="capability">
      <choice>
76 77 78 79 80 81
        <ref name="capsystem"/>
        <ref name="cappcidev"/>
        <ref name="capusbdev"/>
        <ref name="capusbinterface"/>
        <ref name="capnet"/>
        <ref name="capscsihost"/>
82
        <ref name="capscsitarget"/>
83 84
        <ref name="capscsi"/>
        <ref name="capstorage"/>
M
Marc-André Lureau 已提交
85
        <ref name="capdrm"/>
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
      </choice>
    </element>
  </define>

  <define name='capsystem'>
    <attribute name='type'>
      <value>system</value>
    </attribute>

    <optional>
      <element name='product'><text/></element>
    </optional>

    <element name='hardware'>
      <optional>
101
        <element name='vendor'><text/></element>
102 103
      </optional>
      <optional>
104
        <element name='version'><text/></element>
105 106
      </optional>
      <optional>
107
        <element name='serial'><text/></element>
108 109 110
      </optional>

      <element name='uuid'>
111
        <ref name='UUID'/>
112 113 114 115 116 117
      </element>
    </element>


    <element name='firmware'>
      <optional>
118
        <element name='vendor'><text/></element>
119 120
      </optional>
      <optional>
121
        <element name='version'><text/></element>
122 123
      </optional>
      <optional>
124
        <element name='release_date'><text/></element>
125 126 127 128 129 130 131 132 133 134
      </optional>
    </element>
  </define>

  <define name='cappcidev'>
    <attribute name='type'>
      <value>pci</value>
    </attribute>

    <element name='domain'>
135
      <ref name='unsignedLong'/>
136 137
    </element>
    <element name='bus'>
138
      <ref name='unsignedLong'/>
139 140
    </element>
    <element name='slot'>
141
      <ref name='unsignedLong'/>
142 143
    </element>
    <element name='function'>
144
      <ref name='unsignedLong'/>
145 146 147 148
    </element>

    <element name='product'>
      <attribute name='id'>
149
        <ref name='hexuint'/>
150 151 152
      </attribute>

      <choice>
153 154
        <text/>
        <empty/>
155 156 157 158 159
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
160
        <ref name='hexuint'/>
161 162 163
      </attribute>

      <choice>
164 165
        <text/>
        <empty/>
166 167 168
      </choice>
    </element>

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    <optional>
      <element name='capability'>
        <attribute name='type'>
          <value>phys_function</value>
        </attribute>
        <optional>
          <ref name='address'/>
        </optional>
      </element>
    </optional>

    <optional>
      <element name='capability'>
        <attribute name='type'>
          <value>virt_functions</value>
        </attribute>
        <optional>
186 187 188
          <attribute name='maxCount'>
            <ref name='unsignedInt'/>
          </attribute>
189
        </optional>
190 191 192
        <zeroOrMore>
          <ref name='address'/>
        </zeroOrMore>
193 194 195
      </element>
    </optional>

196 197 198 199 200 201 202 203 204 205 206
    <optional>
      <element name='capability'>
        <attribute name='type'>
          <choice>
            <value>pci-bridge</value>
            <value>cardbus-bridge</value>
          </choice>
        </attribute>
      </element>
    </optional>

207 208 209 210 211 212 213 214 215 216 217
    <optional>
      <element name='iommuGroup'>
        <attribute name='number'>
          <ref name='unsignedInt'/>
        </attribute>
        <oneOrMore>
          <ref name='address'/>
        </oneOrMore>
      </element>
    </optional>

218 219 220 221 222 223 224 225
    <optional>
      <element name='numa'>
        <optional>
          <attribute name='node'>
            <data type='int'/>
          </attribute>
        </optional>
      </element>
226 227
    </optional>

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
    <optional>
      <element name='pci-express'>
        <zeroOrMore>
          <element name='link'>
            <attribute name='validity'>
              <choice>
                <value>cap</value>
                <value>sta</value>
              </choice>
            </attribute>
            <optional>
              <attribute name='port'>
                <ref name='unsignedInt'/>
              </attribute>
            </optional>
            <optional>
              <attribute name='speed'>
                <data type="string">
                  <param name="pattern">[0-9]+(.[0-9]+)?</param>
                </data>
              </attribute>
            </optional>
            <attribute name='width'>
              <ref name='unsignedInt'/>
            </attribute>
          </element>
        </zeroOrMore>
      </element>
    </optional>
257 258 259 260 261 262 263 264
  </define>

  <define name='capusbdev'>
    <attribute name='type'>
      <value>usb_device</value>
    </attribute>

    <element name='bus'>
265
      <ref name='unsignedLong'/>
266 267
    </element>
    <element name='device'>
268
      <ref name='unsignedLong'/>
269 270 271 272
    </element>

    <element name='product'>
      <attribute name='id'>
273
        <ref name='hexuint'/>
274 275 276
      </attribute>

      <choice>
277 278
        <text/>
        <empty/>
279 280 281 282 283
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
284
        <ref name='hexuint'/>
285 286 287
      </attribute>

      <choice>
288 289
        <text/>
        <empty/>
290 291 292 293 294 295 296 297 298 299
      </choice>
    </element>
  </define>

  <define name='capusbinterface'>
    <attribute name='type'>
      <value>usb</value>
    </attribute>

    <element name='number'>
300
      <ref name='unsignedLong'/>
301 302
    </element>
    <element name='class'>
303
      <ref name='unsignedLong'/>
304 305
    </element>
    <element name='subclass'>
306
      <ref name='unsignedLong'/>
307 308
    </element>
    <element name='protocol'>
309
      <ref name='unsignedLong'/>
310 311 312 313
    </element>

    <optional>
      <element name='description'>
314
        <text/>
315 316 317 318 319 320 321 322 323 324 325 326 327 328
      </element>
    </optional>
  </define>

  <define name='capnet'>
    <attribute name='type'>
      <value>net</value>
    </attribute>

    <element name='interface'>
      <text/>
    </element>
    <optional>
      <element name='address'>
329
        <ref name='mac'/>
330 331
      </element>
    </optional>
332
    <ref name="link-speed-state"/>
333

334 335 336 337 338 339 340 341
    <zeroOrMore>
      <element name='feature'>
        <attribute name='name'>
          <ref name='netfeaturename'/>
        </attribute>
      </element>
    </zeroOrMore>

342 343 344 345 346
    <zeroOrMore>
      <ref name='subcapnet'/>
    </zeroOrMore>
  </define>

347 348 349 350 351 352
  <define name='netfeaturename'>
    <data type='string'>
      <param name='pattern'>[a-zA-Z\-_]+</param>
    </data>
  </define>

353 354 355
  <define name='subcapnet'>
    <element name='capability'>
      <choice>
356 357
        <ref name='subcapnet80203'/>
        <ref name='subcapnet80211'/>
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
      </choice>
    </element>
  </define>

  <define name='subcapnet80203'>
    <attribute name='type'>
      <value>80203</value>
    </attribute>
  </define>

  <define name='subcapnet80211'>
    <attribute name='type'>
      <value>80211</value>
    </attribute>
  </define>

O
Osier Yang 已提交
374 375 376 377 378 379 380 381 382 383 384 385 386
  <define name='capsfchost'>
    <attribute name='type'>
      <value>fc_host</value>
    </attribute>

    <element name='wwnn'>
      <ref name='wwn'/>
    </element>

    <element name='wwpn'>
      <ref name='wwn'/>
    </element>

387 388 389 390 391
    <optional>
      <element name='fabric_wwn'>
        <ref name='wwn'/>
      </element>
    </optional>
O
Osier Yang 已提交
392 393 394 395 396 397
  </define>

  <define name='capsvports'>
    <attribute name='type'>
      <value>vports_ops</value>
    </attribute>
398 399 400 401 402 403
    <element name='max_vports'>
      <ref name='unsignedInt'/>
    </element>
    <element name='vports'>
      <ref name='unsignedInt'/>
    </element>
O
Osier Yang 已提交
404
  </define>
405 406 407 408 409 410 411

  <define name='capscsihost'>
    <attribute name='type'>
      <value>scsi_host</value>
    </attribute>

    <element name='host'>
412
      <ref name='unsignedLong'/>
413
    </element>
O
Osier Yang 已提交
414

J
John Ferlan 已提交
415 416 417 418 419 420
    <optional>
      <element name='unique_id'>
        <ref name='positiveInteger'/>
      </element>
    </optional>

O
Osier Yang 已提交
421 422 423 424 425 426 427 428 429 430
    <optional>
      <zeroOrMore>
        <element name='capability'>
          <choice>
            <ref name='capsfchost'/>
            <ref name='capsvports'/>
          </choice>
        </element>
      </zeroOrMore>
    </optional>
431 432
  </define>

433 434 435 436 437 438 439 440 441 442
  <define name='capscsitarget'>
    <attribute name='type'>
      <value>scsi_target</value>
    </attribute>

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

443 444 445 446 447 448
  <define name='capscsi'>
    <attribute name='type'>
      <value>scsi</value>
    </attribute>

    <element name='host'>
449
      <ref name='unsignedLong'/>
450 451
    </element>
    <element name='bus'>
452
      <ref name='unsignedLong'/>
453 454
    </element>
    <element name='target'>
455
      <ref name='unsignedLong'/>
456 457
    </element>
    <element name='lun'>
458
      <ref name='unsignedLong'/>
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
    </element>

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

  <define name='capstorage'>
    <attribute name='type'>
      <value>storage</value>
    </attribute>

    <element name='block'>
      <ref name='path'/>
    </element>

    <optional>
      <element name='bus'>
477
        <text/>
478 479 480 481
      </element>
    </optional>
    <optional>
      <element name='drive_type'>
482
        <text/>
483 484 485 486
      </element>
    </optional>
    <optional>
      <element name='model'>
487 488
        <text/>
        </element>
489 490 491
    </optional>
    <optional>
      <element name='vendor'>
492
        <text/>
493 494
      </element>
    </optional>
495 496
    <optional>
      <element name='serial'>
497
        <text/>
498 499
      </element>
    </optional>
500 501 502 503 504 505 506 507

    <choice>
      <ref name='capstorageremoveable'/>
      <ref name='capstoragefixed'/>
    </choice>

    <optional>
      <element name='capability'>
508 509 510
        <attribute name='type'>
          <value>hotpluggable</value>
        </attribute>
511 512 513 514 515 516 517
      </element>
    </optional>
  </define>

  <define name='capstorageremoveable'>
    <element name='capability'>
      <attribute name='type'>
518
        <value>removable</value>
519 520
      </attribute>
      <element name='media_available'>
521 522 523 524
        <choice>
          <value>1</value>
          <value>0</value>
        </choice>
525 526 527
      </element>

      <element name='media_size'>
528
        <ref name='unsignedLong'/>
529
      </element>
530 531 532 533 534
      <optional>
        <element name='media_label'>
          <text/>
        </element>
      </optional>
535 536 537 538 539
    </element>
  </define>

  <define name='capstoragefixed'>
    <element name='size'>
540
      <ref name='unsignedLong'/>
541 542 543
    </element>
  </define>

M
Marc-André Lureau 已提交
544 545 546 547 548 549 550 551 552 553 554 555 556
  <define name='capdrm'>
    <attribute name='type'>
      <value>drm</value>
    </attribute>
    <element name='type'>
      <choice>
        <value>primary</value>
        <value>control</value>
        <value>render</value>
      </choice>
    </element>
  </define>

557 558 559 560 561 562 563 564 565
  <define name='address'>
    <element name='address'>
      <attribute name='domain'><ref name='hexuint'/></attribute>
      <attribute name='bus'><ref name='hexuint'/></attribute>
      <attribute name='slot'><ref name='hexuint'/></attribute>
      <attribute name='function'><ref name='hexuint'/></attribute>
    </element>
  </define>

566 567 568 569 570 571 572 573 574 575 576 577 578
  <define name='mac'>
    <data type='string'>
      <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
    </data>
  </define>

  <define name='path'>
    <data type='string'>
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
    </data>
  </define>

</grammar>