domain.rng 33.1 KB
Newer Older
1 2
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3 4
  <!-- We handle only document defining a domain -->
  <start>
5
    <ref name="domain"/>
6
  </start>
7 8

  <include href='storageencryption.rng'/>
9 10 11 12 13 14 15 16 17 18

  <!--
    description element, maybe placed anywhere under the root
    -->
  <define name="description">
    <element name="description">
      <text/>
    </element>
  </define>

19
  <!--
20
      We handle only document defining a domain
21
    -->
22
  <define name="domain">
23
    <element name="domain">
24 25
      <ref name="hvs"/>
      <ref name="ids"/>
26
      <interleave>
27 28 29
        <optional>
          <ref name="description"/>
        </optional>
30 31 32 33 34 35 36 37 38 39 40
        <ref name="os"/>
        <ref name="clock"/>
        <ref name="resources"/>
        <ref name="features"/>
        <ref name="termination"/>
        <optional>
          <ref name="devices"/>
        </optional>
        <optional>
          <ref name="seclabel"/>
        </optional>
41
      </interleave>
42
    </element>
43
  </define>
44 45 46 47
  <define name="seclabel">
    <element name="seclabel">
      <attribute name="model">
        <text/>
48
      </attribute>
49
      <attribute name="type">
50 51 52 53 54
        <choice>
          <value>dynamic</value>
          <value>static</value>
        </choice>
      </attribute>
55 56
      <element name="label">
        <text/>
57 58 59
      </element>
    </element>
  </define>
60 61
  <define name="hvs">
    <attribute name="type">
62
      <choice>
63 64 65 66 67 68 69
        <value>xen</value>
        <value>kvm</value>
        <value>kqemu</value>
        <value>qemu</value>
        <value>lxc</value>
        <value>openvz</value>
        <value>test</value>
70 71 72
      </choice>
    </attribute>
  </define>
73
  <define name="os">
74
    <choice>
75 76 77
      <ref name="osxen"/>
      <ref name="oshvm"/>
      <ref name="osexe"/>
78 79
    </choice>
  </define>
80
  <define name="osxen">
81 82
    <choice>
      <group>
83 84 85 86 87 88 89
        <optional>
          <ref name="bootloader"/>
        </optional>
        <element name="os">
          <ref name="ostypexen"/>
          <ref name="osbootkernel"/>
        </element>
90 91
      </group>
      <group>
92 93 94 95 96 97 98 99 100
        <ref name="bootloader"/>
        <optional>
          <element name="os">
            <ref name="ostypexen"/>
            <optional>
              <ref name="osbootkernel"/>
            </optional>
          </element>
        </optional>
101 102 103
      </group>
    </choice>
  </define>
104 105 106
  <define name="oshvm">
    <element name="os">
      <ref name="ostypehvm"/>
107
      <interleave>
108 109 110 111 112 113 114 115 116
        <optional>
          <element name="loader">
            <ref name="absFilePath"/>
          </element>
        </optional>
        <choice>
          <ref name="osbootkernel"/>
          <ref name="osbootdev"/>
        </choice>
117
      </interleave>
118 119
    </element>
  </define>
120 121
  <define name="ostypexen">
    <element name="type">
122
      <optional>
123 124 125 126 127 128 129
        <attribute name="arch">
          <choice>
            <value>i686</value>
            <value>x86_64</value>
            <value>ia64</value>
          </choice>
        </attribute>
130 131
      </optional>
      <optional>
132 133 134 135 136 137
        <attribute name="machine">
          <choice>
            <value>xenpv</value>
            <value>xenner</value>
          </choice>
        </attribute>
138 139
      </optional>
      <choice>
140 141
        <value>xen</value>
        <value>linux</value>
142 143 144
      </choice>
    </element>
  </define>
145 146
  <define name="ostypehvm">
    <element name="type">
147
      <optional>
148 149 150 151 152 153
        <choice>
          <ref name="hvmx86"/>
          <ref name="hvmmips"/>
          <ref name="hvmsparc"/>
          <ref name="hvmppc"/>
        </choice>
154 155 156
      </optional>
      <value>hvm</value>
    </element>
157
  </define>
158
  <define name="hvmx86">
159
    <group>
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
      <optional>
        <attribute name="arch">
          <choice>
            <value>i686</value>
            <value>x86_64</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <choice>
            <value>xenfv</value>
            <value>pc</value>
            <value>isapc</value>
          </choice>
        </attribute>
        </optional>
177 178
    </group>
  </define>
179
  <define name="hvmmips">
180
    <group>
181 182 183 184 185 186 187 188 189 190
      <optional>
        <attribute name="arch">
          <value>mips</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <value>mips</value>
        </attribute>
      </optional>
191 192
    </group>
  </define>
193
  <define name="hvmsparc">
194
    <group>
195 196 197 198 199 200 201 202 203 204
      <optional>
        <attribute name="arch">
          <value>sparc</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <value>sun4m</value>
        </attribute>
      </optional>
205 206
    </group>
  </define>
207
  <define name="hvmppc">
208
    <group>
209 210 211 212 213 214 215 216 217 218 219 220 221 222
      <optional>
        <attribute name="arch">
          <value>ppc</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <choice>
            <value>g3beige</value>
            <value>mac99</value>
            <value>prep</value>
          </choice>
        </attribute>
      </optional>
223 224
    </group>
  </define>
225 226 227 228
  <define name="osexe">
    <element name="os">
      <element name="type">
        <value>exe</value>
229 230
      </element>
      <interleave>
231 232 233 234 235
        <optional>
          <element name="init">
            <ref name="absFilePath"/>
          </element>
        </optional>
236 237 238
      </interleave>
    </element>
  </define>
239
  <!--
240 241 242 243 244
      The Identifiers can be:
      - an optional id attribute with a number on the domain element
      - a mandatory name
      - an optional uuid
    -->
245
  <define name="ids">
246
    <optional>
247 248
      <attribute name="id">
        <ref name="unsignedInt"/>
249 250 251 252
      </attribute>
    </optional>
    <interleave>
      <element name="name">
253
        <ref name="domainName"/>
254 255 256
      </element>
      <optional>
        <element name="uuid">
257
          <ref name="UUID"/>
258 259 260 261 262 263 264
        </element>
      </optional>
    </interleave>
  </define>
  <!--
      Resources usage defines the amount of memory (maximum and possibly
      current usage) and number of virtual CPUs used by that domain.
265
      We can't check here the rule that currentMemory <= memory
266
    -->
267
  <define name="resources">
268
    <interleave>
269 270
      <element name="memory">
        <ref name="memoryKB"/>
271
      </element>
272
      <optional>
273 274
        <element name="currentMemory">
          <ref name="memoryKB"/>
275 276
        </element>
      </optional>
277
      <optional>
R
Richard Jones 已提交
278 279 280 281 282 283 284
        <element name="memoryBacking">
          <optional>
            <element name="hugepages">
              <empty/>
            </element>
          </optional>
        </element>
285
      </optional>
286
      <optional>
287
        <element name="vcpu">
288
          <optional>
289
            <attribute name="cpuset"/>
290
          </optional>
291
          <ref name="countCPU"/>
292 293
        </element>
      </optional>
294 295
    </interleave>
  </define>
296
  <define name="clock">
297
    <optional>
298 299
      <element name="clock">
        <attribute name="offset">
300 301 302 303 304 305 306 307 308
          <choice>
            <value>localtime</value>
            <value>utc</value>
          </choice>
        </attribute>
        <empty/>
      </element>
    </optional>
  </define>
309 310 311 312 313
  <!--
      A bootloader may be used to extract the OS information instead of
      defining the OS parameter in the instance. It points just to the
      binary or script used to extract the data from the first disk device.
    -->
314
  <define name="bootloader">
315
    <interleave>
316 317 318 319 320
      <element name="bootloader">
        <choice>
          <ref name="absFilePath"/>
          <empty/>
        </choice>
321 322
      </element>
      <optional>
323 324 325
        <element name="bootloader_args">
          <text/>
        </element>
326 327
      </optional>
    </interleave>
328
  </define>
329
  <define name="osbootkernel">
330
    <interleave>
331 332
      <element name="kernel">
        <ref name="absFilePath"/>
333 334
      </element>
      <optional>
335 336 337
        <element name="initrd">
          <ref name="absFilePath"/>
        </element>
338
      </optional>
339
      <optional>
340 341
        <element name="root">
          <ref name="devicePath"/>
342 343
        </element>
      </optional>
344
      <optional>
345 346 347
        <element name="cmdline">
          <text/>
        </element>
348 349 350
      </optional>
    </interleave>
  </define>
351 352 353
  <define name="osbootdev">
    <element name="boot">
      <attribute name="dev">
354 355 356 357 358 359 360 361
        <choice>
          <value>hd</value>
          <value>fd</value>
          <value>cdrom</value>
          <value>network</value>
        </choice>
      </attribute>
      <empty/>
362
    </element>
363
  </define>
364
  <define name="diskspec">
365
    <optional>
366
      <ref name="driver"/>
367
    </optional>
368
    <ref name="target"/>
369
    <optional>
370
      <element name="readonly">
371
        <empty/>
372
      </element>
373 374
    </optional>
    <optional>
375
      <element name="shareable">
376 377 378
        <empty/>
      </element>
    </optional>
379 380 381 382 383
    <optional>
      <element name="serial">
        <ref name="diskSerial"/>
      </element>
    </optional>
384 385 386
    <optional>
      <ref name="encryption"/>
    </optional>
387 388 389 390 391 392
  </define>
  <!--
      A disk description can be either of type file or block
      The name of the attribute on the source element depends on the type

    -->
393 394
  <define name="disk">
    <element name="disk">
395
      <optional>
396 397 398 399 400 401 402
        <attribute name="device">
          <choice>
            <value>floppy</value>
            <value>disk</value>
            <value>cdrom</value>
          </choice>
        </attribute>
403
      </optional>
404 405
      <choice>
        <group>
406 407
          <attribute name="type">
            <value>file</value>
408
          </attribute>
409 410 411 412 413 414 415 416 417 418 419
          <interleave>
            <optional>
              <element name="source">
                <attribute name="file">
                  <ref name="absFilePath"/>
                </attribute>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
420 421
        </group>
        <group>
422 423 424 425 426 427 428 429 430 431 432 433 434 435
          <attribute name="type">
            <value>block</value>
          </attribute>
          <interleave>
            <optional>
              <element name="source">
                <attribute name="dev">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
436
        </group>
437
        <ref name="diskspec"/>
438 439 440
      </choice>
    </element>
  </define>
441 442 443 444
  <define name="target">
    <element name="target">
      <attribute name="dev">
        <ref name="deviceName"/>
445
      </attribute>
446
      <optional>
447 448 449 450 451 452 453 454 455 456 457
        <attribute name="bus">
          <choice>
            <value>ide</value>
            <value>fdc</value>
            <value>scsi</value>
            <value>virtio</value>
            <value>xen</value>
            <value>usb</value>
            <value>uml</value>
          </choice>
        </attribute>
458
      </optional>
459 460 461
    </element>
  </define>
  <!--
462
      Disk may use a special driver for access. Currently this is
463 464 465
      only defined for Xen for tap/aio and file, but will certainly be
      extended in the future, and libvirt doesn't look for specific values.
    -->
466 467
  <define name="driver">
    <element name="driver">
468
      <choice>
469 470 471 472 473 474 475 476 477 478 479 480
        <group>
          <ref name="driverFormat"/>
          <optional>
            <ref name="driverCache"/>
          </optional>
        </group>
        <group>
          <optional>
            <ref name="driverFormat"/>
          </optional>
          <ref name="driverCache"/>
        </group>
481
      </choice>
482 483
      <empty/>
    </element>
484
  </define>
485 486 487
  <define name="driverFormat">
    <attribute name="name">
      <ref name="genericName"/>
488 489
    </attribute>
    <optional>
490 491
      <attribute name="type">
        <ref name="genericName"/>
492 493 494
      </attribute>
    </optional>
  </define>
495 496
  <define name="driverCache">
    <attribute name="cache">
497
      <choice>
498 499 500
        <value>none</value>
        <value>writeback</value>
        <value>writethrough</value>
501 502 503
      </choice>
    </attribute>
  </define>
504 505
  <define name="filesystem">
    <element name="filesystem">
506 507
      <choice>
        <group>
508 509
          <attribute name="type">
            <value>file</value>
510
          </attribute>
511 512 513 514 515 516 517 518 519
          <interleave>
            <element name="source">
              <attribute name="file">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
520 521
        </group>
        <group>
522 523 524 525 526 527 528 529 530 531 532 533
          <attribute name="type">
            <value>block</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dev">
                <ref name="deviceName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
534 535
        </group>
        <group>
536 537 538 539 540 541 542 543 544 545 546 547
          <attribute name="type">
            <value>mount</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dir">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
548 549
        </group>
        <group>
550 551 552 553 554 555 556 557 558 559 560 561
          <attribute name="type">
            <value>template</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="name">
                <ref name="genericName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
562 563 564 565
        </group>
      </choice>
    </element>
  </define>
566 567 568 569
  <define name="filesystemtgt">
    <element name="target">
      <attribute name="dir">
        <ref name="absDirPath"/>
570 571 572 573
      </attribute>
      <empty/>
    </element>
  </define>
574
  <!--
575 576 577
      An interface description can either be of type bridge in which case
      it will use a bridging source, or of type ethernet which uses a device
      source and a device target instead. They both share a set of interface
578
      options. FIXME
579
    -->
580 581
  <define name="interface">
    <element name="interface">
582 583
      <choice>
        <group>
584
          <attribute name="type">
585 586
            <value>bridge</value>
          </attribute>
587
          <interleave>
588
            <optional>
589 590 591 592 593 594
              <element name="source">
                <attribute name="bridge">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
595
            </optional>
596 597 598
            <ref name="interface-options"/>
          </interleave>
        </group>
599
        <group>
600
          <attribute name="type">
601 602
            <value>ethernet</value>
          </attribute>
603
          <interleave>
604
            <optional>
605 606 607 608 609 610
              <element name="source">
                <attribute name="dev">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
611
            </optional>
612 613 614
            <ref name="interface-options"/>
          </interleave>
        </group>
615
        <group>
616
          <attribute name="type">
617 618
            <value>network</value>
          </attribute>
619 620 621 622 623 624 625 626 627 628
          <interleave>
            <element name="source">
              <attribute name="network">
                <ref name="deviceName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="interface-options"/>
          </interleave>
        </group>
629
        <group>
630
          <attribute name="type">
631 632
            <value>user</value>
          </attribute>
633 634 635 636
          <interleave>
            <ref name="interface-options"/>
          </interleave>
        </group>
D
Daniel Veillard 已提交
637 638 639 640 641 642 643 644 645 646 647 648 649 650
        <group>
          <attribute name="type">
            <value>internal</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="name">
                <ref name="deviceName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="interface-options"/>
          </interleave>
        </group>
651 652 653 654 655 656
      </choice>
    </element>
  </define>
  <!--
      The interface options possible are:
        - the MAC address
657 658 659
        - the IP address bound to the interface
        - the name of the script used to set up the binding
        - the target device used
660
    -->
661
  <define name="interface-options">
662 663
    <interleave>
      <optional>
664 665 666 667 668 669
        <element name="target">
          <attribute name="dev">
            <ref name="deviceName"/>
          </attribute>
          <empty/>
        </element>
670 671
      </optional>
      <optional>
672 673 674 675 676 677
        <element name="mac">
          <attribute name="address">
            <ref name="addrMAC"/>
          </attribute>
          <empty/>
        </element>
678 679
      </optional>
      <optional>
680 681 682 683 684 685
        <element name="ip">
          <attribute name="address">
            <ref name="addrIP"/>
          </attribute>
          <empty/>
        </element>
686 687
      </optional>
      <optional>
688 689 690 691 692 693
        <element name="script">
          <attribute name="path">
            <ref name="filePath"/>
          </attribute>
          <empty/>
        </element>
694 695
      </optional>
      <optional>
696 697 698 699
        <element name="model">
          <attribute name="type"/>
          <empty/>
        </element>
700 701
      </optional>
    </interleave>
702 703
  </define>
  <!--
704
      An emulator description is just a path to the binary used for the task
705
    -->
706 707 708
  <define name="emulator">
    <element name="emulator">
      <ref name="absFilePath"/>
709 710 711
    </element>
  </define>
  <!--
712
      A graphic description, currently in Xen only 2 types are supported:
713
        - sdl with optional display, xauth and fullscreen
714
        - vnc with a required port and optional listen IP address, password
715
          and keymap
716
    -->
717 718
  <define name="graphic">
    <element name="graphics">
719
      <choice>
720 721 722 723 724 725 726 727 728
        <group>
          <attribute name="type">
            <value>sdl</value>
          </attribute>
          <optional>
            <attribute name="display">
              <text/>
            </attribute>
          </optional>
729
          <optional>
730
            <attribute name="xauth">
731 732 733
              <text/>
            </attribute>
          </optional>
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
          <optional>
            <attribute name="fullscreen">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
        </group>
        <group>
          <attribute name="type">
            <value>vnc</value>
          </attribute>
          <optional>
            <attribute name="port">
              <ref name="PortNumber"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="autoport">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
          <optional>
            <attribute name="listen">
              <ref name="addrIP"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="passwd">
              <text/>
            </attribute>
          </optional>
          <optional>
            <attribute name="keymap">
              <text/>
            </attribute>
          </optional>
        </group>
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
        <group>
          <attribute name="type">
            <value>rdp</value>
          </attribute>
          <optional>
            <attribute name="port">
              <ref name="PortNumber"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="autoport">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
          <optional>
            <attribute name="replaceUser">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
          <optional>
            <attribute name="multiUser">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
          <optional>
            <attribute name="listen">
              <ref name="addrIP"/>
            </attribute>
          </optional>
        </group>
        <group>
          <attribute name="type">
            <value>desktop</value>
          </attribute>
          <optional>
            <attribute name="display">
              <text/>
            </attribute>
          </optional>
          <optional>
            <attribute name="fullscreen">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
        </group>
833 834 835
      </choice>
    </element>
  </define>
836 837 838 839 840 841 842 843 844
  <!--
     A graphic description, currently in Xen only 2 types are supported:
       - sdl with optional display, xauth and fullscreen
       - vnc with a required port and optional listen IP address, password
         and keymap
   -->
  <define name="video">
    <element name="video">
      <optional>
R
Richard Jones 已提交
845
        <element name="model">
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
          <attribute name="type">
            <choice>
              <value>vga</value>
              <value>cirrus</value>
              <value>vmvga</value>
              <value>xen</value>
              <value>vbox</value>
            </choice>
          </attribute>
          <optional>
            <attribute name="vram">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="heads">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884
          <optional>
            <element name="acceleration">
              <optional>
                <attribute name="accel3d">
                  <choice>
                    <value>yes</value>
                    <value>no</value>
                  </choice>
                </attribute>
              </optional>
              <optional>
                <attribute name="accel2d">
                  <choice>
                    <value>yes</value>
                    <value>no</value>
                  </choice>
                </attribute>
              </optional>
            </element>
          </optional>
R
Richard Jones 已提交
885
        </element>
886 887 888
      </optional>
    </element>
  </define>
889 890 891 892
  <!--
      When a domain terminates multiple policies can be applied depending
      on how it ended:
    -->
893
  <define name="termination">
894 895
    <interleave>
      <optional>
896 897 898
        <element name="on_reboot">
          <ref name="offOptions"/>
        </element>
899 900
      </optional>
      <optional>
901 902 903
        <element name="on_poweroff">
          <ref name="offOptions"/>
        </element>
904 905
      </optional>
      <optional>
906 907 908
        <element name="on_crash">
          <ref name="offOptions"/>
        </element>
909 910 911 912 913 914 915 916 917 918 919
      </optional>
    </interleave>
  </define>
  <!--
      Options when a domain terminates:
      destroy: The domain is cleaned up
      restart: A new domain is started in place of the old one
      preserve: The domain will remain in memory until it is destroyed manually
      rename-restart: a variant of the previous one but where the old domain is
                      renamed before being saved to allow a restart
    -->
920
  <define name="offOptions">
921 922 923 924 925 926 927
    <choice>
      <value>destroy</value>
      <value>restart</value>
      <value>preserve</value>
      <value>rename-restart</value>
    </choice>
  </define>
928 929 930 931
  <!--
      Specific setup for a qemu emulated character device.  Note: this
      definition doesn't fully specify the constraints on this node.
    -->
932 933
  <define name="qemucdev">
    <attribute name="type">
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949
      <choice>
        <value>dev</value>
        <value>file</value>
        <value>pipe</value>
        <value>unix</value>
        <value>tcp</value>
        <value>udp</value>
        <value>null</value>
        <value>stdio</value>
        <value>vc</value>
        <value>pty</value>
      </choice>
    </attribute>
    <interleave>
      <optional>
        <oneOrMore>
950
          <element name="source">
951
            <optional>
952
              <attribute name="mode"/>
953 954
            </optional>
            <optional>
955
              <attribute name="path"/>
956 957
            </optional>
            <optional>
958
              <attribute name="host"/>
959 960
            </optional>
            <optional>
961
              <attribute name="service"/>
962 963
            </optional>
            <optional>
964
              <attribute name="wiremode"/>
965 966 967 968 969
            </optional>
          </element>
        </oneOrMore>
      </optional>
      <optional>
970
        <element name="protocol">
971
          <optional>
972
            <attribute name="type"/>
973 974 975 976
          </optional>
        </element>
      </optional>
      <optional>
977
        <element name="target">
978
          <optional>
979
            <attribute name="port"/>
980 981 982 983 984
          </optional>
        </element>
      </optional>
    </interleave>
  </define>
985 986 987 988
  <!--
      The description for a console
      just a tty device
    -->
989 990
  <define name="console">
    <element name="console">
991 992 993
      <choice>
        <group>
          <optional>
994 995
            <attribute name="tty">
              <ref name="devicePath"/>
996 997 998 999
            </attribute>
          </optional>
          <empty/>
        </group>
1000
        <ref name="qemucdev"/>
1001 1002 1003
      </choice>
    </element>
  </define>
1004 1005 1006
  <define name="sound">
    <element name="sound">
      <attribute name="model">
1007 1008 1009 1010
        <choice>
          <value>sb16</value>
          <value>es1370</value>
          <value>pcspk</value>
1011
          <value>ac97</value>
1012
        </choice>
1013 1014 1015
      </attribute>
    </element>
  </define>
R
Richard Jones 已提交
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
  <define name="watchdog">
    <element name="watchdog">
      <attribute name="model">
        <choice>
          <value>i6300esb</value>
          <value>ib700</value>
        </choice>
      </attribute>
      <optional>
        <attribute name="action">
          <choice>
            <value>reset</value>
            <value>shutdown</value>
            <value>poweroff</value>
            <value>pause</value>
            <value>none</value>
          </choice>
        </attribute>
      </optional>
    </element>
  </define>
1037 1038 1039
  <define name="parallel">
    <element name="parallel">
      <ref name="qemucdev"/>
1040 1041
    </element>
  </define>
1042 1043 1044
  <define name="serial">
    <element name="serial">
      <ref name="qemucdev"/>
1045 1046
    </element>
  </define>
1047 1048 1049
  <define name="input">
    <element name="input">
      <attribute name="type">
1050 1051 1052 1053 1054 1055
        <choice>
          <value>tablet</value>
          <value>mouse</value>
        </choice>
      </attribute>
      <optional>
1056
        <attribute name="bus">
1057 1058 1059 1060 1061 1062 1063
          <choice>
            <value>ps2</value>
            <value>usb</value>
            <value>xen</value>
          </choice>
        </attribute>
      </optional>
1064 1065
    </element>
  </define>
1066 1067
  <define name="hostdev">
    <element name="hostdev">
1068
      <optional>
1069
        <attribute name="mode">
1070
          <choice>
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084
            <value>subsystem</value>
            <value>capabilities</value>
          </choice>
        </attribute>
        <attribute name="type">
          <choice>
            <value>usb</value>
            <value>pci</value>
          </choice>
        </attribute>
        <attribute name="managed">
          <choice>
            <value>yes</value>
            <value>no</value>
1085 1086 1087 1088
          </choice>
        </attribute>
      </optional>
      <group>
1089 1090 1091 1092 1093 1094 1095
        <element name="source">
          <choice>
            <ref name="usbproduct"/>
            <ref name="usbaddress"/>
            <ref name="pciaddress"/>
          </choice>
        </element>
1096 1097 1098 1099 1100 1101
      </group>
    </element>
  </define>
  <define name="usbproduct">
    <element name="vendor">
      <attribute name="id">
1102
        <ref name="usbId"/>
1103 1104 1105 1106
      </attribute>
    </element>
    <element name="product">
      <attribute name="id">
1107
        <ref name="usbId"/>
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
      </attribute>
    </element>
  </define>
  <define name="usbaddress">
    <element name="address">
      <attribute name="bus">
        <ref name="usbAddr"/>
      </attribute>
      <attribute name="device">
        <ref name="usbAddr"/>
      </attribute>
    </element>
  </define>
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
  <define name="pciaddress">
    <element name="address">
      <optional>
        <attribute name="domain">
          <ref name="pciDomain"/>
        </attribute>
      </optional>
      <attribute name="bus">
        <ref name="pciBus"/>
      </attribute>
      <attribute name="slot">
        <ref name="pciSlot"/>
      </attribute>
      <attribute name="function">
        <ref name="pciFunc"/>
      </attribute>
    </element>
  </define>
1139
  <!--
1140
      Devices attached to a domain.
1141
    -->
1142 1143
  <define name="devices">
    <element name="devices">
1144
      <interleave>
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156
        <optional>
          <ref name="emulator"/>
        </optional>
        <zeroOrMore>
          <choice>
            <ref name="disk"/>
            <ref name="filesystem"/>
            <ref name="interface"/>
            <ref name="input"/>
            <ref name="sound"/>
            <ref name="hostdev"/>
            <ref name="graphic"/>
1157
            <ref name="video"/>
1158 1159 1160 1161 1162
            <ref name="console"/>
            <ref name="parallel"/>
            <ref name="serial"/>
          </choice>
        </zeroOrMore>
R
Richard Jones 已提交
1163 1164 1165
        <optional>
          <ref name="watchdog"/>
        </optional>
1166 1167 1168
      </interleave>
    </element>
  </define>
1169 1170 1171
  <!--
      A set of optional features: PAE, APIC and ACPI support
    -->
1172
  <define name="features">
1173 1174 1175
    <optional>
      <element name="features">
        <interleave>
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191
          <optional>
            <element name="pae">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="apic">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="acpi">
              <empty/>
            </element>
          </optional>
        </interleave>
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
      </element>
    </optional>
  </define>
  <!--
       Type library

       Our unsignedInt doesn't allow a leading '+' in its lexical form
       A domain name shoul be made of ascii, numbers, _-+ and is non-empty
       UUID currently allows only the 32 characters strict syntax
       memoryKB request at least 4Mbytes though Xen will grow bigger if too low
    -->
1203 1204
  <define name="unsignedInt">
    <data type="unsignedInt">
1205 1206 1207
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
1208 1209
  <define name="countCPU">
    <data type="unsignedShort">
1210 1211 1212 1213
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1</param>
    </data>
  </define>
1214 1215
  <define name="PortNumber">
    <data type="short">
1216
      <param name="minInclusive">-1</param>
1217 1218
    </data>
  </define>
1219 1220
  <define name="memoryKB">
    <data type="unsignedInt">
1221 1222 1223 1224
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">4000</param>
    </data>
  </define>
1225 1226
  <define name="domainName">
    <data type="string">
1227
      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
1228 1229
    </data>
  </define>
1230 1231 1232 1233 1234
  <define name="diskSerial">
    <data type="string">
      <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
    </data>
  </define>
1235 1236
  <define name="genericName">
    <data type="string">
1237 1238 1239
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
1240
  <define name="UUID">
1241
    <choice>
1242
      <data type="string">
1243 1244
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
1245
      <data type="string">
1246 1247 1248
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
1249
  </define>
1250 1251
  <define name="filePath">
    <data type="string">
1252
      <param name="pattern">[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1253 1254
    </data>
  </define>
1255 1256
  <define name="absFilePath">
    <data type="string">
1257
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1258 1259
    </data>
  </define>
1260 1261
  <define name="absDirPath">
    <data type="string">
1262 1263 1264
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]*</param>
    </data>
  </define>
1265 1266
  <define name="devicePath">
    <data type="string">
1267
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
1268 1269
    </data>
  </define>
1270 1271
  <define name="deviceName">
    <data type="string">
1272
      <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
1273 1274
    </data>
  </define>
1275 1276
  <define name="addrMAC">
    <data type="string">
1277 1278 1279
      <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
    </data>
  </define>
1280 1281
  <define name="addrIP">
    <data type="string">
1282 1283 1284
      <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
    </data>
  </define>
1285 1286
  <define name="usbId">
    <data type="string">
1287 1288 1289
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1290 1291
  <define name="usbAddr">
    <data type="string">
1292 1293 1294
      <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
    </data>
  </define>
1295 1296
  <define name="pciDomain">
    <data type="string">
1297 1298 1299
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1300 1301
  <define name="pciBus">
    <data type="string">
1302 1303 1304
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
1305 1306
  <define name="pciSlot">
    <data type="string">
1307 1308 1309
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
1310 1311
  <define name="pciFunc">
    <data type="string">
1312 1313 1314
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>
1315
</grammar>