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

9
  <!--
10
      We handle only document defining a domain
11 12 13
    -->
  <define name='domain'>
    <element name="domain">
14
      <ref name='hvs'/>
15 16
      <ref name='ids'/>
      <interleave>
17 18
        <ref name='os'/>
        <ref name='clock'/>
19 20 21
        <ref name='resources'/>
        <ref name='features'/>
        <ref name='termination'/>
22 23 24
	<optional>
          <ref name='devices'/>
	</optional>
25
      </interleave>
26
    </element>
27 28
  </define>

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  <define name='hvs'>
    <attribute name='type'>
      <choice>
	<value>xen</value>
	<value>kvm</value>
	<value>kqemu</value>
	<value>qemu</value>
	<value>lxc</value>
	<value>openvz</value>
	<value>test</value>
      </choice>
    </attribute>
  </define>

  <define name='os'>
    <choice>
      <ref name='osxen'/>
      <ref name='oshvm'/>
47
      <ref name='osexe'/>
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
    </choice>
  </define>

  <define name='osxen'>
    <choice>
      <group>
	<optional>
          <ref name='bootloader'/>
	</optional>
	<element name='os'>
	  <ref name='ostypexen'/>
          <ref name='osbootkernel'/>
	</element>
      </group>
      <group>
	<ref name='bootloader'/>
	<optional>
	  <element name='os'>
	    <ref name='ostypexen'/>
	    <optional>
              <ref name='osbootkernel'/>
	    </optional>
	  </element>
	</optional>
      </group>
    </choice>
  </define>


  <define name='oshvm'>
    <element name='os'>
      <ref name='ostypehvm'/>
80
      <interleave>
81 82 83
	<optional>
	  <element name='loader'>
	    <ref name='absFilePath'/>
84
	  </element>
85 86 87 88 89
	</optional>
	<choice>
          <ref name='osbootkernel'/>
          <ref name='osbootdev'/>
	</choice>
90
      </interleave>
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
    </element>
  </define>


  <define name='ostypexen'>
    <element name='type'>
      <optional>
	<attribute name='arch'>
	  <choice>
	    <value>i686</value>
	    <value>x86_64</value>
	    <value>ia64</value>
	  </choice>
	</attribute>
      </optional>
      <optional>
	<attribute name='machine'>
	  <choice>
	    <value>xenpv</value>
	    <value>xenner</value>
	  </choice>
	</attribute>
      </optional>
      <choice>
	<value>xen</value>
	<value>linux</value>
      </choice>
    </element>
  </define>

  <define name='ostypehvm'>
    <element name='type'>
      <optional>
	<choice>
	  <ref name='hvmx86'/>
	  <ref name='hvmmips'/>
	  <ref name='hvmsparc'/>
	  <ref name='hvmppc'/>
	</choice>
      </optional>
      <value>hvm</value>
    </element>
133 134
  </define>

135
  <define name='hvmx86'>
136 137 138
    <group>
      <attribute name='arch'>
	<choice>
139
	  <value>i686</value>
140 141 142 143 144
	  <value>x86_64</value>
	</choice>
      </attribute>
      <attribute name='machine'>
	<choice>
145
	  <value>xenfv</value>
146 147 148 149 150 151 152
	  <value>pc</value>
	  <value>isapc</value>
	</choice>
      </attribute>
    </group>
  </define>

153
  <define name='hvmmips'>
154 155 156 157 158 159 160 161 162 163
    <group>
      <attribute name='arch'>
        <value>mips</value>
      </attribute>
      <attribute name='machine'>
        <value>mips</value>
      </attribute>
    </group>
  </define>

164
  <define name='hvmsparc'>
165 166 167 168 169 170 171 172 173 174
    <group>
      <attribute name='arch'>
	<value>sparc</value>
      </attribute>
      <attribute name='machine'>
	<value>sun4m</value>
      </attribute>
    </group>
  </define>

175
  <define name='hvmppc'>
176 177 178 179 180 181 182 183 184 185 186 187 188 189
    <group>
      <attribute name='arch'>
	<value>ppc</value>
      </attribute>
      <attribute name='machine'>
	<choice>
	  <value>g3bw</value>
	  <value>mac99</value>
	  <value>prep</value>
	</choice>
      </attribute>
    </group>
  </define>

190

191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
  <define name='osexe'>
    <element name='os'>
      <element name='type'>
	<value>exe</value>
      </element>
      <interleave>
	<optional>
	  <element name='init'>
	    <ref name='absFilePath'/>
	  </element>
	</optional>
      </interleave>
    </element>
  </define>



208
  <!--
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
      The Identifiers can be:
      - an optional id attribute with a number on the domain element
      - a mandatory name
      - an optional uuid
    -->
  <define name='ids'>
    <optional>
      <attribute name='id'>
        <ref name='unsignedInt'/>
      </attribute>
    </optional>
    <interleave>
      <element name="name">
        <ref name='domainName'/>
      </element>
      <optional>
        <element name="uuid">
          <ref name='UUID'/>
        </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.
235
      We can't check here the rule that currentMemory <= memory
236 237 238 239 240 241 242
    -->

  <define name='resources'>
    <interleave>
      <element name='memory'>
        <ref name='memoryKB'/>
      </element>
243 244 245 246 247 248 249
      <optional>
        <element name='currentMemory'>
          <ref name='memoryKB'/>
        </element>
      </optional>
      <optional>
        <element name='vcpu'>
250 251 252
          <optional>
            <attribute name='cpuset' />
          </optional>
253 254 255
          <ref name='countCPU'/>
        </element>
      </optional>
256 257 258
    </interleave>
  </define>

259 260 261 262 263 264 265 266 267 268 269 270 271 272
  <define name='clock'>
    <optional>
      <element name='clock'>
        <attribute name='offset'>
          <choice>
            <value>localtime</value>
            <value>utc</value>
          </choice>
        </attribute>
        <empty/>
      </element>
    </optional>
  </define>

273 274 275 276 277 278
  <!--
      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.
    -->
  <define name='bootloader'>
279 280 281 282 283 284 285 286 287 288 289 290 291
    <interleave>
      <element name='bootloader'>
	<choice>
	  <ref name='absFilePath'/>
	  <empty/>
	</choice>
      </element>
      <optional>
	<element name='bootloader_args'>
	  <text/>
	</element>
      </optional>
    </interleave>
292 293
  </define>

294
  <define name='osbootkernel'>
295 296 297 298 299 300 301 302 303
    <interleave>
      <element name='kernel'>
        <ref name='absFilePath'/>
      </element>
      <optional>
        <element name='initrd'>
	  <ref name='absFilePath'/>
	</element>
      </optional>
304 305 306 307 308
      <optional>
        <element name='root'>
          <ref name='devicePath'/>
        </element>
      </optional>
309 310 311 312 313 314 315 316
      <optional>
        <element name='cmdline'>
	  <text/>
	</element>
      </optional>
    </interleave>
  </define>

317 318 319 320 321 322 323 324 325 326 327
  <define name='osbootdev'>
    <element name='boot'>
      <attribute name='dev'>
        <choice>
          <value>hd</value>
          <value>fd</value>
          <value>cdrom</value>
          <value>network</value>
        </choice>
      </attribute>
      <empty/>
328
    </element>
329 330 331 332 333 334 335 336 337 338 339
  </define>


  <define name='diskspec'>
    <optional>
      <ref name='driver'/>
    </optional>
    <ref name='target'/>
    <optional>
      <element name='readonly'>
        <empty/>
340
      </element>
341 342 343 344 345 346
    </optional>
    <optional>
      <element name='shareable'>
        <empty/>
      </element>
    </optional>
347 348 349 350 351 352 353 354 355
  </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

    -->
  <define name='disk'>
    <element name='disk'>
356 357 358 359 360 361 362 363 364
      <optional>
	<attribute name='device'>
	  <choice>
	    <value>floppy</value>
	    <value>disk</value>
	    <value>cdrom</value>
	  </choice>
	</attribute>
      </optional>
365 366 367 368
      <choice>
        <group>
          <attribute name='type'>
	    <value>file</value>
369
          </attribute>
370
	  <interleave>
371
	    <optional>
372 373 374 375 376 377
  	      <element name='source'>
  		<attribute name='file'>
  	          <ref name='absFilePath'/>
  		</attribute>
  		<empty/>
  	      </element>
378
	    </optional>
379 380
            <ref name='diskspec'/>
  	  </interleave>
381 382 383
        </group>
        <group>
          <attribute name='type'>
384 385 386
  	    <value>block</value>
  	  </attribute>
  	  <interleave>
387
	    <optional>
388 389 390 391 392 393
  	      <element name='source'>
  		<attribute name='dev'>
  	          <ref name='deviceName'/>
  		</attribute>
  		<empty/>
  	      </element>
394
	    </optional>
395 396
            <ref name='diskspec'/>
  	  </interleave>
397
        </group>
398
        <ref name='diskspec'/>
399 400 401 402 403 404 405 406 407
      </choice>
    </element>
  </define>

  <define name='target'>
    <element name='target'>
      <attribute name='dev'>
	<ref name='deviceName'/>
      </attribute>
408 409 410 411 412 413 414
      <optional>
         <attribute name='bus'>
           <choice>
             <value>ide</value>
             <value>virtio</value>
             <value>fdc</value>
             <value>xen</value>
415
             <value>usb</value>
416 417 418
           </choice>
         </attribute>
      </optional>
419 420 421 422
    </element>
  </define>

  <!--
423
      Disk may use a special driver for access. Currently this is
424 425 426 427
      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.
    -->
  <define name='driver'>
428
    <element name='driver'>
429 430 431 432 433 434 435 436 437 438 439 440 441 442
      <choice>
	<group>
	  <ref name='driverFormat'/>
	  <optional>
	    <ref name='driverCache'/>
	  </optional>
	</group>
	<group>
	  <optional>
	    <ref name='driverFormat'/>
	  </optional>
	  <ref name='driverCache'/>
	</group>
      </choice>
443 444
      <empty/>
    </element>
445
  </define>
446

447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
  <define name='driverFormat'>
    <attribute name='name'>
      <ref name='genericName'/>
    </attribute>
    <optional>
      <attribute name='type'>
	<ref name='genericName'/>
      </attribute>
    </optional>
  </define>

  <define name='driverCache'>
    <attribute name='cache'>
      <choice>
	<value>none</value>
	<value>writeback</value>
	<value>writethrough</value>
      </choice>
    </attribute>
  </define>

468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
  <define name='filesystem'>
    <element name='filesystem'>
      <choice>
        <group>
          <attribute name='type'>
	    <value>file</value>
          </attribute>
	  <interleave>
  	    <element name='source'>
  	      <attribute name='file'>
  	        <ref name='absFilePath'/>
  	      </attribute>
  	      <empty/>
  	    </element>
            <ref name='filesystemtgt'/>
  	  </interleave>
        </group>
        <group>
          <attribute name='type'>
  	    <value>block</value>
  	  </attribute>
  	  <interleave>
  	    <element name='source'>
  	      <attribute name='dev'>
  	        <ref name='deviceName'/>
  	      </attribute>
  	      <empty/>
  	    </element>
            <ref name='filesystemtgt'/>
  	  </interleave>
        </group>
        <group>
          <attribute name='type'>
  	    <value>mount</value>
  	  </attribute>
  	  <interleave>
  	    <element name='source'>
  	      <attribute name='dir'>
  	        <ref name='absFilePath'/>
  	      </attribute>
  	      <empty/>
  	    </element>
            <ref name='filesystemtgt'/>
  	  </interleave>
        </group>
        <group>
          <attribute name='type'>
  	    <value>template</value>
  	  </attribute>
  	  <interleave>
  	    <element name='source'>
  	      <attribute name='name'>
  	        <ref name='genericName'/>
  	      </attribute>
  	      <empty/>
  	    </element>
            <ref name='filesystemtgt'/>
  	  </interleave>
        </group>
      </choice>
    </element>
  </define>

  <define name='filesystemtgt'>
    <element name='target'>
      <attribute name='dir'>
	<ref name='absDirPath'/>
      </attribute>
      <empty/>
    </element>
  </define>

540
  <!--
541 542 543
      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
544
      options. FIXME
545 546 547
    -->
  <define name='interface'>
    <element name='interface'>
548 549 550 551 552 553
      <choice>
        <group>
          <attribute name='type'>
            <value>bridge</value>
          </attribute>
	  <interleave>
554 555 556 557 558 559 560 561
            <optional>
	      <element name='source'>
	        <attribute name='bridge'>
	  	  <ref name='deviceName'/>
	        </attribute>
	        <empty/>
	      </element>
            </optional>
562 563 564 565 566 567 568
	    <ref name='interface-options'/>
	  </interleave>
	</group>
        <group>
          <attribute name='type'>
            <value>ethernet</value>
          </attribute>
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
	  <interleave>
            <optional>
	      <element name='source'>
  	        <attribute name='dev'>
	  	  <ref name='deviceName'/>
	        </attribute>
	        <empty/>
	      </element>
            </optional>
	    <ref name='interface-options'/>
	  </interleave>
	</group>
        <group>
          <attribute name='type'>
            <value>network</value>
          </attribute>
585 586
	  <interleave>
	    <element name='source'>
587
	      <attribute name='network'>
588 589 590 591 592 593 594
		<ref name='deviceName'/>
	      </attribute>
	      <empty/>
	    </element>
	    <ref name='interface-options'/>
	  </interleave>
	</group>
595 596 597 598 599 600 601 602
        <group>
          <attribute name='type'>
            <value>user</value>
          </attribute>
	  <interleave>
	    <ref name='interface-options'/>
	  </interleave>
	</group>
603 604 605 606 607 608 609 610 611
      </choice>
    </element>
  </define>

  <!--
      The interface options possible are:
        - the MAC address
	- the IP address bound to the interface
	- the name of the script used to set up the binding
612
	- the target device used
613 614
    -->
  <define name='interface-options'>
615 616 617 618 619 620 621 622 623 624 625 626 627
    <interleave>
      <optional>
	<element name='target'>
	  <attribute name='dev'>
	    <ref name='deviceName'/>
	  </attribute>
	  <empty/>
	</element>
      </optional>
      <optional>
	<element name='mac'>
	  <attribute name='address'>
	    <ref name='addrMAC'/>
628
	    </attribute>
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
	  <empty/>
	</element>
      </optional>
      <optional>
	<element name='ip'>
	  <attribute name='address'>
	    <ref name='addrIP'/>
	  </attribute>
	  <empty/>
	</element>
      </optional>
      <optional>
	<element name='script'>
	  <attribute name='path'>
	    <ref name='filePath'/>
	  </attribute>
	  <empty/>
	</element>
      </optional>
      <optional>
	<element name='model'>
	  <attribute name='type' />
	  <empty/>
	</element>
      </optional>
    </interleave>
655 656 657
  </define>

  <!--
658
      An emulator description is just a path to the binary used for the task
659 660 661 662 663 664 665 666
    -->
  <define name='emulator'>
    <element name='emulator'>
      <ref name='absFilePath'/>
    </element>
  </define>

  <!--
667
      A graphic description, currently in Xen only 2 types are supported:
668
        - sdl with optional display, xauth and fullscreen
669 670
	- vnc with a required port and optional listen IP address, password
          and keymap
671 672 673 674
    -->
  <define name='graphic'>
    <element name='graphics'>
      <choice>
675 676 677 678 679 680 681 682 683 684 685 686 687 688
	<group>
          <attribute name='type'>
	    <value>sdl</value>
	  </attribute>
	  <optional>
	    <attribute name='display'>
	      <text/>
	    </attribute>
	  </optional>
	  <optional>
	    <attribute name='xauth'>
	      <text/>
	    </attribute>
	  </optional>
689 690 691 692 693 694 695 696
	  <optional>
	    <attribute name='fullscreen'>
	      <choice>
		<value>yes</value>
		<value>no</value>
	      </choice>
	    </attribute>
	  </optional>
697
	</group>
698 699 700 701
	<group>
          <attribute name='type'>
	    <value>vnc</value>
	  </attribute>
702 703 704 705 706 707 708 709 710 711 712 713 714
	  <optional>
            <attribute name='port'>
	      <ref name='PortNumber'/>
	    </attribute>
	  </optional>
	  <optional>
	    <attribute name='autoport'>
	      <choice>
		<value>yes</value>
		<value>no</value>
	      </choice>
	    </attribute>
	  </optional>
715 716 717 718 719 720 721 722 723 724
	  <optional>
	    <attribute name='listen'>
	      <ref name='addrIP'/>
	    </attribute>
	  </optional>
	  <optional>
	    <attribute name='passwd'>
	      <text/>
	    </attribute>
	  </optional>
725 726 727 728 729
          <optional>
            <attribute name='keymap'>
              <text/>
            </attribute>
          </optional>
730 731 732 733 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
	</group>
      </choice>
    </element>
  </define>

  <!--
      When a domain terminates multiple policies can be applied depending
      on how it ended:
    -->
  <define name='termination'>
    <interleave>
      <optional>
        <element name='on_reboot'>
	  <ref name='offOptions'/>
	</element>
      </optional>
      <optional>
        <element name='on_poweroff'>
	  <ref name='offOptions'/>
	</element>
      </optional>
      <optional>
        <element name='on_crash'>
	  <ref name='offOptions'/>
	</element>
      </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
    -->
  <define name='offOptions'>
    <choice>
      <value>destroy</value>
      <value>restart</value>
      <value>preserve</value>
      <value>rename-restart</value>
    </choice>
  </define>

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 833 834
  <!--
      Specific setup for a qemu emulated character device.  Note: this
      definition doesn't fully specify the constraints on this node.
    -->
  <define name='qemucdev'>
    <attribute name='type'>
      <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>
          <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>
        </oneOrMore>
      </optional>
      <optional>
        <element name='protocol'>
          <optional>
            <attribute name='type' />
          </optional>
        </element>
      </optional>
      <optional>
        <element name='target'>
          <optional>
            <attribute name='port' />
          </optional>
        </element>
      </optional>
    </interleave>
  </define>

835 836 837 838 839 840
  <!--
      The description for a console
      just a tty device
    -->
  <define name='console'>
    <element name='console'>
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862
      <choice>
        <group>
          <optional>
            <attribute name='tty'>
              <ref name='devicePath'/>
            </attribute>
          </optional>
          <empty/>
        </group>
        <ref name='qemucdev' />
      </choice>
    </element>
  </define>

  <define name='sound'>
    <element name='sound'>
      <attribute name='model'>
        <choice>
          <value>sb16</value>
          <value>es1370</value>
          <value>pcspk</value>
        </choice>
863 864 865 866
      </attribute>
    </element>
  </define>

867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895
  <define name='parallel'>
    <element name='parallel'>
      <ref name='qemucdev' />
    </element>
  </define>

  <define name='serial'>
    <element name='serial'>
      <ref name='qemucdev' />
    </element>
  </define>

  <define name='input'>
    <element name='input'>
      <attribute name='type'>
        <choice>
          <value>tablet</value>
          <value>mouse</value>
        </choice>
      </attribute>
      <optional>
        <attribute name='bus'>
          <choice>
            <value>ps2</value>
            <value>usb</value>
            <value>xen</value>
          </choice>
        </attribute>
      </optional>
896 897 898
    </element>
  </define>

899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919
  <define name='hostdev'>
    <element name='hostdev'>
      <optional>
	<attribute name='mode'>
	  <choice>
	    <value>subsystem</value>
	    <value>capabilities</value>
	  </choice>
	</attribute>
        <attribute name='type'>
          <choice>
	    <value>usb</value>
	    <value>pci</value>
          </choice>
        </attribute>
      </optional>
      <group>
          <element name='source'>
            <choice>
              <ref name="usbproduct"/>
              <ref name="usbaddress"/>
920
              <ref name="pciaddress"/>
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950
            </choice>
          </element>
      </group>
    </element>
  </define>

  <define name="usbproduct">
    <element name="vendor">
      <attribute name="id">
          <ref name="usbId"/>
      </attribute>
    </element>
    <element name="product">
      <attribute name="id">
          <ref name="usbId"/>
      </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>

951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968
  <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>
969
  <!--
970
      Devices attached to a domain.
971
    -->
972
  <define name='devices'>
973 974 975
    <element name='devices'>
      <interleave>
	<optional>
976
	  <ref name='emulator'/>
977 978
	</optional>
	<zeroOrMore>
979 980 981
	  <choice>
	    <ref name='graphic'/>
	    <ref name='disk'/>
982
	    <ref name='filesystem'/>
983 984 985 986 987 988
	    <ref name='interface'/>
	    <ref name='console'/>
            <ref name='sound'/>
            <ref name='parallel'/>
            <ref name='serial'/>
            <ref name='input'/>
989
            <ref name='hostdev'/>
990
	  </choice>
991 992 993 994 995
	</zeroOrMore>
      </interleave>
    </element>
  </define>

996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
  <!--
      A set of optional features: PAE, APIC and ACPI support
    -->
  <define name='features'>
    <optional>
      <element name="features">
        <interleave>
	  <optional>
	    <element name="pae">
	      <empty/>
	    </element>
	  </optional>
	  <optional>
	    <element name="apic">
	      <empty/>
	    </element>
	  </optional>
	  <optional>
	    <element name="acpi">
	      <empty/>
	    </element>
	  </optional>
	</interleave>
      </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
    -->
  <define name='unsignedInt'>
    <data type='unsignedInt'>
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
  <define name='countCPU'>
    <data type='unsignedShort'>
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1</param>
    </data>
  </define>
  <define name='PortNumber'>
1043 1044
    <data type='short'>
      <param name="minInclusive">-1</param>
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
    </data>
  </define>
  <define name='memoryKB'>
    <data type='unsignedInt'>
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">4000</param>
    </data>
  </define>
  <define name='domainName'>
    <data type='string'>
1055
      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
1056 1057
    </data>
  </define>
1058 1059 1060 1061 1062
  <define name='genericName'>
    <data type='string'>
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
1063
  <define name='UUID'>
1064 1065 1066 1067 1068 1069 1070 1071
    <choice>
      <data type='string'>
        <param name="pattern">[a-fA-F0-9]{32}</param>
      </data>
      <data type='string'>
        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
      </data>
    </choice>
1072 1073 1074
  </define>
  <define name='filePath'>
    <data type='string'>
1075
      <param name="pattern">[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1076 1077 1078 1079
    </data>
  </define>
  <define name='absFilePath'>
    <data type='string'>
1080
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
1081 1082
    </data>
  </define>
1083 1084 1085 1086 1087
  <define name='absDirPath'>
    <data type='string'>
      <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]*</param>
    </data>
  </define>
1088 1089
  <define name='devicePath'>
    <data type='string'>
1090
      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
1091 1092 1093 1094
    </data>
  </define>
  <define name='deviceName'>
    <data type='string'>
1095
      <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
    </data>
  </define>
  <define name='addrMAC'>
    <data type='string'>
      <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
    </data>
  </define>
  <define name='addrIP'>
    <data type='string'>
      <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
    </data>
  </define>
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
  <define name='usbId'>
    <data type='string'>
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
  <define name='usbAddr'>
    <data type='string'>
      <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
    </data>
  </define>
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
  <define name='pciDomain'>
    <data type='string'>
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
  <define name='pciBus'>
    <data type='string'>
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
  <define name='pciSlot'>
    <data type='string'>
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
  <define name='pciFunc'>
    <data type='string'>
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>
1138
</grammar>