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
    <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'>
M
Michal Privoznik 已提交
223
              <value>vfio-pci</value>
224 225 226 227 228 229 230 231 232
            </element>
            <element name='availableInstances'>
              <ref name='unsignedInt'/>
            </element>
          </element>
        </oneOrMore>
      </element>
   </optional>

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

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

254 255 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
    <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>
283 284 285 286 287 288 289 290
  </define>

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

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

    <element name='product'>
      <attribute name='id'>
299
        <ref name='hexuint'/>
300 301 302
      </attribute>

      <choice>
303 304
        <text/>
        <empty/>
305 306 307 308 309
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
310
        <ref name='hexuint'/>
311 312 313
      </attribute>

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

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

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

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

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

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

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

368 369 370 371 372
    <zeroOrMore>
      <ref name='subcapnet'/>
    </zeroOrMore>
  </define>

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

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

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

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

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

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

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

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

459 460 461 462 463 464 465 466 467 468 469 470 471 472
  <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>

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

    <element name='target'>
      <text/>
    </element>
481 482 483 484 485 486

    <optional>
      <element name='capability'>
        <ref name='capsfcrport'/>
      </element>
    </optional>
487 488
  </define>

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

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

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

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

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

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

  <define name='capstoragefixed'>
    <element name='size'>
586
      <ref name='unsignedLong'/>
587 588 589
    </element>
  </define>

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

603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
  <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 已提交
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
  <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>

634 635 636 637 638 639 640 641 642
  <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>

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