domain.rng 66.5 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='basictypes.rng'/>
9
  <include href='storageencryption.rng'/>
10
  <include href='networkcommon.rng'/>
11 12 13 14 15 16 17 18 19 20

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

21
  <!--
22
      We handle only document defining a domain
23
    -->
24
  <define name="domain">
25
    <element name="domain">
26 27
      <ref name="hvs"/>
      <ref name="ids"/>
28
      <interleave>
29 30 31
        <optional>
          <ref name="description"/>
        </optional>
J
Jiri Denemark 已提交
32 33 34
        <optional>
          <ref name="cpu"/>
        </optional>
35 36 37
        <optional>
          <ref name="sysinfo"/>
        </optional>
38 39 40 41 42 43 44 45 46 47 48
        <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>
49 50 51
        <optional>
          <ref name='qemucmdline'/>
        </optional>
52
      </interleave>
53
    </element>
54
  </define>
55 56 57 58
  <define name="seclabel">
    <element name="seclabel">
      <attribute name="model">
        <text/>
59
      </attribute>
60
      <attribute name="type">
61 62 63 64
        <choice>
          <value>dynamic</value>
          <value>static</value>
        </choice>
65 66 67 68 69 70
      </attribute>
      <attribute name="relabel">
        <choice>
          <value>yes</value>
          <value>no</value>
        </choice>
71
      </attribute>
72 73
      <element name="label">
        <text/>
74
      </element>
75 76 77
      <element name="imagelabel">
        <text/>
      </element>
78 79 80
      <element name="baselabel">
        <text/>
      </element>
81 82
    </element>
  </define>
83 84
  <define name="hvs">
    <attribute name="type">
85
      <choice>
86 87 88 89 90 91 92
        <value>xen</value>
        <value>kvm</value>
        <value>kqemu</value>
        <value>qemu</value>
        <value>lxc</value>
        <value>openvz</value>
        <value>test</value>
93 94 95
      </choice>
    </attribute>
  </define>
96
  <define name="os">
97
    <choice>
98 99 100
      <ref name="osxen"/>
      <ref name="oshvm"/>
      <ref name="osexe"/>
101 102
    </choice>
  </define>
103
  <define name="osxen">
104 105
    <choice>
      <group>
106 107 108 109 110 111 112
        <optional>
          <ref name="bootloader"/>
        </optional>
        <element name="os">
          <ref name="ostypexen"/>
          <ref name="osbootkernel"/>
        </element>
113 114
      </group>
      <group>
115 116 117 118 119 120 121 122 123
        <ref name="bootloader"/>
        <optional>
          <element name="os">
            <ref name="ostypexen"/>
            <optional>
              <ref name="osbootkernel"/>
            </optional>
          </element>
        </optional>
124 125 126
      </group>
    </choice>
  </define>
127 128 129
  <define name="oshvm">
    <element name="os">
      <ref name="ostypehvm"/>
130
      <interleave>
131 132 133 134 135 136 137
        <optional>
          <element name="loader">
            <ref name="absFilePath"/>
          </element>
        </optional>
        <choice>
          <ref name="osbootkernel"/>
138
          <zeroOrMore>
139
            <ref name="osbootdev"/>
140
          </zeroOrMore>
141
        </choice>
142 143 144 145 146 147 148 149 150 151
        <optional>
          <element name="bootmenu">
            <attribute name="enable">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </element>
        </optional>
152 153 154
        <optional>
          <ref name="smbios"/>
        </optional>
M
Michal Privoznik 已提交
155 156 157
        <optional>
          <ref name="bios"/>
        </optional>
158
      </interleave>
159 160
    </element>
  </define>
161 162
  <define name="ostypexen">
    <element name="type">
163
      <optional>
164 165 166 167 168 169 170
        <attribute name="arch">
          <choice>
            <value>i686</value>
            <value>x86_64</value>
            <value>ia64</value>
          </choice>
        </attribute>
171 172
      </optional>
      <optional>
173 174 175 176 177 178
        <attribute name="machine">
          <choice>
            <value>xenpv</value>
            <value>xenner</value>
          </choice>
        </attribute>
179 180
      </optional>
      <choice>
181 182
        <value>xen</value>
        <value>linux</value>
183 184 185
      </choice>
    </element>
  </define>
186 187
  <define name="ostypehvm">
    <element name="type">
188
      <optional>
189 190 191 192 193 194
        <choice>
          <ref name="hvmx86"/>
          <ref name="hvmmips"/>
          <ref name="hvmsparc"/>
          <ref name="hvmppc"/>
        </choice>
195 196 197
      </optional>
      <value>hvm</value>
    </element>
198
  </define>
199
  <define name="hvmx86">
200
    <group>
201 202 203 204 205 206 207 208 209 210
      <optional>
        <attribute name="arch">
          <choice>
            <value>i686</value>
            <value>x86_64</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
211 212 213
          <data type="string">
            <param name="pattern">[a-zA-Z0-9_\.\-]+</param>
          </data>
214
        </attribute>
215
      </optional>
216 217
    </group>
  </define>
218
  <define name="hvmmips">
219
    <group>
220 221 222 223 224 225 226 227 228 229
      <optional>
        <attribute name="arch">
          <value>mips</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <value>mips</value>
        </attribute>
      </optional>
230 231
    </group>
  </define>
232
  <define name="hvmsparc">
233
    <group>
234 235 236 237 238 239 240 241 242 243
      <optional>
        <attribute name="arch">
          <value>sparc</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="machine">
          <value>sun4m</value>
        </attribute>
      </optional>
244 245
    </group>
  </define>
246
  <define name="hvmppc">
247
    <group>
248 249 250 251 252 253 254 255 256 257 258 259 260 261
      <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>
262 263
    </group>
  </define>
264 265 266 267
  <define name="osexe">
    <element name="os">
      <element name="type">
        <value>exe</value>
268 269
      </element>
      <interleave>
270 271 272 273 274
        <optional>
          <element name="init">
            <ref name="absFilePath"/>
          </element>
        </optional>
275 276 277
      </interleave>
    </element>
  </define>
278
  <!--
279 280 281 282 283
      The Identifiers can be:
      - an optional id attribute with a number on the domain element
      - a mandatory name
      - an optional uuid
    -->
284
  <define name="ids">
285
    <optional>
286 287
      <attribute name="id">
        <ref name="unsignedInt"/>
288 289 290 291
      </attribute>
    </optional>
    <interleave>
      <element name="name">
292
        <ref name="domainName"/>
293 294 295
      </element>
      <optional>
        <element name="uuid">
296
          <ref name="UUID"/>
297 298 299 300 301 302 303
        </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.
304
      We can't check here the rule that currentMemory <= memory
305
    -->
306
  <define name="resources">
307
    <interleave>
308 309
      <element name="memory">
        <ref name="memoryKB"/>
310
      </element>
311
      <optional>
312 313
        <element name="currentMemory">
          <ref name="memoryKB"/>
314 315
        </element>
      </optional>
316
      <optional>
R
Richard Jones 已提交
317 318 319 320 321 322 323
        <element name="memoryBacking">
          <optional>
            <element name="hugepages">
              <empty/>
            </element>
          </optional>
        </element>
324
      </optional>
325

326 327 328 329 330 331 332 333 334 335 336 337
      <!-- The Blkio cgroup related tunables would go in the blkiotune -->
      <optional>
        <element name="blkiotune">
          <!-- I/O weight the VM can use -->
          <optional>
            <element name="weight">
              <ref name="weight"/>
            </element>
          </optional>
        </element>
      </optional>

338 339
      <!-- All the memory/swap related tunables would go in the memtune -->
      <optional>
D
Daniel Veillard 已提交
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
        <element name="memtune">
          <!-- Maximum memory the VM can use -->
          <optional>
            <element name="hard_limit">
              <ref name="memoryKB"/>
            </element>
          </optional>
          <!-- Minimum memory ascertained for the VM during contention -->
          <optional>
            <element name="soft_limit">
              <ref name="memoryKB"/>
            </element>
          </optional>
          <!-- Minimum amount of memory required to start the VM -->
          <optional>
            <element name="min_guarantee">
              <ref name="memoryKB"/>
            </element>
          </optional>
          <!-- Maximum swap area the VM can use -->
          <optional>
            <element name="swap_hard_limit">
              <ref name="memoryKB"/>
            </element>
          </optional>
        </element>
366 367
      </optional>

368
      <optional>
369
        <element name="vcpu">
370
          <optional>
E
Eric Blake 已提交
371 372 373
            <attribute name="cpuset">
              <ref name="cpuset"/>
            </attribute>
374
          </optional>
375 376 377 378 379
          <optional>
            <attribute name="current">
              <ref name="countCPU"/>
            </attribute>
          </optional>
380
          <ref name="countCPU"/>
381 382
        </element>
      </optional>
383 384 385 386 387 388 389 390 391

      <!-- All the cpu related tunables would go in the cputune -->
      <optional>
        <element name="cputune">
          <optional>
            <element name="shares">
              <ref name="cpushares"/>
            </element>
          </optional>
W
Wen Congyang 已提交
392 393 394 395 396 397 398 399 400 401
          <optional>
            <element name="period">
              <ref name="cpuperiod"/>
            </element>
          </optional>
          <optional>
            <element name="quota">
              <ref name="cpuquota"/>
            </element>
          </optional>
402 403 404 405 406 407 408 409 410 411 412 413
          <zeroOrMore>
            <element name="vcpupin">
              <attribute name="vcpu">
                <ref name="vcpuid"/>
              </attribute>
              <attribute name="cpuset">
                <ref name="cpuset"/>
              </attribute>
            </element>
          </zeroOrMore>
        </element>
      </optional>
O
Osier Yang 已提交
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433

      <!-- All the NUMA related tunables would go in the numatune -->
      <optional>
        <element name="numatune">
          <optional>
            <element name="memory">
              <attribute name="mode">
                <choice>
                  <value>strict</value>
                  <value>preferred</value>
                  <value>interleave</value>
                </choice>
              </attribute>
              <attribute name="nodeset">
                <ref name="cpuset"/>
              </attribute>
            </element>
          </optional>
        </element>
      </optional>
434 435
    </interleave>
  </define>
436
  <define name="clock">
437
    <optional>
438
      <element name="clock">
439 440
        <choice>
          <attribute name="offset">
441
            <value>localtime</value>
442 443
          </attribute>
          <attribute name="offset">
444
            <value>utc</value>
445
          </attribute>
446 447 448 449 450 451 452 453 454 455
          <group>
            <attribute name="offset">
              <value>timezone</value>
            </attribute>
            <optional>
              <attribute name="timezone">
                <ref name="timeZone"/>
              </attribute>
            </optional>
          </group>
456 457 458 459 460 461 462 463 464 465 466
          <group>
            <attribute name="offset">
              <value>variable</value>
            </attribute>
            <optional>
              <attribute name="adjustment">
                <ref name="timeDelta"/>
              </attribute>
            </optional>
          </group>
        </choice>
467 468 469
        <zeroOrMore>
          <ref name="timer"/>
        </zeroOrMore>
470 471 472
      </element>
    </optional>
  </define>
L
Laine Stump 已提交
473 474 475 476 477 478 479 480 481 482 483 484
  <define name="timer">
    <element name="timer">
      <attribute name="name">
        <choice>
          <value>platform</value>
          <value>pit</value>
          <value>rtc</value>
          <value>hpet</value>
          <value>tsc</value>
        </choice>
      </attribute>
      <optional>
485
        <attribute name="track">
L
Laine Stump 已提交
486
          <choice>
487
            <value>boot</value>
L
Laine Stump 已提交
488
            <value>guest</value>
489
            <value>wall</value>
L
Laine Stump 已提交
490 491 492 493 494 495 496 497 498 499 500 501 502
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="tickpolicy">
          <choice>
            <value>delay</value>
            <value>catchup</value>
            <value>merge</value>
            <value>discard</value>
          </choice>
        </attribute>
      </optional>
503 504 505
      <optional>
        <ref name="catchup"/>
      </optional>
L
Laine Stump 已提交
506 507 508 509 510 511 512 513 514 515 516 517
      <optional>
        <attribute name="frequency">
          <ref name="unsignedInt"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="mode">
          <choice>
            <value>auto</value>
            <value>native</value>
            <value>emulate</value>
            <value>paravirt</value>
518
            <value>smpsafe</value>
L
Laine Stump 已提交
519 520 521 522 523 524 525 526 527 528 529 530 531 532
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="present">
          <choice>
            <value>yes</value>
            <value>no</value>
          </choice>
        </attribute>
      </optional>
      <empty/>
    </element>
  </define>
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
  <define name="catchup">
    <element name="catchup">
      <optional>
        <attribute name="threshold">
          <ref name="unsignedInt"/>
        </attribute>
        <attribute name="slew">
          <ref name="unsignedInt"/>
        </attribute>
        <attribute name="limit">
          <ref name="unsignedInt"/>
        </attribute>
      </optional>
    </element>
  </define>
L
Laine Stump 已提交
548
<!--
549 550 551 552
      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.
    -->
553
  <define name="bootloader">
554
    <interleave>
555 556 557 558 559
      <element name="bootloader">
        <choice>
          <ref name="absFilePath"/>
          <empty/>
        </choice>
560 561
      </element>
      <optional>
562 563 564
        <element name="bootloader_args">
          <text/>
        </element>
565 566
      </optional>
    </interleave>
567
  </define>
568
  <define name="osbootkernel">
569
    <interleave>
570 571 572 573 574
      <optional>
        <element name="kernel">
          <ref name="absFilePath"/>
        </element>
      </optional>
575
      <optional>
576 577 578
        <element name="initrd">
          <ref name="absFilePath"/>
        </element>
579
      </optional>
580
      <optional>
581
        <element name="root">
582
          <ref name="absFilePath"/>
583 584
        </element>
      </optional>
585
      <optional>
586 587 588
        <element name="cmdline">
          <text/>
        </element>
589 590 591
      </optional>
    </interleave>
  </define>
592 593 594
  <define name="osbootdev">
    <element name="boot">
      <attribute name="dev">
595 596 597 598 599 600 601 602
        <choice>
          <value>hd</value>
          <value>fd</value>
          <value>cdrom</value>
          <value>network</value>
        </choice>
      </attribute>
      <empty/>
603
    </element>
604
  </define>
605
  <define name="diskspec">
606
    <optional>
607
      <ref name="driver"/>
608
    </optional>
609
    <ref name="target"/>
610 611 612
    <optional>
      <ref name="deviceBoot"/>
    </optional>
613
    <optional>
614
      <element name="readonly">
615
        <empty/>
616
      </element>
617 618
    </optional>
    <optional>
619
      <element name="shareable">
620 621 622
        <empty/>
      </element>
    </optional>
623 624 625 626 627
    <optional>
      <element name="serial">
        <ref name="diskSerial"/>
      </element>
    </optional>
628 629 630
    <optional>
      <ref name="encryption"/>
    </optional>
631 632 633
    <optional>
      <ref name="address"/>
    </optional>
634
  </define>
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657

  <define name="lease">
    <element name="lease">
      <interleave>
        <element name="lockspace">
          <text/>
        </element>
        <element name="key">
          <text/>
        </element>
        <element name="target">
          <attribute name="path">
            <text/>
          </attribute>
          <optional>
            <attribute name="offset">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
        </element>
      </interleave>
    </element>
  </define>
658 659 660 661 662
  <!--
      A disk description can be either of type file or block
      The name of the attribute on the source element depends on the type

    -->
663 664
  <define name="disk">
    <element name="disk">
665
      <optional>
666 667 668 669 670 671 672
        <attribute name="device">
          <choice>
            <value>floppy</value>
            <value>disk</value>
            <value>cdrom</value>
          </choice>
        </attribute>
673
      </optional>
674 675
      <choice>
        <group>
676 677
          <attribute name="type">
            <value>file</value>
678
          </attribute>
679 680 681 682 683 684 685 686 687 688 689
          <interleave>
            <optional>
              <element name="source">
                <attribute name="file">
                  <ref name="absFilePath"/>
                </attribute>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
690 691
        </group>
        <group>
692 693 694 695 696 697 698
          <attribute name="type">
            <value>block</value>
          </attribute>
          <interleave>
            <optional>
              <element name="source">
                <attribute name="dev">
699
                  <ref name="absFilePath"/>
700 701 702 703 704 705
                </attribute>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
706
        </group>
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
        <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>
M
MORITA Kazutaka 已提交
723 724 725 726 727 728 729 730 731 732 733 734 735 736
        <group>
          <attribute name="type">
            <value>network</value>
          </attribute>
          <interleave>
            <optional>
              <element name="source">
                <attribute name="protocol">
                  <choice>
                    <value>nbd</value>
                    <value>rbd</value>
                    <value>sheepdog</value>
                  </choice>
                </attribute>
737 738 739
                <optional>
                  <attribute name="name"/>
                </optional>
M
MORITA Kazutaka 已提交
740 741 742
                <zeroOrMore>
                  <element name="host">
                    <attribute name="name">
743
                      <ref name="dnsName"/>
M
MORITA Kazutaka 已提交
744 745 746 747 748 749 750 751 752 753 754 755
                    </attribute>
                    <attribute name="port">
                      <ref name="unsignedInt"/>
                    </attribute>
                  </element>
                </zeroOrMore>
                <empty/>
              </element>
            </optional>
            <ref name="diskspec"/>
          </interleave>
        </group>
756
        <ref name="diskspec"/>
757 758 759
      </choice>
    </element>
  </define>
760 761 762 763
  <define name="target">
    <element name="target">
      <attribute name="dev">
        <ref name="deviceName"/>
764
      </attribute>
765
      <optional>
766 767 768 769 770 771 772 773 774 775 776
        <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>
777
      </optional>
778 779 780
    </element>
  </define>
  <!--
781
      Disk may use a special driver for access. Currently this is
782 783 784
      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.
    -->
785 786
  <define name="driver">
    <element name="driver">
787
      <choice>
788 789 790 791 792 793 794 795 796 797 798 799
        <group>
          <ref name="driverFormat"/>
          <optional>
            <ref name="driverCache"/>
          </optional>
        </group>
        <group>
          <optional>
            <ref name="driverFormat"/>
          </optional>
          <ref name="driverCache"/>
        </group>
800
      </choice>
801 802 803
      <optional>
        <ref name="driverErrorPolicy"/>
      </optional>
M
Matthias Dahl 已提交
804 805 806
      <optional>
        <ref name="driverIO"/>
      </optional>
807 808 809
      <optional>
        <ref name="ioeventfd"/>
      </optional>
810 811 812
      <optional>
        <ref name="event_idx"/>
      </optional>
813 814
      <empty/>
    </element>
815
  </define>
816 817 818
  <define name="driverFormat">
    <attribute name="name">
      <ref name="genericName"/>
819 820
    </attribute>
    <optional>
821 822
      <attribute name="type">
        <ref name="genericName"/>
823 824 825
      </attribute>
    </optional>
  </define>
826 827
  <define name="driverCache">
    <attribute name="cache">
828
      <choice>
829 830 831
        <value>none</value>
        <value>writeback</value>
        <value>writethrough</value>
832
        <value>directsync</value>
833 834 835
      </choice>
    </attribute>
  </define>
836 837 838 839 840
  <define name="driverErrorPolicy">
    <attribute name="error_policy">
      <choice>
        <value>stop</value>
        <value>ignore</value>
841
        <value>enospace</value>
842 843 844
      </choice>
    </attribute>
  </define>
M
Matthias Dahl 已提交
845 846 847 848 849 850 851 852
  <define name="driverIO">
    <attribute name="io">
      <choice>
        <value>threads</value>
        <value>native</value>
      </choice>
    </attribute>
  </define>
853 854 855 856 857 858 859 860
  <define name="ioeventfd">
    <attribute name="ioeventfd">
      <choice>
        <value>on</value>
        <value>off</value>
      </choice>
    </attribute>
  </define>
861 862 863 864 865 866 867 868
  <define name="event_idx">
    <attribute name="event_idx">
      <choice>
        <value>on</value>
        <value>off</value>
      </choice>
    </attribute>
  </define>
869 870
  <define name="controller">
    <element name="controller">
871 872 873 874 875 876 877 878 879
      <choice>
        <group>
          <optional>
            <attribute name="type">
              <choice>
                <value>fdc</value>
                <value>ide</value>
                <value>scsi</value>
                <value>sata</value>
880
                <value>ccid</value>
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
              </choice>
            </attribute>
          </optional>
        </group>
        <!-- virtio-serial can have 2 additional attributes -->
        <group>
          <attribute name="type">
            <value>virtio-serial</value>
          </attribute>
          <optional>
            <attribute name="ports">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="vectors">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
        </group>
      </choice>
902 903 904
      <attribute name="index">
        <ref name="unsignedInt"/>
      </attribute>
905 906 907
      <optional>
        <attribute name="model">
          <choice>
908
            <value>auto</value>
909 910 911
            <value>buslogic</value>
            <value>lsilogic</value>
            <value>lsisas1068</value>
912
            <value>vmpvscsi</value>
M
Marc-André Lureau 已提交
913 914 915 916 917 918 919 920 921
            <value>piix3-uhci</value>
            <value>piix4-uhci</value>
            <value>ehci</value>
            <value>ich9-ehci1</value>
            <value>ich9-uhci1</value>
            <value>ich9-uhci2</value>
            <value>ich9-uhci3</value>
            <value>vt82c686b-uhci</value>
            <value>pci-ohci</value>
922 923 924
          </choice>
        </attribute>
      </optional>
925
      <optional>
M
Matthew Booth 已提交
926
        <ref name="address"/>
927 928 929
      </optional>
    </element>
  </define>
930 931
  <define name="filesystem">
    <element name="filesystem">
932 933
      <choice>
        <group>
934 935
          <attribute name="type">
            <value>file</value>
936
          </attribute>
937 938 939 940 941 942 943 944 945
          <interleave>
            <element name="source">
              <attribute name="file">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
946 947
        </group>
        <group>
948 949 950 951 952 953
          <attribute name="type">
            <value>block</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dev">
954
                <ref name="absFilePath"/>
955 956 957 958 959
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
960 961
        </group>
        <group>
962 963 964 965 966 967 968 969 970 971 972 973
          <attribute name="type">
            <value>mount</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dir">
                <ref name="absFilePath"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
974 975
        </group>
        <group>
976 977 978 979 980 981 982 983 984 985 986 987
          <attribute name="type">
            <value>template</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="name">
                <ref name="genericName"/>
              </attribute>
              <empty/>
            </element>
            <ref name="filesystemtgt"/>
          </interleave>
988 989
        </group>
      </choice>
990
      <optional>
M
Matthew Booth 已提交
991
        <ref name="address"/>
992 993 994 995 996 997 998
        <attribute name="accessmode">
        <choice>
          <value>passthrough</value>
          <value>mapped</value>
          <value>squash</value>
        </choice>
        </attribute>
999
      </optional>
1000 1001
    </element>
  </define>
1002 1003 1004 1005
  <define name="filesystemtgt">
    <element name="target">
      <attribute name="dir">
        <ref name="absDirPath"/>
1006 1007 1008 1009
      </attribute>
      <empty/>
    </element>
  </define>
1010
  <!--
1011 1012 1013
      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
1014
      options. FIXME
1015
    -->
1016 1017
  <define name="interface">
    <element name="interface">
1018 1019
      <choice>
        <group>
1020
          <attribute name="type">
1021 1022
            <value>bridge</value>
          </attribute>
1023
          <interleave>
1024
            <optional>
1025 1026 1027 1028 1029 1030
              <element name="source">
                <attribute name="bridge">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
1031
            </optional>
1032 1033 1034
            <ref name="interface-options"/>
          </interleave>
        </group>
1035
        <group>
1036
          <attribute name="type">
1037 1038
            <value>ethernet</value>
          </attribute>
1039
          <interleave>
1040
            <optional>
1041 1042 1043 1044 1045 1046
              <element name="source">
                <attribute name="dev">
                  <ref name="deviceName"/>
                </attribute>
                <empty/>
              </element>
1047
            </optional>
1048 1049 1050
            <ref name="interface-options"/>
          </interleave>
        </group>
1051
        <group>
1052
          <attribute name="type">
1053 1054
            <value>network</value>
          </attribute>
1055 1056 1057 1058 1059
          <interleave>
            <element name="source">
              <attribute name="network">
                <ref name="deviceName"/>
              </attribute>
1060 1061 1062 1063 1064
              <optional>
                <attribute name="portgroup">
                  <ref name="deviceName"/>
                </attribute>
              </optional>
1065 1066
              <empty/>
            </element>
1067 1068 1069
            <optional>
              <ref name="virtualPortProfile"/>
            </optional>
1070 1071 1072
            <ref name="interface-options"/>
          </interleave>
        </group>
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088
        <group>
          <attribute name="type">
            <value>direct</value>
          </attribute>
          <interleave>
            <element name="source">
              <attribute name="dev">
                <ref name="deviceName"/>
              </attribute>
              <optional>
                <attribute name="mode">
                  <ref name="bridgeMode"/>
                </attribute>
              </optional>
              <empty/>
            </element>
1089 1090 1091
            <optional>
              <ref name="virtualPortProfile"/>
            </optional>
1092 1093 1094
            <ref name="interface-options"/>
          </interleave>
        </group>
1095
        <group>
1096
          <attribute name="type">
1097 1098
            <value>user</value>
          </attribute>
1099 1100 1101 1102
          <interleave>
            <ref name="interface-options"/>
          </interleave>
        </group>
D
Daniel Veillard 已提交
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116
        <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>
1117 1118 1119 1120 1121 1122
      </choice>
    </element>
  </define>
  <!--
      The interface options possible are:
        - the MAC address
1123 1124 1125
        - the IP address bound to the interface
        - the name of the script used to set up the binding
        - the target device used
1126
        - boot order
1127
    -->
1128
  <define name="interface-options">
1129 1130
    <interleave>
      <optional>
1131 1132 1133 1134 1135 1136
        <element name="target">
          <attribute name="dev">
            <ref name="deviceName"/>
          </attribute>
          <empty/>
        </element>
1137 1138
      </optional>
      <optional>
1139 1140
        <element name="mac">
          <attribute name="address">
1141
            <ref name="macAddr"/>
1142 1143 1144
          </attribute>
          <empty/>
        </element>
1145 1146
      </optional>
      <optional>
1147 1148
        <element name="ip">
          <attribute name="address">
1149
            <ref name="ipv4Addr"/>
1150 1151 1152
          </attribute>
          <empty/>
        </element>
1153 1154
      </optional>
      <optional>
1155 1156 1157 1158 1159 1160
        <element name="script">
          <attribute name="path">
            <ref name="filePath"/>
          </attribute>
          <empty/>
        </element>
1161 1162
      </optional>
      <optional>
1163 1164 1165 1166
        <element name="model">
          <attribute name="type"/>
          <empty/>
        </element>
1167
      </optional>
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177
      <optional>
        <element name="driver">
          <optional>
            <attribute name="name">
              <choice>
                <value>qemu</value>
                <value>vhost</value>
              </choice>
            </attribute>
          </optional>
1178 1179 1180 1181 1182 1183 1184 1185
          <optional>
            <attribute name="txmode">
              <choice>
                <value>iothread</value>
                <value>timer</value>
              </choice>
            </attribute>
          </optional>
1186 1187 1188
          <optional>
            <ref name="ioeventfd"/>
          </optional>
1189 1190 1191
          <optional>
            <ref name="event_idx"/>
          </optional>
1192 1193 1194
          <empty/>
        </element>
      </optional>
1195
      <optional>
M
Matthew Booth 已提交
1196
        <ref name="address"/>
1197
      </optional>
1198 1199 1200 1201 1202
      <optional>
        <element name="filterref">
          <ref name="filterref-node-attributes"/>
        </element>
      </optional>
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
      <optional>
        <element name="tune">
          <optional>
            <!-- size of send buffer for network tap devices -->
            <element name="sndbuf">
              <ref name="unsignedInt"/>
            </element>
          </optional>
        </element>
      </optional>
1213 1214 1215
      <optional>
        <ref name="deviceBoot"/>
      </optional>
1216 1217 1218
      <optional>
        <ref name="bandwidth"/>
      </optional>
1219
    </interleave>
1220 1221
  </define>
  <!--
1222
      An emulator description is just a path to the binary used for the task
1223
    -->
1224 1225 1226
  <define name="emulator">
    <element name="emulator">
      <ref name="absFilePath"/>
1227 1228 1229
    </element>
  </define>
  <!--
1230
      A graphic description, currently in Xen only 2 types are supported:
1231
        - sdl with optional display, xauth and fullscreen
1232
        - vnc with a required port and optional listen IP address, password
1233
          and keymap
1234
    -->
1235 1236
  <define name="graphic">
    <element name="graphics">
1237
      <choice>
1238 1239 1240 1241 1242 1243 1244 1245 1246
        <group>
          <attribute name="type">
            <value>sdl</value>
          </attribute>
          <optional>
            <attribute name="display">
              <text/>
            </attribute>
          </optional>
1247
          <optional>
1248
            <attribute name="xauth">
1249 1250 1251
              <text/>
            </attribute>
          </optional>
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
          <optional>
            <attribute name="fullscreen">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
        </group>
        <group>
          <attribute name="type">
            <value>vnc</value>
          </attribute>
1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
          <choice>
            <group>
              <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">
1282
                  <ref name="addrIPorName"/>
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
                </attribute>
              </optional>
            </group>
            <group>
              <optional>
                <attribute name="socket">
                  <ref name="absFilePath"/>
                </attribute>
              </optional>
            </group>
          </choice>
1294 1295
          <optional>
            <attribute name="passwd">
1296 1297 1298 1299 1300 1301 1302 1303
              <text/>
            </attribute>
          </optional>
          <optional>
            <attribute name="keymap">
              <text/>
            </attribute>
          </optional>
1304 1305 1306 1307 1308
          <optional>
            <attribute name="passwdValidTo">
              <data type="dateTime"/>
            </attribute>
          </optional>
1309 1310 1311 1312 1313 1314 1315
          <optional>
            <attribute name="connected">
              <choice>
                <value>keep</value>
              </choice>
            </attribute>
          </optional>
1316
          <ref name="listenElements"/>
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
        </group>
        <group>
          <attribute name="type">
            <value>spice</value>
          </attribute>
          <optional>
            <attribute name="port">
              <ref name="PortNumber"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="tlsPort">
              <ref name="PortNumber"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="autoport">
              <choice>
                <value>yes</value>
                <value>no</value>
              </choice>
            </attribute>
          </optional>
          <optional>
            <attribute name="listen">
1342
              <ref name="addrIPorName"/>
1343 1344 1345 1346
            </attribute>
          </optional>
          <optional>
            <attribute name="passwd">
1347 1348 1349 1350 1351 1352 1353 1354
              <text/>
            </attribute>
          </optional>
          <optional>
            <attribute name="keymap">
              <text/>
            </attribute>
          </optional>
1355 1356 1357 1358 1359
          <optional>
            <attribute name="passwdValidTo">
              <data type="dateTime"/>
            </attribute>
          </optional>
1360 1361 1362 1363 1364 1365 1366 1367 1368
          <optional>
            <attribute name="connected">
              <choice>
                <value>fail</value>
                <value>disconnect</value>
                <value>keep</value>
              </choice>
            </attribute>
          </optional>
1369
          <interleave>
1370
            <ref name="listenElements"/>
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
            <zeroOrMore>
              <element name="channel">
                <attribute name="name">
                  <choice>
                    <value>main</value>
                    <value>display</value>
                    <value>inputs</value>
                    <value>cursor</value>
                    <value>playback</value>
                    <value>record</value>
                    <value>smartcard</value>
                  </choice>
                </attribute>
                <attribute name="mode">
                  <choice>
                    <value>any</value>
                    <value>secure</value>
                    <value>insecure</value>
                  </choice>
                </attribute>
                <empty/>
              </element>
            </zeroOrMore>
            <optional>
              <element name="image">
                <attribute name="compression">
                  <choice>
                    <value>auto_glz</value>
                    <value>auto_lz</value>
                    <value>quic</value>
                    <value>glz</value>
                    <value>lz</value>
                    <value>off</value>
                  </choice>
                </attribute>
                <empty/>
              </element>
            </optional>
            <optional>
              <element name="jpeg">
                <attribute name="compression">
                  <choice>
                    <value>auto</value>
                    <value>never</value>
                    <value>always</value>
                  </choice>
                </attribute>
                <empty/>
              </element>
            </optional>
            <optional>
              <element name="zlib">
                <attribute name="compression">
                  <choice>
                    <value>auto</value>
                    <value>never</value>
                    <value>always</value>
                  </choice>
                </attribute>
                <empty/>
              </element>
            </optional>
            <optional>
              <element name="playback">
                <attribute name="compression">
                  <choice>
                    <value>on</value>
                    <value>off</value>
                  </choice>
                </attribute>
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452
                <empty/>
              </element>
            </optional>
            <optional>
              <element name="streaming">
                <attribute name="mode">
                  <choice>
                    <value>filter</value>
                    <value>all</value>
                    <value>off</value>
                  </choice>
                </attribute>
1453 1454 1455
                <empty/>
              </element>
            </optional>
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466
            <optional>
              <element name="clipboard">
                <attribute name="copypaste">
                  <choice>
                    <value>yes</value>
                    <value>no</value>
                  </choice>
                </attribute>
                <empty/>
              </element>
            </optional>
1467
          </interleave>
1468
        </group>
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503
        <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">
1504
              <ref name="addrIPorName"/>
1505 1506
            </attribute>
          </optional>
1507
          <ref name="listenElements"/>
1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526
        </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>
1527 1528 1529
      </choice>
    </element>
  </define>
1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559

  <define name="listenElements">
    <zeroOrMore>
      <element name="listen">
        <choice>
          <group>
            <attribute name="type">
              <value>address</value>
            </attribute>
            <attribute name="address">
              <ref name="addrIPorName"/>
            </attribute>
          </group>
          <group>
            <attribute name="type">
              <value>network</value>
            </attribute>
            <attribute name="network">
              <text/>
            </attribute>
            <optional>
              <attribute name="address">
                <ref name="addrIPorName"/>
              </attribute>
            </optional>
          </group>
        </choice>
      </element>
    </zeroOrMore>
  </define>
1560
  <!--
1561 1562
     A video adapter description, allowing configuration of device
     model, number of virtual heads, and video ram size
1563 1564 1565 1566
   -->
  <define name="video">
    <element name="video">
      <optional>
R
Richard Jones 已提交
1567
        <element name="model">
1568 1569 1570 1571 1572 1573 1574
          <attribute name="type">
            <choice>
              <value>vga</value>
              <value>cirrus</value>
              <value>vmvga</value>
              <value>xen</value>
              <value>vbox</value>
1575
              <value>qxl</value>
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
            </choice>
          </attribute>
          <optional>
            <attribute name="vram">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
          <optional>
            <attribute name="heads">
              <ref name="unsignedInt"/>
            </attribute>
          </optional>
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
          <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 已提交
1608
        </element>
1609
      </optional>
1610 1611 1612
      <optional>
        <ref name="address"/>
      </optional>
1613 1614
    </element>
  </define>
1615 1616 1617 1618
  <!--
      When a domain terminates multiple policies can be applied depending
      on how it ended:
    -->
1619
  <define name="termination">
1620 1621
    <interleave>
      <optional>
1622 1623 1624
        <element name="on_reboot">
          <ref name="offOptions"/>
        </element>
1625 1626
      </optional>
      <optional>
1627 1628 1629
        <element name="on_poweroff">
          <ref name="offOptions"/>
        </element>
1630 1631
      </optional>
      <optional>
1632
        <element name="on_crash">
1633
          <ref name="crashOptions"/>
1634
        </element>
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645
      </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
    -->
1646
  <define name="offOptions">
1647 1648 1649 1650 1651 1652 1653
    <choice>
      <value>destroy</value>
      <value>restart</value>
      <value>preserve</value>
      <value>rename-restart</value>
    </choice>
  </define>
1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676
  <!--
      Options when a domain crashes:
      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
      coredump-destroy: The crashed domain's core will be dumped, and then the
                        domain will be terminated completely and all resources
                        released
      coredump-restart: The crashed domain's core will be dumped, and then the
                        domain will be restarted with the same configuration
    -->
  <define name="crashOptions">
    <choice>
      <value>destroy</value>
      <value>restart</value>
      <value>preserve</value>
      <value>rename-restart</value>
      <value>coredump-destroy</value>
      <value>coredump-restart</value>
    </choice>
  </define>
1677 1678 1679 1680
  <!--
      Specific setup for a qemu emulated character device.  Note: this
      definition doesn't fully specify the constraints on this node.
    -->
1681
  <define name="qemucdev">
1682
    <ref name="qemucdevSrcType"/>
1683 1684
    <optional>
      <attribute name="tty">
1685
        <ref name="absFilePath"/>
1686 1687
      </attribute>
    </optional>
1688 1689 1690
    <interleave>
      <ref name="qemucdevSrcDef"/>
      <optional>
1691
        <ref name="qemucdevTgtDef"/>
1692
      </optional>
1693
      <optional>
M
Matthew Booth 已提交
1694
        <ref name="address"/>
1695
      </optional>
1696 1697
    </interleave>
  </define>
1698 1699 1700 1701 1702 1703 1704

  <define name="qemucdevConsoleTgtType">
    <attribute name="type">
      <choice>
        <value>xen</value>
        <value>serial</value>
        <value>uml</value>
C
Cole Robinson 已提交
1705
        <value>virtio</value>
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722
      </choice>
    </attribute>
  </define>

  <define  name="qemucdevTgtDef">
    <element name="target">
      <interleave>
        <optional>
          <ref name="qemucdevConsoleTgtType"/>
        </optional>
        <optional>
          <attribute name="port"/>
        </optional>
      </interleave>
    </element>
  </define>

1723
  <define name="qemucdevSrcType">
1724
    <attribute name="type">
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735
      <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>
1736
        <value>spicevmc</value>
1737 1738
      </choice>
    </attribute>
1739 1740
  </define>
  <define name="qemucdevSrcDef">
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759
    <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>
1760 1761 1762
    <optional>
      <element name="protocol">
        <optional>
1763 1764 1765 1766 1767 1768 1769 1770
          <attribute name="type">
            <choice>
              <value>raw</value>
              <value>telnet</value>
              <value>telnets</value>
              <value>tls</value>
            </choice>
          </attribute>
1771 1772 1773
        </optional>
      </element>
    </optional>
1774
  </define>
1775 1776 1777 1778
  <!--
      The description for a console
      just a tty device
    -->
1779 1780
  <define name="console">
    <element name="console">
1781 1782 1783
      <choice>
        <group>
          <optional>
1784
            <attribute name="tty">
1785
              <ref name="absFilePath"/>
1786 1787 1788 1789
            </attribute>
          </optional>
          <empty/>
        </group>
C
Cole Robinson 已提交
1790 1791 1792
        <choice>
          <ref name="qemucdev"/>
        </choice>
1793 1794 1795
      </choice>
    </element>
  </define>
1796 1797 1798
  <define name="sound">
    <element name="sound">
      <attribute name="model">
1799 1800 1801 1802
        <choice>
          <value>sb16</value>
          <value>es1370</value>
          <value>pcspk</value>
1803
          <value>ac97</value>
1804
          <value>ich6</value>
1805
        </choice>
1806
      </attribute>
1807 1808 1809
      <optional>
        <ref name="address"/>
      </optional>
1810 1811
    </element>
  </define>
R
Richard Jones 已提交
1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827
  <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>
1828
            <value>dump</value>
R
Richard Jones 已提交
1829 1830 1831
          </choice>
        </attribute>
      </optional>
1832 1833 1834
      <optional>
        <ref name="address"/>
      </optional>
R
Richard Jones 已提交
1835 1836
    </element>
  </define>
1837 1838 1839 1840 1841 1842
  <define name="memballoon">
    <element name="memballoon">
      <attribute name="model">
        <choice>
          <value>virtio</value>
          <value>xen</value>
1843
          <value>none</value>
1844 1845 1846 1847 1848 1849 1850
        </choice>
      </attribute>
      <optional>
        <ref name="address"/>
      </optional>
    </element>
  </define>
1851 1852 1853
  <define name="parallel">
    <element name="parallel">
      <ref name="qemucdev"/>
1854 1855
    </element>
  </define>
1856 1857 1858
  <define name="serial">
    <element name="serial">
      <ref name="qemucdev"/>
1859 1860
    </element>
  </define>
1861 1862
  <define name="guestfwdTarget">
    <element name="target">
1863 1864 1865 1866 1867
      <attribute name="type">
        <value>guestfwd</value>
      </attribute>
      <attribute name="address"/>
      <attribute name="port"/>
1868 1869
    </element>
  </define>
1870 1871 1872
  <define name="virtioTarget">
    <element name="target">
      <attribute name="type">
1873
        <value>virtio</value>
1874 1875 1876 1877 1878 1879
      </attribute>
      <optional>
        <attribute name="name"/>
      </optional>
    </element>
  </define>
1880 1881 1882 1883 1884
  <define name="channel">
    <element name="channel">
      <ref name="qemucdevSrcType"/>
      <interleave>
        <ref name="qemucdevSrcDef"/>
1885 1886 1887 1888
        <choice>
          <ref name="guestfwdTarget"/>
          <ref name="virtioTarget"/>
        </choice>
M
Matthew Booth 已提交
1889 1890 1891
        <optional>
          <ref name="address"/>
        </optional>
1892 1893 1894
      </interleave>
    </element>
  </define>
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939
  <define name="smartcard">
    <element name="smartcard">
      <choice>
        <group>
          <attribute name="mode">
            <value>host</value>
          </attribute>
          <!-- might need to add optional database element here later -->
        </group>
        <group>
          <attribute name="mode">
            <value>host-certificates</value>
          </attribute>
          <ref name='certificate'/>
          <ref name='certificate'/>
          <ref name='certificate'/>
          <optional>
            <element name="database">
              <ref name="absDirPath"/>
            </element>
          </optional>
        </group>
        <group>
          <attribute name="mode">
            <value>passthrough</value>
          </attribute>
          <ref name="qemucdevSrcType"/>
          <interleave>
            <ref name="qemucdevSrcDef"/>
            <optional>
              <ref name="qemucdevTgtDef"/>
            </optional>
          </interleave>
        </group>
      </choice>
      <optional>
        <ref name="address"/>
      </optional>
    </element>
  </define>
  <define name="certificate">
    <element name="certificate">
      <text/>
    </element>
  </define>
1940 1941 1942
  <define name="input">
    <element name="input">
      <attribute name="type">
1943 1944 1945 1946 1947 1948
        <choice>
          <value>tablet</value>
          <value>mouse</value>
        </choice>
      </attribute>
      <optional>
1949
        <attribute name="bus">
1950 1951 1952 1953 1954 1955 1956
          <choice>
            <value>ps2</value>
            <value>usb</value>
            <value>xen</value>
          </choice>
        </attribute>
      </optional>
1957
      <optional>
M
Matthew Booth 已提交
1958
        <ref name="address"/>
1959
      </optional>
1960 1961
    </element>
  </define>
1962 1963
  <define name="hostdev">
    <element name="hostdev">
1964
      <optional>
1965
        <attribute name="mode">
1966
          <choice>
1967 1968 1969 1970
            <value>subsystem</value>
            <value>capabilities</value>
          </choice>
        </attribute>
1971 1972 1973 1974 1975 1976 1977 1978
      </optional>
      <attribute name="type">
        <choice>
          <value>usb</value>
          <value>pci</value>
        </choice>
      </attribute>
      <optional>
1979 1980 1981 1982
        <attribute name="managed">
          <choice>
            <value>yes</value>
            <value>no</value>
1983 1984 1985 1986
          </choice>
        </attribute>
      </optional>
      <group>
1987 1988
        <element name="source">
          <choice>
M
Matthew Booth 已提交
1989
            <group>
1990
              <ref name="usbproduct"/>
M
Matthew Booth 已提交
1991 1992 1993 1994
              <optional>
                <ref name="usbaddress"/>
              </optional>
            </group>
1995
            <ref name="usbaddress"/>
1996 1997 1998
            <element name="address">
              <ref name="pciaddress"/>
            </element>
1999 2000
          </choice>
        </element>
2001
      </group>
2002 2003 2004
      <optional>
        <ref name="deviceBoot"/>
      </optional>
2005 2006 2007
      <optional>
        <ref name="address"/>
      </optional>
2008 2009 2010 2011 2012
    </element>
  </define>
  <define name="usbproduct">
    <element name="vendor">
      <attribute name="id">
2013
        <ref name="usbId"/>
2014 2015 2016 2017
      </attribute>
    </element>
    <element name="product">
      <attribute name="id">
2018
        <ref name="usbId"/>
2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031
      </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>
2032
  <define name="pciaddress">
2033 2034 2035
    <optional>
      <attribute name="domain">
        <ref name="pciDomain"/>
2036
      </attribute>
2037 2038 2039 2040 2041 2042 2043 2044 2045 2046
    </optional>
    <attribute name="bus">
      <ref name="pciBus"/>
    </attribute>
    <attribute name="slot">
      <ref name="pciSlot"/>
    </attribute>
    <attribute name="function">
      <ref name="pciFunc"/>
    </attribute>
2047
  </define>
2048 2049 2050 2051 2052 2053 2054 2055
  <define name="driveaddress">
    <optional>
      <attribute name="controller">
        <ref name="driveController"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="bus">
M
Matthew Booth 已提交
2056
        <ref name="driveBus"/>
2057 2058 2059 2060 2061 2062
      </attribute>
    </optional>
    <attribute name="unit">
      <ref name="driveUnit"/>
    </attribute>
  </define>
2063 2064 2065 2066 2067 2068 2069 2070 2071
  <define name="virtioserialaddress">
    <attribute name="controller">
      <ref name="driveController"/>
    </attribute>
    <optional>
      <attribute name="bus">
        <ref name="driveBus"/>
      </attribute>
    </optional>
2072 2073 2074 2075 2076
    <optional>
      <attribute name="port">
        <ref name="driveUnit"/>
      </attribute>
    </optional>
2077
  </define>
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087
  <define name="ccidaddress">
    <attribute name="controller">
      <ref name="driveController"/>
    </attribute>
    <optional>
      <attribute name="slot">
        <ref name="driveUnit"/>
      </attribute>
    </optional>
  </define>
2088
  <!--
2089
      Devices attached to a domain.
2090 2091 2092
      Sub-elements such as <alias> are not documented here, as they
      can only exist when generated for a live domain and are ignored
      when defining a domain.
2093
    -->
2094 2095
  <define name="devices">
    <element name="devices">
2096
      <interleave>
2097 2098 2099 2100 2101 2102
        <optional>
          <ref name="emulator"/>
        </optional>
        <zeroOrMore>
          <choice>
            <ref name="disk"/>
2103
            <ref name="controller"/>
2104
            <ref name="lease"/>
2105 2106 2107 2108 2109 2110
            <ref name="filesystem"/>
            <ref name="interface"/>
            <ref name="input"/>
            <ref name="sound"/>
            <ref name="hostdev"/>
            <ref name="graphic"/>
2111
            <ref name="video"/>
2112 2113 2114
            <ref name="console"/>
            <ref name="parallel"/>
            <ref name="serial"/>
2115
            <ref name="channel"/>
2116
            <ref name="smartcard"/>
2117 2118
          </choice>
        </zeroOrMore>
R
Richard Jones 已提交
2119 2120 2121
        <optional>
          <ref name="watchdog"/>
        </optional>
2122 2123 2124
        <optional>
          <ref name="memballoon"/>
        </optional>
2125 2126 2127
      </interleave>
    </element>
  </define>
2128
  <!--
J
Jim Fehlig 已提交
2129
      A set of optional features: PAE, APIC, ACPI, and HAP support
2130
    -->
2131
  <define name="features">
2132 2133 2134
    <optional>
      <element name="features">
        <interleave>
2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149
          <optional>
            <element name="pae">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="apic">
              <empty/>
            </element>
          </optional>
          <optional>
            <element name="acpi">
              <empty/>
            </element>
          </optional>
J
Jim Fehlig 已提交
2150 2151 2152 2153 2154
          <optional>
            <element name="hap">
              <empty/>
            </element>
          </optional>
2155
        </interleave>
2156 2157 2158
      </element>
    </optional>
  </define>
J
Jiri Denemark 已提交
2159 2160 2161 2162 2163
  <!--
      CPU specification
      -->
  <define name="cpu">
    <element name="cpu">
2164 2165 2166 2167 2168 2169 2170
      <choice>
        <ref name="cpuTopology"/>
        <group>
          <ref name="cpuMatch"/>
          <interleave>
            <ref name="cpuModel"/>
            <optional>
J
Jiri Denemark 已提交
2171
              <ref name="cpuVendor"/>
J
Jiri Denemark 已提交
2172 2173
            </optional>
            <optional>
2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200
              <ref name="cpuTopology"/>
            </optional>
            <zeroOrMore>
              <ref name="cpuFeature"/>
            </zeroOrMore>
          </interleave>
        </group>
      </choice>
    </element>
  </define>

  <define name="cpuMatch">
    <attribute name="match">
      <choice>
        <value>minimum</value>
        <value>exact</value>
        <value>strict</value>
      </choice>
    </attribute>
  </define>

  <define name="cpuModel">
    <element name="model">
      <text/>
    </element>
  </define>

J
Jiri Denemark 已提交
2201 2202 2203 2204 2205 2206
  <define name="cpuVendor">
    <element name="vendor">
      <text/>
    </element>
  </define>

2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235
  <define name="cpuFeature">
    <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>
  </define>

  <define name="cpuTopology">
    <element name="topology">
      <attribute name="sockets">
        <ref name="positiveInteger"/>
      </attribute>
      <attribute name="cores">
        <ref name="positiveInteger"/>
      </attribute>
      <attribute name="threads">
        <ref name="positiveInteger"/>
      </attribute>
J
Jiri Denemark 已提交
2236 2237
    </element>
  </define>
2238

2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301
  <!--
      System information specification:
       Placeholder for system specific informations likes the ones
       contained in the SMBIOS area.
       Only a limited subset of entries can be modified there, so we
       fully enumerate each case here.
       The DMTF spec doesn't specify any string subset, just 0 terminated
       byte strings, but better be safe and restrict at least the names
       to avoid problems with space normalization in attribute values,
       the value is kept as the element body for maximum flexibility.
       A priori we allow only type 0 and type 1 string updates
      -->
  <define name="sysinfo">
    <element name="sysinfo">
      <attribute name="type">
        <value>smbios</value>
      </attribute>
      <interleave>
        <optional>
          <element name="bios">
            <oneOrMore>
              <element name="entry">
                <attribute name="name">
                  <ref name="sysinfo-bios-name"/>
                </attribute>
                <ref name="sysinfo-value"/>
              </element>
            </oneOrMore>
          </element>
        </optional>
        <optional>
          <element name="system">
            <oneOrMore>
              <element name="entry">
                <attribute name="name">
                  <ref name="sysinfo-system-name"/>
                </attribute>
                <ref name="sysinfo-value"/>
              </element>
            </oneOrMore>
          </element>
        </optional>
      </interleave>
    </element>
  </define>

  <define name="sysinfo-bios-name">
    <choice>
      <value>vendor</value>
      <value>version</value>
      <value>date</value>
      <value>release</value>
    </choice>
  </define>

  <define name="sysinfo-system-name">
    <choice>
      <value>manufacturer</value>
      <value>product</value>
      <value>version</value>
      <value>serial</value>
      <value>uuid</value>
      <value>sku</value>
E
Eric Blake 已提交
2302
      <value>family</value>
2303 2304 2305 2306 2307
    </choice>
  </define>

  <define name="sysinfo-value">
    <data type="string">
E
Eric Blake 已提交
2308
      <param name='pattern'>[a-zA-Z0-9/\-_\. \(\)]+</param>
2309 2310 2311
    </data>
  </define>

2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324
  <define name="smbios">
    <element name="smbios">
      <attribute name="mode">
        <choice>
          <value>emulate</value>
          <value>host</value>
          <value>sysinfo</value>
        </choice>
      </attribute>
      <empty/>
    </element>
  </define>

M
Michal Privoznik 已提交
2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335
  <define name="bios">
    <element name="bios">
      <attribute name="useserial">
        <choice>
          <value>yes</value>
          <value>no</value>
        </choice>
      </attribute>
    </element>
  </define>

2336 2337 2338
  <define name="address">
    <element name="address">
      <choice>
M
Matthew Booth 已提交
2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350
        <group>
          <attribute name="type">
            <value>pci</value>
          </attribute>
          <ref name="pciaddress"/>
        </group>
        <group>
          <attribute name="type">
            <value>drive</value>
          </attribute>
          <ref name="driveaddress"/>
        </group>
2351 2352 2353 2354 2355 2356
        <group>
          <attribute name="type">
            <value>virtio-serial</value>
          </attribute>
          <ref name="virtioserialaddress"/>
        </group>
2357 2358 2359 2360 2361 2362
        <group>
          <attribute name="type">
            <value>ccid</value>
          </attribute>
          <ref name="ccidaddress"/>
        </group>
2363 2364 2365 2366
      </choice>
    </element>
  </define>

2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382
  <define name="filterref-node-attributes">
    <attribute name="filter">
      <data type="NCName"/>
    </attribute>
    <optional>
      <element name="parameter">
        <attribute name="name">
          <ref name="filter-param-name"/>
        </attribute>
        <attribute name="value">
          <ref name="filter-param-value"/>
        </attribute>
      </element>
    </optional>
  </define>

2383 2384 2385 2386 2387 2388 2389 2390 2391
  <define name="deviceBoot">
    <element name="boot">
      <attribute name="order">
        <ref name="positiveInteger"/>
      </attribute>
      <empty/>
    </element>
  </define>

2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416
  <!--
       Optional hypervisor extensions in their own namespace:
         QEmu
    -->
  <define name="qemucmdline">
    <element name="commandline" ns="http://libvirt.org/schemas/domain/qemu/1.0">
      <zeroOrMore>
        <element name="arg">
          <attribute name='value'/>
        </element>
      </zeroOrMore>
      <zeroOrMore>
        <element name="env">
          <attribute name='name'>
            <ref name="filter-param-name"/>
          </attribute>
          <optional>
            <attribute name='value'/>
          </optional>
          <empty/>
        </element>
      </zeroOrMore>
    </element>
  </define>

2417 2418 2419
  <!--
       Type library

2420
       A domain name should be made of ascii, numbers, _-+ and is non-empty
2421
       memoryKB request at least 4Mbytes though Xen will grow bigger if too low
2422
       weight currently is in range [100, 1000]
2423
    -->
E
Eric Blake 已提交
2424 2425 2426 2427 2428
  <define name="cpuset">
    <data type="string">
      <param name="pattern">([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))*</param>
    </data>
  </define>
2429 2430
  <define name="countCPU">
    <data type="unsignedShort">
2431 2432 2433 2434
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1</param>
    </data>
  </define>
2435 2436 2437 2438 2439 2440 2441 2442 2443
  <define name="vcpuid">
    <data type="unsignedShort">
      <param name="pattern">[0-9]+</param>
    </data>
  </define>
  <define name="cpushares">
    <data type="unsignedInt">
      <param name="pattern">[0-9]+</param>
    </data>
W
Wen Congyang 已提交
2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458
  </define>
  <define name="cpuperiod">
    <data type="unsignedLong">
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">1000</param>
      <param name="maxInclusive">1000000</param>
    </data>
  </define>
  <define name="cpuquota">
    <data type="long">
      <param name="pattern">-?[0-9]+</param>
      <param name="maxInclusive">18446744073709551</param>
      <param name='minInclusive'>-1</param>
    </data>
  </define>
2459 2460
  <define name="PortNumber">
    <data type="short">
2461
      <param name="minInclusive">-1</param>
2462 2463
    </data>
  </define>
2464 2465 2466 2467 2468 2469 2470
  <define name="weight">
    <data type="unsignedInt">
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">100</param>
      <param name="maxInclusive">1000</param>
    </data>
  </define>
2471 2472
  <define name="memoryKB">
    <data type="unsignedInt">
2473 2474 2475 2476
      <param name="pattern">[0-9]+</param>
      <param name="minInclusive">4000</param>
    </data>
  </define>
2477 2478
  <define name="domainName">
    <data type="string">
2479
      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
2480 2481
    </data>
  </define>
2482 2483 2484 2485 2486
  <define name="diskSerial">
    <data type="string">
      <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
    </data>
  </define>
2487 2488
  <define name="genericName">
    <data type="string">
2489 2490 2491
      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
    </data>
  </define>
2492 2493
  <define name="bridgeMode">
    <data type="string">
2494
      <param name="pattern">(vepa|bridge|private|passthrough)</param>
2495 2496
    </data>
  </define>
2497 2498 2499 2500 2501
  <define name="addrIPorName">
    <data type="string">
      <param name="pattern">(([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9])|(([0-9a-fA-F]+|:)+[0-9a-fA-F]+)|([a-zA-Z0-9_\.\+\-]*)</param>
    </data>
  </define>
2502 2503
  <define name="usbId">
    <data type="string">
2504 2505 2506
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
2507 2508
  <define name="usbAddr">
    <data type="string">
2509 2510 2511
      <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
    </data>
  </define>
2512 2513
  <define name="pciDomain">
    <data type="string">
2514 2515 2516
      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
    </data>
  </define>
2517 2518
  <define name="pciBus">
    <data type="string">
2519 2520 2521
      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
    </data>
  </define>
2522 2523
  <define name="pciSlot">
    <data type="string">
2524 2525 2526
      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
    </data>
  </define>
2527 2528
  <define name="pciFunc">
    <data type="string">
2529 2530 2531
      <param name="pattern">(0x)?[0-7]</param>
    </data>
  </define>
2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546
  <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 已提交
2547 2548 2549 2550 2551
  <define name="featureName">
    <data type="string">
      <param name='pattern'>[a-zA-Z0-9\-_]+</param>
    </data>
  </define>
2552 2553 2554 2555 2556
  <define name="timeDelta">
    <data type="string">
      <param name="pattern">(-|\+)?[0-9]+</param>
    </data>
  </define>
2557 2558 2559 2560 2561
  <define name="timeZone">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\.\+\-/]+</param>
    </data>
  </define>
2562 2563 2564 2565 2566 2567 2568 2569 2570 2571
  <define name="filter-param-name">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_]+</param>
    </data>
  </define>
  <define name="filter-param-value">
    <data type="string">
      <param name="pattern">[a-zA-Z0-9_\.:]+</param>
    </data>
  </define>
2572
</grammar>