nodedev.rng 8.8 KB
Newer Older
1 2 3
<!-- 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">
4
  <include href='basictypes.rng'/>
5 6 7 8 9 10 11 12 13 14 15 16 17
  <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>
      <optional>
        <element name="parent"><text/></element>
      </optional>

18 19 20 21 22 23
      <optional>
        <element name="driver">
          <element name="name"><text/></element>
        </element>
      </optional>

24
      <zeroOrMore>
25
        <ref name="capability"/>
26 27 28 29 30 31 32
      </zeroOrMore>
    </element>
  </define>

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

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

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

    <element name='hardware'>
      <optional>
56
        <element name='vendor'><text/></element>
57 58
      </optional>
      <optional>
59
        <element name='version'><text/></element>
60 61
      </optional>
      <optional>
62
        <element name='serial'><text/></element>
63 64 65
      </optional>

      <element name='uuid'>
66
        <ref name='UUID'/>
67 68 69 70 71 72
      </element>
    </element>


    <element name='firmware'>
      <optional>
73
        <element name='vendor'><text/></element>
74 75
      </optional>
      <optional>
76
        <element name='version'><text/></element>
77 78
      </optional>
      <optional>
79
        <element name='release_date'><text/></element>
80 81 82 83 84 85 86 87 88 89
      </optional>
    </element>
  </define>

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

    <element name='domain'>
90
      <ref name='unsignedLong'/>
91 92
    </element>
    <element name='bus'>
93
      <ref name='unsignedLong'/>
94 95
    </element>
    <element name='slot'>
96
      <ref name='unsignedLong'/>
97 98
    </element>
    <element name='function'>
99
      <ref name='unsignedLong'/>
100 101 102 103
    </element>

    <element name='product'>
      <attribute name='id'>
104
        <ref name='hexuint'/>
105 106 107
      </attribute>

      <choice>
108 109
        <text/>
        <empty/>
110 111 112 113 114
      </choice>
    </element>

    <element name='vendor'>
      <attribute name='id'>
115
        <ref name='hexuint'/>
116 117 118
      </attribute>

      <choice>
119 120
        <text/>
        <empty/>
121 122 123
      </choice>
    </element>

124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    <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>

146 147 148 149 150 151 152 153
  </define>

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

    <element name='bus'>
154
      <ref name='unsignedLong'/>
155 156
    </element>
    <element name='device'>
157
      <ref name='unsignedLong'/>
158 159 160 161
    </element>

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

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

    <element name='vendor'>
      <attribute name='id'>
173
        <ref name='hexuint'/>
174 175 176
      </attribute>

      <choice>
177 178
        <text/>
        <empty/>
179 180 181 182 183 184 185 186 187 188
      </choice>
    </element>
  </define>

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

    <element name='number'>
189
      <ref name='unsignedLong'/>
190 191
    </element>
    <element name='class'>
192
      <ref name='unsignedLong'/>
193 194
    </element>
    <element name='subclass'>
195
      <ref name='unsignedLong'/>
196 197
    </element>
    <element name='protocol'>
198
      <ref name='unsignedLong'/>
199 200 201 202
    </element>

    <optional>
      <element name='description'>
203
        <text/>
204 205 206 207 208 209 210 211 212 213 214 215 216 217
      </element>
    </optional>
  </define>

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

    <element name='interface'>
      <text/>
    </element>
    <optional>
      <element name='address'>
218
        <ref name='mac'/>
219 220 221 222 223 224 225 226 227 228 229
      </element>
    </optional>

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

  <define name='subcapnet'>
    <element name='capability'>
      <choice>
230 231
        <ref name='subcapnet80203'/>
        <ref name='subcapnet80211'/>
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
      </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 已提交
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
  <define name='wwn'>
    <data type='string'>
      <param name='pattern'>(0-9a-fA-F){16}</param>
    </data>
  </define>

  <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>
  </define>
277 278 279 280 281 282 283

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

    <element name='host'>
284
      <ref name='unsignedLong'/>
285
    </element>
O
Osier Yang 已提交
286 287 288 289 290 291 292 293 294 295 296

    <optional>
      <zeroOrMore>
        <element name='capability'>
          <choice>
            <ref name='capsfchost'/>
            <ref name='capsvports'/>
          </choice>
        </element>
      </zeroOrMore>
    </optional>
297 298 299 300 301 302 303 304
  </define>

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

    <element name='host'>
305
      <ref name='unsignedLong'/>
306 307
    </element>
    <element name='bus'>
308
      <ref name='unsignedLong'/>
309 310
    </element>
    <element name='target'>
311
      <ref name='unsignedLong'/>
312 313
    </element>
    <element name='lun'>
314
      <ref name='unsignedLong'/>
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
    </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'>
333
        <text/>
334 335 336 337
      </element>
    </optional>
    <optional>
      <element name='drive_type'>
338
        <text/>
339 340 341 342
      </element>
    </optional>
    <optional>
      <element name='model'>
343 344
        <text/>
        </element>
345 346 347
    </optional>
    <optional>
      <element name='vendor'>
348
        <text/>
349 350
      </element>
    </optional>
351 352
    <optional>
      <element name='serial'>
353
        <text/>
354 355
      </element>
    </optional>
356 357 358 359 360 361 362 363

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

    <optional>
      <element name='capability'>
364 365 366
        <attribute name='type'>
          <value>hotpluggable</value>
        </attribute>
367 368 369 370 371 372 373
      </element>
    </optional>
  </define>

  <define name='capstorageremoveable'>
    <element name='capability'>
      <attribute name='type'>
374
        <value>removable</value>
375 376
      </attribute>
      <element name='media_available'>
377 378 379 380
        <choice>
          <value>1</value>
          <value>0</value>
        </choice>
381 382 383
      </element>

      <element name='media_size'>
384
        <ref name='unsignedLong'/>
385
      </element>
386 387 388 389 390
      <optional>
        <element name='media_label'>
          <text/>
        </element>
      </optional>
391 392 393 394 395
    </element>
  </define>

  <define name='capstoragefixed'>
    <element name='size'>
396
      <ref name='unsignedLong'/>
397 398 399
    </element>
  </define>

400 401 402 403 404 405 406 407 408
  <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>

409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
  <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>