domain.rng 34.2 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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
        <group>
          <attribute name="type">
            <value>dir</value>
          </attribute>
          <interleave>
            <optional>
              <element name="source">
                <attribute name="dir">
                  <ref name="absFilePath"/>
                </attribute>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
        </group>
453
        <ref name="diskspec"/>
454 455 456
      </choice>
    </element>
  </define>
457 458 459 460
  <define name="target">
    <element name="target">
      <attribute name="dev">
        <ref name="deviceName"/>
461
      </attribute>
462
      <optional>
463 464 465 466 467 468 469 470 471 472 473
        <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>
474
      </optional>
475 476 477
    </element>
  </define>
  <!--
478
      Disk may use a special driver for access. Currently this is
479 480 481
      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.
    -->
482 483
  <define name="driver">
    <element name="driver">
484
      <choice>
485 486 487 488 489 490 491 492 493 494 495 496
        <group>
          <ref name="driverFormat"/>
          <optional>
            <ref name="driverCache"/>
          </optional>
        </group>
        <group>
          <optional>
            <ref name="driverFormat"/>
          </optional>
          <ref name="driverCache"/>
        </group>
497
      </choice>
498 499
      <empty/>
    </element>
500
  </define>
501 502 503
  <define name="driverFormat">
    <attribute name="name">
      <ref name="genericName"/>
504 505
    </attribute>
    <optional>
506 507
      <attribute name="type">
        <ref name="genericName"/>
508 509 510
      </attribute>
    </optional>
  </define>
511 512
  <define name="driverCache">
    <attribute name="cache">
513
      <choice>
514 515 516
        <value>none</value>
        <value>writeback</value>
        <value>writethrough</value>
517 518 519
      </choice>
    </attribute>
  </define>
520 521
  <define name="filesystem">
    <element name="filesystem">
522 523
      <choice>
        <group>
524 525
          <attribute name="type">
            <value>file</value>
526
          </attribute>
527 528 529 530 531 532 533 534 535
          <interleave>
            <element name="source">
              <attribute name="file">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
536 537
        </group>
        <group>
538 539 540 541 542 543 544 545 546 547 548 549
          <attribute name="type">
            <value>block</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dev">
                <ref name="deviceName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
550 551
        </group>
        <group>
552 553 554 555 556 557 558 559 560 561 562 563
          <attribute name="type">
            <value>mount</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dir">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
564 565
        </group>
        <group>
566 567 568 569 570 571 572 573 574 575 576 577
          <attribute name="type">
            <value>template</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="name">
                <ref name="genericName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
578 579 580 581
        </group>
      </choice>
    </element>
  </define>
582 583 584 585
  <define name="filesystemtgt">
    <element name="target">
      <attribute name="dir">
        <ref name="absDirPath"/>
586 587 588 589
      </attribute>
      <empty/>
    </element>
  </define>
590
  <!--
591 592 593
      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
594
      options. FIXME
595
    -->
596 597
  <define name="interface">
    <element name="interface">
598 599
      <choice>
        <group>
600
          <attribute name="type">
601 602
            <value>bridge</value>
          </attribute>
603
          <interleave>
604
            <optional>
605 606 607 608 609 610
              <element name="source">
                <attribute name="bridge">
                  <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>ethernet</value>
          </attribute>
619
          <interleave>
620
            <optional>
621 622 623 624 625 626
              <element name="source">
                <attribute name="dev">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
627
            </optional>
628 629 630
            <ref name="interface-options"/>
          </interleave>
        </group>
631
        <group>
632
          <attribute name="type">
633 634
            <value>network</value>
          </attribute>
635 636 637 638 639 640 641 642 643 644
          <interleave>
            <element name="source">
              <attribute name="network">
                <ref name="deviceName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="interface-options"/>
          </interleave>
        </group>
645
        <group>
646
          <attribute name="type">
647 648
            <value>user</value>
          </attribute>
649 650 651 652
          <interleave>
            <ref name="interface-options"/>
          </interleave>
        </group>
D
Daniel Veillard 已提交
653 654 655 656 657 658 659 660 661 662 663 664 665 666
        <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>
667 668 669 670 671 672
      </choice>
    </element>
  </define>
  <!--
      The interface options possible are:
        - the MAC address
673 674 675
        - the IP address bound to the interface
        - the name of the script used to set up the binding
        - the target device used
676
    -->
677
  <define name="interface-options">
678 679
    <interleave>
      <optional>
680 681 682 683 684 685
        <element name="target">
          <attribute name="dev">
            <ref name="deviceName"/>
          </attribute>
          <empty/>
        </element>
686 687
      </optional>
      <optional>
688 689 690 691 692 693
        <element name="mac">
          <attribute name="address">
            <ref name="addrMAC"/>
          </attribute>
          <empty/>
        </element>
694 695
      </optional>
      <optional>
696 697 698 699 700 701
        <element name="ip">
          <attribute name="address">
            <ref name="addrIP"/>
          </attribute>
          <empty/>
        </element>
702 703
      </optional>
      <optional>
704 705 706 707 708 709
        <element name="script">
          <attribute name="path">
            <ref name="filePath"/>
          </attribute>
          <empty/>
        </element>
710 711
      </optional>
      <optional>
712 713 714 715
        <element name="model">
          <attribute name="type"/>
          <empty/>
        </element>
716 717
      </optional>
    </interleave>
718 719
  </define>
  <!--
720
      An emulator description is just a path to the binary used for the task
721
    -->
722 723 724
  <define name="emulator">
    <element name="emulator">
      <ref name="absFilePath"/>
725 726 727
    </element>
  </define>
  <!--
728
      A graphic description, currently in Xen only 2 types are supported:
729
        - sdl with optional display, xauth and fullscreen
730
        - vnc with a required port and optional listen IP address, password
731
          and keymap
732
    -->
733 734
  <define name="graphic">
    <element name="graphics">
735
      <choice>
736 737 738 739 740 741 742 743 744
        <group>
          <attribute name="type">
            <value>sdl</value>
          </attribute>
          <optional>
            <attribute name="display">
              <text/>
            </attribute>
          </optional>
745
          <optional>
746
            <attribute name="xauth">
747 748 749
              <text/>
            </attribute>
          </optional>
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 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
          <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>
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 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
        <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>
849 850 851
      </choice>
    </element>
  </define>
852 853 854 855 856 857 858 859 860
  <!--
     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 已提交
861
        <element name="model">
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
          <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>
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900
          <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 已提交
901
        </element>
902 903 904
      </optional>
    </element>
  </define>
905 906 907 908
  <!--
      When a domain terminates multiple policies can be applied depending
      on how it ended:
    -->
909
  <define name="termination">
910 911
    <interleave>
      <optional>
912 913 914
        <element name="on_reboot">
          <ref name="offOptions"/>
        </element>
915 916
      </optional>
      <optional>
917 918 919
        <element name="on_poweroff">
          <ref name="offOptions"/>
        </element>
920 921
      </optional>
      <optional>
922 923 924
        <element name="on_crash">
          <ref name="offOptions"/>
        </element>
925 926 927 928 929 930 931 932 933 934 935
      </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
    -->
936
  <define name="offOptions">
937 938 939 940 941 942 943
    <choice>
      <value>destroy</value>
      <value>restart</value>
      <value>preserve</value>
      <value>rename-restart</value>
    </choice>
  </define>
944 945 946 947
  <!--
      Specific setup for a qemu emulated character device.  Note: this
      definition doesn't fully specify the constraints on this node.
    -->
948
  <define name="qemucdev">
949
    <ref name="qemucdevSrcType"/>
950 951 952 953 954
    <optional>
      <attribute name="tty">
        <ref name="devicePath"/>
      </attribute>
    </optional>
955 956 957 958 959 960 961 962 963 964 965 966
    <interleave>
      <ref name="qemucdevSrcDef"/>
      <optional>
        <element name="target">
          <optional>
            <attribute name="port"/>
          </optional>
        </element>
      </optional>
    </interleave>
  </define>
  <define name="qemucdevSrcType">
967
    <attribute name="type">
968 969 970 971 972 973 974 975 976 977 978 979 980
      <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>
981 982
  </define>
  <define name="qemucdevSrcDef">
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001
    <zeroOrMore>
      <element name="source">
        <optional>
          <attribute name="mode"/>
        </optional>
        <optional>
          <attribute name="path"/>
        </optional>
        <optional>
          <attribute name="host"/>
        </optional>
        <optional>
          <attribute name="service"/>
        </optional>
        <optional>
          <attribute name="wiremode"/>
        </optional>
      </element>
    </zeroOrMore>
1002 1003 1004 1005 1006 1007 1008
    <optional>
      <element name="protocol">
        <optional>
          <attribute name="type"/>
        </optional>
      </element>
    </optional>
1009
  </define>
1010 1011 1012 1013
  <!--
      The description for a console
      just a tty device
    -->
1014 1015
  <define name="console">
    <element name="console">
1016 1017 1018
      <choice>
        <group>
          <optional>
1019 1020
            <attribute name="tty">
              <ref name="devicePath"/>
1021 1022 1023 1024
            </attribute>
          </optional>
          <empty/>
        </group>
1025
        <ref name="qemucdev"/>
1026 1027 1028
      </choice>
    </element>
  </define>
1029 1030 1031
  <define name="sound">
    <element name="sound">
      <attribute name="model">
1032 1033 1034 1035
        <choice>
          <value>sb16</value>
          <value>es1370</value>
          <value>pcspk</value>
1036
          <value>ac97</value>
1037
        </choice>
1038 1039 1040
      </attribute>
    </element>
  </define>
R
Richard Jones 已提交
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
  <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>
1062 1063 1064
  <define name="parallel">
    <element name="parallel">
      <ref name="qemucdev"/>
1065 1066
    </element>
  </define>
1067 1068 1069
  <define name="serial">
    <element name="serial">
      <ref name="qemucdev"/>
1070 1071
    </element>
  </define>
1072 1073
  <define name="guestfwdTarget">
    <element name="target">
1074 1075 1076 1077 1078
      <attribute name="type">
        <value>guestfwd</value>
      </attribute>
      <attribute name="address"/>
      <attribute name="port"/>
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089
    </element>
  </define>
  <define name="channel">
    <element name="channel">
      <ref name="qemucdevSrcType"/>
      <interleave>
        <ref name="qemucdevSrcDef"/>
        <ref name="guestfwdTarget"/>
      </interleave>
    </element>
  </define>
1090 1091 1092
  <define name="input">
    <element name="input">
      <attribute name="type">
1093 1094 1095 1096 1097 1098
        <choice>
          <value>tablet</value>
          <value>mouse</value>
        </choice>
      </attribute>
      <optional>
1099
        <attribute name="bus">
1100 1101 1102 1103 1104 1105 1106
          <choice>
            <value>ps2</value>
            <value>usb</value>
            <value>xen</value>
          </choice>
        </attribute>
      </optional>
1107 1108
    </element>
  </define>
1109 1110
  <define name="hostdev">
    <element name="hostdev">
1111
      <optional>
1112
        <attribute name="mode">
1113
          <choice>
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127
            <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>
1128 1129 1130 1131
          </choice>
        </attribute>
      </optional>
      <group>
1132 1133 1134 1135 1136 1137 1138
        <element name="source">
          <choice>
            <ref name="usbproduct"/>
            <ref name="usbaddress"/>
            <ref name="pciaddress"/>
          </choice>
        </element>
1139 1140 1141 1142 1143 1144
      </group>
    </element>
  </define>
  <define name="usbproduct">
    <element name="vendor">
      <attribute name="id">
1145
        <ref name="usbId"/>
1146 1147 1148 1149
      </attribute>
    </element>
    <element name="product">
      <attribute name="id">
1150
        <ref name="usbId"/>
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
      </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>
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
  <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>
1182
  <!--
1183
      Devices attached to a domain.
1184
    -->
1185 1186
  <define name="devices">
    <element name="devices">
1187
      <interleave>
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199
        <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"/>
1200
            <ref name="video"/>
1201 1202 1203
            <ref name="console"/>
            <ref name="parallel"/>
            <ref name="serial"/>
1204
            <ref name="channel"/>
1205 1206
          </choice>
        </zeroOrMore>
R
Richard Jones 已提交
1207 1208 1209
        <optional>
          <ref name="watchdog"/>
        </optional>
1210 1211 1212
      </interleave>
    </element>
  </define>
1213 1214 1215
  <!--
      A set of optional features: PAE, APIC and ACPI support
    -->
1216
  <define name="features">
1217 1218 1219
    <optional>
      <element name="features">
        <interleave>
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
          <optional>
            <element name="pae">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="apic">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="acpi">
              <empty/>
            </element>
          </optional>
        </interleave>
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246
      </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
    -->
1247 1248
  <define name="unsignedInt">
    <data type="unsignedInt">
1249 1250 1251
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
1252 1253
  <define name="countCPU">
    <data type="unsignedShort">
1254 1255 1256 1257
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1</param>
    </data>
  </define>
1258 1259
  <define name="PortNumber">
    <data type="short">
1260
      <param name="minInclusive">-1</param>
1261 1262
    </data>
  </define>
1263 1264
  <define name="memoryKB">
    <data type="unsignedInt">
1265 1266 1267 1268
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">4000</param>
    </data>
  </define>
1269 1270
  <define name="domainName">
    <data type="string">
1271
      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
1272 1273
    </data>
  </define>
1274 1275 1276 1277 1278
  <define name="diskSerial">
    <data type="string">
      <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
    </data>
  </define>
1279 1280
  <define name="genericName">
    <data type="string">
1281 1282 1283
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
1284
  <define name="UUID">
1285
    <choice>
1286
      <data type="string">
1287 1288
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
1289
      <data type="string">
1290 1291 1292
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
1293
  </define>
1294 1295
  <define name="filePath">
    <data type="string">
1296
      <param name="pattern">[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1297 1298
    </data>
  </define>
1299 1300
  <define name="absFilePath">
    <data type="string">
1301
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1302 1303
    </data>
  </define>
1304 1305
  <define name="absDirPath">
    <data type="string">
1306 1307 1308
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]*</param>
    </data>
  </define>
1309 1310
  <define name="devicePath">
    <data type="string">
1311
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
1312 1313
    </data>
  </define>
1314 1315
  <define name="deviceName">
    <data type="string">
1316
      <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
1317 1318
    </data>
  </define>
1319 1320
  <define name="addrMAC">
    <data type="string">
1321 1322 1323
      <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
    </data>
  </define>
1324 1325
  <define name="addrIP">
    <data type="string">
1326 1327 1328
      <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
    </data>
  </define>
1329 1330
  <define name="usbId">
    <data type="string">
1331 1332 1333
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1334 1335
  <define name="usbAddr">
    <data type="string">
1336 1337 1338
      <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
    </data>
  </define>
1339 1340
  <define name="pciDomain">
    <data type="string">
1341 1342 1343
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1344 1345
  <define name="pciBus">
    <data type="string">
1346 1347 1348
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
1349 1350
  <define name="pciSlot">
    <data type="string">
1351 1352 1353
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
1354 1355
  <define name="pciFunc">
    <data type="string">
1356 1357 1358
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>
1359
</grammar>