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

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

  <define name="address">
    <element name="address">
      <choice>
	<group>
	  <attribute name="type">
	    <value>pci</value>
	  </attribute>
	  <ref name="pciaddress"/>
	</group>
1323 1324 1325 1326 1327 1328
	<group>
	  <attribute name="type">
	    <value>drive</value>
	  </attribute>
	  <ref name="driveaddress"/>
	</group>
1329 1330 1331 1332
      </choice>
    </element>
  </define>

1333 1334 1335 1336 1337 1338 1339 1340
  <!--
       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
    -->
1341 1342
  <define name="unsignedInt">
    <data type="unsignedInt">
1343 1344 1345
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
J
Jiri Denemark 已提交
1346 1347 1348 1349 1350
  <define name='positiveInteger'>
    <data type='positiveInteger'>
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
1351 1352
  <define name="countCPU">
    <data type="unsignedShort">
1353 1354 1355 1356
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1</param>
    </data>
  </define>
1357 1358
  <define name="PortNumber">
    <data type="short">
1359
      <param name="minInclusive">-1</param>
1360 1361
    </data>
  </define>
1362 1363
  <define name="memoryKB">
    <data type="unsignedInt">
1364 1365 1366 1367
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">4000</param>
    </data>
  </define>
1368 1369
  <define name="domainName">
    <data type="string">
1370
      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
1371 1372
    </data>
  </define>
1373 1374 1375 1376 1377
  <define name="diskSerial">
    <data type="string">
      <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
    </data>
  </define>
1378 1379
  <define name="genericName">
    <data type="string">
1380 1381 1382
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
1383
  <define name="UUID">
1384
    <choice>
1385
      <data type="string">
1386 1387
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
1388
      <data type="string">
1389 1390 1391
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
1392
  </define>
1393 1394
  <define name="filePath">
    <data type="string">
1395
      <param name="pattern">[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1396 1397
    </data>
  </define>
1398 1399
  <define name="absFilePath">
    <data type="string">
1400
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1401 1402
    </data>
  </define>
1403 1404
  <define name="absDirPath">
    <data type="string">
1405 1406 1407
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]*</param>
    </data>
  </define>
1408 1409
  <define name="devicePath">
    <data type="string">
1410
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
1411 1412
    </data>
  </define>
1413 1414
  <define name="deviceName">
    <data type="string">
1415
      <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
1416 1417
    </data>
  </define>
1418 1419
  <define name="addrMAC">
    <data type="string">
1420 1421 1422
      <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
    </data>
  </define>
1423 1424
  <define name="addrIP">
    <data type="string">
1425 1426 1427
      <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
    </data>
  </define>
1428 1429
  <define name="usbId">
    <data type="string">
1430 1431 1432
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1433 1434
  <define name="usbAddr">
    <data type="string">
1435 1436 1437
      <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
    </data>
  </define>
1438 1439
  <define name="pciDomain">
    <data type="string">
1440 1441 1442
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
1443 1444
  <define name="pciBus">
    <data type="string">
1445 1446 1447
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
1448 1449
  <define name="pciSlot">
    <data type="string">
1450 1451 1452
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
1453 1454
  <define name="pciFunc">
    <data type="string">
1455 1456 1457
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472
  <define name="driveController">
    <data type="string">
      <param name="pattern">[0-9]{1,2}</param>
    </data>
  </define>
  <define name="driveBus">
    <data type="string">
      <param name="pattern">[0-9]{1,2}</param>
    </data>
  </define>
  <define name="driveUnit">
    <data type="string">
      <param name="pattern">[0-9]{1,2}</param>
    </data>
  </define>
J
Jiri Denemark 已提交
1473 1474 1475 1476 1477
  <define name="featureName">
    <data type="string">
      <param name='pattern'>[a-zA-Z0-9\-_]+</param>
    </data>
  </define>
1478
</grammar>