nodedev.rng 14.1 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
        <ref name="capmdev"/>
B
Bjoern Walk 已提交
87
        <ref name="capccwdev"/>
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
      </choice>
    </element>
  </define>

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

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

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

      <element name='uuid'>
113
        <ref name='UUID'/>
114 115 116 117 118 119
      </element>
    </element>


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

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

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

    <element name='product'>
      <attribute name='id'>
151
        <ref name='hexuint'/>
152 153 154
      </attribute>

      <choice>
155 156
        <text/>
        <empty/>
157 158 159 160 161
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
162
        <ref name='hexuint'/>
163 164 165
      </attribute>

      <choice>
166 167
        <text/>
        <empty/>
168 169 170
      </choice>
    </element>

171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
    <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>
188 189 190
          <attribute name='maxCount'>
            <ref name='unsignedInt'/>
          </attribute>
191
        </optional>
192 193 194
        <zeroOrMore>
          <ref name='address'/>
        </zeroOrMore>
195 196 197
      </element>
    </optional>

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

209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
    <optional>
      <element name='capability'>
        <attribute name='type'>
          <value>mdev_types</value>
        </attribute>
        <oneOrMore>
          <element name='type'>
            <attribute name='id'>
              <data type='string'/>
            </attribute>
            <optional>
              <element name='name'><text/></element>
            </optional>
            <element name='deviceAPI'>
              <choice>
                <value>vfio-pci</value>
              </choice>
            </element>
            <element name='availableInstances'>
              <ref name='unsignedInt'/>
            </element>
          </element>
        </oneOrMore>
      </element>
   </optional>

235 236 237 238 239 240 241 242 243 244 245
    <optional>
      <element name='iommuGroup'>
        <attribute name='number'>
          <ref name='unsignedInt'/>
        </attribute>
        <oneOrMore>
          <ref name='address'/>
        </oneOrMore>
      </element>
    </optional>

246 247 248 249 250 251 252 253
    <optional>
      <element name='numa'>
        <optional>
          <attribute name='node'>
            <data type='int'/>
          </attribute>
        </optional>
      </element>
254 255
    </optional>

256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
    <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>
285 286 287 288 289 290 291 292
  </define>

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

    <element name='bus'>
293
      <ref name='unsignedLong'/>
294 295
    </element>
    <element name='device'>
296
      <ref name='unsignedLong'/>
297 298 299 300
    </element>

    <element name='product'>
      <attribute name='id'>
301
        <ref name='hexuint'/>
302 303 304
      </attribute>

      <choice>
305 306
        <text/>
        <empty/>
307 308 309 310 311
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
312
        <ref name='hexuint'/>
313 314 315
      </attribute>

      <choice>
316 317
        <text/>
        <empty/>
318 319 320 321 322 323 324 325 326 327
      </choice>
    </element>
  </define>

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

    <element name='number'>
328
      <ref name='unsignedLong'/>
329 330
    </element>
    <element name='class'>
331
      <ref name='unsignedLong'/>
332 333
    </element>
    <element name='subclass'>
334
      <ref name='unsignedLong'/>
335 336
    </element>
    <element name='protocol'>
337
      <ref name='unsignedLong'/>
338 339 340 341
    </element>

    <optional>
      <element name='description'>
342
        <text/>
343 344 345 346 347 348 349 350 351 352 353 354 355 356
      </element>
    </optional>
  </define>

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

    <element name='interface'>
      <text/>
    </element>
    <optional>
      <element name='address'>
357
        <ref name='mac'/>
358 359
      </element>
    </optional>
360
    <ref name="link-speed-state"/>
361

362 363 364 365 366 367 368 369
    <zeroOrMore>
      <element name='feature'>
        <attribute name='name'>
          <ref name='netfeaturename'/>
        </attribute>
      </element>
    </zeroOrMore>

370 371 372 373 374
    <zeroOrMore>
      <ref name='subcapnet'/>
    </zeroOrMore>
  </define>

375 376 377 378 379 380
  <define name='netfeaturename'>
    <data type='string'>
      <param name='pattern'>[a-zA-Z\-_]+</param>
    </data>
  </define>

381 382 383
  <define name='subcapnet'>
    <element name='capability'>
      <choice>
384 385
        <ref name='subcapnet80203'/>
        <ref name='subcapnet80211'/>
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
      </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 已提交
402 403 404 405 406 407 408 409 410 411 412 413 414
  <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>

415 416 417 418 419
    <optional>
      <element name='fabric_wwn'>
        <ref name='wwn'/>
      </element>
    </optional>
O
Osier Yang 已提交
420 421 422 423 424 425
  </define>

  <define name='capsvports'>
    <attribute name='type'>
      <value>vports_ops</value>
    </attribute>
426 427 428 429 430 431
    <element name='max_vports'>
      <ref name='unsignedInt'/>
    </element>
    <element name='vports'>
      <ref name='unsignedInt'/>
    </element>
O
Osier Yang 已提交
432
  </define>
433 434 435 436 437 438 439

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

    <element name='host'>
440
      <ref name='unsignedLong'/>
441
    </element>
O
Osier Yang 已提交
442

J
John Ferlan 已提交
443 444 445 446 447 448
    <optional>
      <element name='unique_id'>
        <ref name='positiveInteger'/>
      </element>
    </optional>

O
Osier Yang 已提交
449 450 451 452 453 454 455 456 457 458
    <optional>
      <zeroOrMore>
        <element name='capability'>
          <choice>
            <ref name='capsfchost'/>
            <ref name='capsvports'/>
          </choice>
        </element>
      </zeroOrMore>
    </optional>
459 460
  </define>

461 462 463 464 465 466 467 468 469 470 471 472 473 474
  <define name='capsfcrport'>
    <attribute name='type'>
      <value>fc_remote_port</value>
    </attribute>

    <element name='rport'>
      <text/>
    </element>

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

475 476 477 478 479 480 481 482
  <define name='capscsitarget'>
    <attribute name='type'>
      <value>scsi_target</value>
    </attribute>

    <element name='target'>
      <text/>
    </element>
483 484 485 486 487 488

    <optional>
      <element name='capability'>
        <ref name='capsfcrport'/>
      </element>
    </optional>
489 490
  </define>

491 492 493 494 495 496
  <define name='capscsi'>
    <attribute name='type'>
      <value>scsi</value>
    </attribute>

    <element name='host'>
497
      <ref name='unsignedLong'/>
498 499
    </element>
    <element name='bus'>
500
      <ref name='unsignedLong'/>
501 502
    </element>
    <element name='target'>
503
      <ref name='unsignedLong'/>
504 505
    </element>
    <element name='lun'>
506
      <ref name='unsignedLong'/>
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
    </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'>
525
        <text/>
526 527 528 529
      </element>
    </optional>
    <optional>
      <element name='drive_type'>
530
        <text/>
531 532 533 534
      </element>
    </optional>
    <optional>
      <element name='model'>
535 536
        <text/>
        </element>
537 538 539
    </optional>
    <optional>
      <element name='vendor'>
540
        <text/>
541 542
      </element>
    </optional>
543 544
    <optional>
      <element name='serial'>
545
        <text/>
546 547
      </element>
    </optional>
548 549 550 551 552 553 554 555

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

    <optional>
      <element name='capability'>
556 557 558
        <attribute name='type'>
          <value>hotpluggable</value>
        </attribute>
559 560 561 562 563 564 565
      </element>
    </optional>
  </define>

  <define name='capstorageremoveable'>
    <element name='capability'>
      <attribute name='type'>
566
        <value>removable</value>
567 568
      </attribute>
      <element name='media_available'>
569 570 571 572
        <choice>
          <value>1</value>
          <value>0</value>
        </choice>
573 574 575
      </element>

      <element name='media_size'>
576
        <ref name='unsignedLong'/>
577
      </element>
578 579 580 581 582
      <optional>
        <element name='media_label'>
          <text/>
        </element>
      </optional>
583 584 585 586 587
    </element>
  </define>

  <define name='capstoragefixed'>
    <element name='size'>
588
      <ref name='unsignedLong'/>
589 590 591
    </element>
  </define>

M
Marc-André Lureau 已提交
592 593 594 595 596 597 598 599 600 601 602 603 604
  <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>

605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
  <define name='capmdev'>
    <attribute name='type'>
      <value>mdev</value>
    </attribute>
    <element name='type'>
      <attribute name='id'>
        <data type='string'/>
      </attribute>
    </element>
    <element name='iommuGroup'>
      <attribute name='number'>
        <ref name='unsignedInt'/>
      </attribute>
    </element>
  </define>

B
Bjoern Walk 已提交
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
  <define name='capccwdev'>
    <attribute name='type'>
      <value>ccw</value>
    </attribute>
    <element name='cssid'>
      <ref name='ccwCssidRange'/>
    </element>
    <element name='ssid'>
      <ref name='ccwSsidRange'/>
    </element>
    <element name='devno'>
      <ref name='ccwDevnoRange'/>
    </element>
  </define>

636 637 638 639 640 641 642 643 644
  <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>

645 646 647 648 649 650 651 652 653 654 655 656 657
  <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>