nodedev.rng 10.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
      <optional>
        <element name="parent"><text/></element>
      </optional>

22 23 24 25 26 27
      <optional>
        <element name="driver">
          <element name="name"><text/></element>
        </element>
      </optional>

28
      <zeroOrMore>
29
        <ref name="capability"/>
30 31 32 33 34 35 36
      </zeroOrMore>
    </element>
  </define>

  <define name='capability'>
    <element name="capability">
      <choice>
37 38 39 40 41 42 43 44
        <ref name="capsystem"/>
        <ref name="cappcidev"/>
        <ref name="capusbdev"/>
        <ref name="capusbinterface"/>
        <ref name="capnet"/>
        <ref name="capscsihost"/>
        <ref name="capscsi"/>
        <ref name="capstorage"/>
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
      </choice>
    </element>
  </define>

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

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

    <element name='hardware'>
      <optional>
60
        <element name='vendor'><text/></element>
61 62
      </optional>
      <optional>
63
        <element name='version'><text/></element>
64 65
      </optional>
      <optional>
66
        <element name='serial'><text/></element>
67 68 69
      </optional>

      <element name='uuid'>
70
        <ref name='UUID'/>
71 72 73 74 75 76
      </element>
    </element>


    <element name='firmware'>
      <optional>
77
        <element name='vendor'><text/></element>
78 79
      </optional>
      <optional>
80
        <element name='version'><text/></element>
81 82
      </optional>
      <optional>
83
        <element name='release_date'><text/></element>
84 85 86 87 88 89 90 91 92 93
      </optional>
    </element>
  </define>

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

    <element name='domain'>
94
      <ref name='unsignedLong'/>
95 96
    </element>
    <element name='bus'>
97
      <ref name='unsignedLong'/>
98 99
    </element>
    <element name='slot'>
100
      <ref name='unsignedLong'/>
101 102
    </element>
    <element name='function'>
103
      <ref name='unsignedLong'/>
104 105 106 107
    </element>

    <element name='product'>
      <attribute name='id'>
108
        <ref name='hexuint'/>
109 110 111
      </attribute>

      <choice>
112 113
        <text/>
        <empty/>
114 115 116 117 118
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
119
        <ref name='hexuint'/>
120 121 122
      </attribute>

      <choice>
123 124
        <text/>
        <empty/>
125 126 127
      </choice>
    </element>

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    <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>
          <ref name='address'/>
        </optional>
      </element>
    </optional>

150 151 152 153 154 155 156 157 158 159 160
    <optional>
      <element name='iommuGroup'>
        <attribute name='number'>
          <ref name='unsignedInt'/>
        </attribute>
        <oneOrMore>
          <ref name='address'/>
        </oneOrMore>
      </element>
    </optional>

161 162 163 164 165 166 167 168 169 170
    <optional>
      <element name='numa'>
        <optional>
          <attribute name='node'>
            <data type='int'/>
          </attribute>
        </optional>
      </element>
    </optional>

171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
    <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>
200 201 202 203 204 205 206 207
  </define>

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

    <element name='bus'>
208
      <ref name='unsignedLong'/>
209 210
    </element>
    <element name='device'>
211
      <ref name='unsignedLong'/>
212 213 214 215
    </element>

    <element name='product'>
      <attribute name='id'>
216
        <ref name='hexuint'/>
217 218 219
      </attribute>

      <choice>
220 221
        <text/>
        <empty/>
222 223 224 225 226
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
227
        <ref name='hexuint'/>
228 229 230
      </attribute>

      <choice>
231 232
        <text/>
        <empty/>
233 234 235 236 237 238 239 240 241 242
      </choice>
    </element>
  </define>

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

    <element name='number'>
243
      <ref name='unsignedLong'/>
244 245
    </element>
    <element name='class'>
246
      <ref name='unsignedLong'/>
247 248
    </element>
    <element name='subclass'>
249
      <ref name='unsignedLong'/>
250 251
    </element>
    <element name='protocol'>
252
      <ref name='unsignedLong'/>
253 254 255 256
    </element>

    <optional>
      <element name='description'>
257
        <text/>
258 259 260 261 262 263 264 265 266 267 268 269 270 271
      </element>
    </optional>
  </define>

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

    <element name='interface'>
      <text/>
    </element>
    <optional>
      <element name='address'>
272
        <ref name='mac'/>
273 274
      </element>
    </optional>
275
    <ref name="link-speed-state"/>
276 277 278 279 280 281 282 283 284

    <zeroOrMore>
      <ref name='subcapnet'/>
    </zeroOrMore>
  </define>

  <define name='subcapnet'>
    <element name='capability'>
      <choice>
285 286
        <ref name='subcapnet80203'/>
        <ref name='subcapnet80211'/>
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
      </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 已提交
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
  <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>

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

  <define name='capsvports'>
    <attribute name='type'>
      <value>vports_ops</value>
    </attribute>
325 326 327 328 329 330
    <element name='max_vports'>
      <ref name='unsignedInt'/>
    </element>
    <element name='vports'>
      <ref name='unsignedInt'/>
    </element>
O
Osier Yang 已提交
331
  </define>
332 333 334 335 336 337 338

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

    <element name='host'>
339
      <ref name='unsignedLong'/>
340
    </element>
O
Osier Yang 已提交
341 342 343 344 345 346 347 348 349 350 351

    <optional>
      <zeroOrMore>
        <element name='capability'>
          <choice>
            <ref name='capsfchost'/>
            <ref name='capsvports'/>
          </choice>
        </element>
      </zeroOrMore>
    </optional>
352 353 354 355 356 357 358 359
  </define>

  <define name='capscsi'>
    <attribute name='type'>
      <value>scsi</value>
    </attribute>

    <element name='host'>
360
      <ref name='unsignedLong'/>
361 362
    </element>
    <element name='bus'>
363
      <ref name='unsignedLong'/>
364 365
    </element>
    <element name='target'>
366
      <ref name='unsignedLong'/>
367 368
    </element>
    <element name='lun'>
369
      <ref name='unsignedLong'/>
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
    </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'>
388
        <text/>
389 390 391 392
      </element>
    </optional>
    <optional>
      <element name='drive_type'>
393
        <text/>
394 395 396 397
      </element>
    </optional>
    <optional>
      <element name='model'>
398 399
        <text/>
        </element>
400 401 402
    </optional>
    <optional>
      <element name='vendor'>
403
        <text/>
404 405
      </element>
    </optional>
406 407
    <optional>
      <element name='serial'>
408
        <text/>
409 410
      </element>
    </optional>
411 412 413 414 415 416 417 418

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

    <optional>
      <element name='capability'>
419 420 421
        <attribute name='type'>
          <value>hotpluggable</value>
        </attribute>
422 423 424 425 426 427 428
      </element>
    </optional>
  </define>

  <define name='capstorageremoveable'>
    <element name='capability'>
      <attribute name='type'>
429
        <value>removable</value>
430 431
      </attribute>
      <element name='media_available'>
432 433 434 435
        <choice>
          <value>1</value>
          <value>0</value>
        </choice>
436 437 438
      </element>

      <element name='media_size'>
439
        <ref name='unsignedLong'/>
440
      </element>
441 442 443 444 445
      <optional>
        <element name='media_label'>
          <text/>
        </element>
      </optional>
446 447 448 449 450
    </element>
  </define>

  <define name='capstoragefixed'>
    <element name='size'>
451
      <ref name='unsignedLong'/>
452 453 454
    </element>
  </define>

455 456 457 458 459 460 461 462 463
  <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>

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
  <define name='hexuint'>
    <data type='string'>
      <param name="pattern">(0x)?[0-9a-f]+</param>
    </data>
  </define>

  <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>