File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libxml2 / test / relaxng / libvirt.rng
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:37:59 2012 UTC (12 years, 7 months ago) by misho
Branches: libxml2, MAIN
CVS tags: v2_9_1p0, v2_9_1, v2_8_0p0, v2_8_0, v2_7_8, HEAD
libxml2

    1: <?xml version="1.0"?>
    2: <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
    3:   <!-- We handle only document defining a domain -->
    4:   <start>
    5:     <ref name="domain"/>
    6:   </start>
    7: 
    8:   <!--
    9:       We handle only document defining a domain
   10:     -->
   11:   <define name="domain">
   12:     <element name="domain">
   13:       <ref name="hvs"/>
   14:       <ref name="ids"/>
   15:       <interleave>
   16:         <ref name="os"/>
   17:         <ref name="clock"/>
   18:         <ref name="resources"/>
   19:         <ref name="features"/>
   20:         <ref name="termination"/>
   21:         <optional>
   22:           <ref name="devices"/>
   23:         </optional>
   24:         <optional>
   25:           <ref name="seclabel"/>
   26:         </optional>
   27:       </interleave>
   28:     </element>
   29:   </define>
   30:   <define name="seclabel">
   31:     <element name="seclabel">
   32:       <attribute name="model">
   33:         <text/>
   34:       </attribute>
   35:       <attribute name="type">
   36:         <choice>
   37:           <value>dynamic</value>
   38:           <value>static</value>
   39:         </choice>
   40:       </attribute>
   41:       <element name="label">
   42:         <text/>
   43:       </element>
   44:     </element>
   45:   </define>
   46:   <define name="hvs">
   47:     <attribute name="type">
   48:       <choice>
   49:         <value>xen</value>
   50:         <value>kvm</value>
   51:         <value>kqemu</value>
   52:         <value>qemu</value>
   53:         <value>lxc</value>
   54:         <value>openvz</value>
   55:         <value>test</value>
   56:       </choice>
   57:     </attribute>
   58:   </define>
   59:   <define name="os">
   60:     <choice>
   61:       <ref name="osxen"/>
   62:       <ref name="oshvm"/>
   63:       <ref name="osexe"/>
   64:     </choice>
   65:   </define>
   66:   <define name="osxen">
   67:     <choice>
   68:       <group>
   69:         <optional>
   70:           <ref name="bootloader"/>
   71:         </optional>
   72:         <element name="os">
   73:           <ref name="ostypexen"/>
   74:           <ref name="osbootkernel"/>
   75:         </element>
   76:       </group>
   77:       <group>
   78:         <ref name="bootloader"/>
   79:         <optional>
   80:           <element name="os">
   81:             <ref name="ostypexen"/>
   82:             <optional>
   83:               <ref name="osbootkernel"/>
   84:             </optional>
   85:           </element>
   86:         </optional>
   87:       </group>
   88:     </choice>
   89:   </define>
   90:   <define name="oshvm">
   91:     <element name="os">
   92:       <ref name="ostypehvm"/>
   93:       <interleave>
   94:         <optional>
   95:           <element name="loader">
   96:             <ref name="absFilePath"/>
   97:           </element>
   98:         </optional>
   99:         <choice>
  100:           <ref name="osbootkernel"/>
  101:           <ref name="osbootdev"/>
  102:         </choice>
  103:       </interleave>
  104:     </element>
  105:   </define>
  106:   <define name="ostypexen">
  107:     <element name="type">
  108:       <optional>
  109:         <attribute name="arch">
  110:           <choice>
  111:             <value>i686</value>
  112:             <value>x86_64</value>
  113:             <value>ia64</value>
  114:           </choice>
  115:         </attribute>
  116:       </optional>
  117:       <optional>
  118:         <attribute name="machine">
  119:           <choice>
  120:             <value>xenpv</value>
  121:             <value>xenner</value>
  122:           </choice>
  123:         </attribute>
  124:       </optional>
  125:       <choice>
  126:         <value>xen</value>
  127:         <value>linux</value>
  128:       </choice>
  129:     </element>
  130:   </define>
  131:   <define name="ostypehvm">
  132:     <element name="type">
  133:       <optional>
  134:         <choice>
  135:           <ref name="hvmx86"/>
  136:           <ref name="hvmmips"/>
  137:           <ref name="hvmsparc"/>
  138:           <ref name="hvmppc"/>
  139:         </choice>
  140:       </optional>
  141:       <value>hvm</value>
  142:     </element>
  143:   </define>
  144:   <define name="hvmx86">
  145:     <group>
  146:       <attribute name="arch">
  147:         <choice>
  148:           <value>i686</value>
  149:           <value>x86_64</value>
  150:         </choice>
  151:       </attribute>
  152:       <attribute name="machine">
  153:         <choice>
  154:           <value>xenfv</value>
  155:           <value>pc</value>
  156:           <value>isapc</value>
  157:         </choice>
  158:       </attribute>
  159:     </group>
  160:   </define>
  161:   <define name="hvmmips">
  162:     <group>
  163:       <attribute name="arch">
  164:         <value>mips</value>
  165:       </attribute>
  166:       <attribute name="machine">
  167:         <value>mips</value>
  168:       </attribute>
  169:     </group>
  170:   </define>
  171:   <define name="hvmsparc">
  172:     <group>
  173:       <attribute name="arch">
  174:         <value>sparc</value>
  175:       </attribute>
  176:       <attribute name="machine">
  177:         <value>sun4m</value>
  178:       </attribute>
  179:     </group>
  180:   </define>
  181:   <define name="hvmppc">
  182:     <group>
  183:       <attribute name="arch">
  184:         <value>ppc</value>
  185:       </attribute>
  186:       <attribute name="machine">
  187:         <choice>
  188:           <value>g3beige</value>
  189:           <value>mac99</value>
  190:           <value>prep</value>
  191:         </choice>
  192:       </attribute>
  193:     </group>
  194:   </define>
  195:   <define name="osexe">
  196:     <element name="os">
  197:       <element name="type">
  198:         <value>exe</value>
  199:       </element>
  200:       <interleave>
  201:         <optional>
  202:           <element name="init">
  203:             <ref name="absFilePath"/>
  204:           </element>
  205:         </optional>
  206:       </interleave>
  207:     </element>
  208:   </define>
  209:   <!--
  210:       The Identifiers can be:
  211:       - an optional id attribute with a number on the domain element
  212:       - a mandatory name
  213:       - an optional uuid
  214:     -->
  215:   <define name="ids">
  216:     <optional>
  217:       <attribute name="id">
  218:         <ref name="unsignedInt"/>
  219:       </attribute>
  220:     </optional>
  221:     <interleave>
  222:       <element name="name">
  223:         <ref name="domainName"/>
  224:       </element>
  225:       <optional>
  226:         <element name="uuid">
  227:           <ref name="UUID"/>
  228:         </element>
  229:       </optional>
  230:     </interleave>
  231:   </define>
  232:   <!--
  233:       Resources usage defines the amount of memory (maximum and possibly
  234:       current usage) and number of virtual CPUs used by that domain.
  235:       We can't check here the rule that currentMemory <= memory
  236:     -->
  237:   <define name="resources">
  238:     <interleave>
  239:       <element name="memory">
  240:         <ref name="memoryKB"/>
  241:       </element>
  242:       <optional>
  243:         <element name="currentMemory">
  244:           <ref name="memoryKB"/>
  245:         </element>
  246:       </optional>
  247:       <optional>
  248: 	<element name="memoryBacking">
  249: 	  <optional>
  250: 	    <element name="hugepages">
  251: 	      <empty/>
  252: 	    </element>
  253: 	  </optional>
  254: 	</element>
  255:       </optional>
  256:       <optional>
  257:         <element name="vcpu">
  258:           <optional>
  259:             <attribute name="cpuset"/>
  260:           </optional>
  261:           <ref name="countCPU"/>
  262:         </element>
  263:       </optional>
  264:     </interleave>
  265:   </define>
  266:   <define name="clock">
  267:     <optional>
  268:       <element name="clock">
  269:         <attribute name="offset">
  270:           <choice>
  271:             <value>localtime</value>
  272:             <value>utc</value>
  273:           </choice>
  274:         </attribute>
  275:         <empty/>
  276:       </element>
  277:     </optional>
  278:   </define>
  279:   <!--
  280:       A bootloader may be used to extract the OS information instead of
  281:       defining the OS parameter in the instance. It points just to the
  282:       binary or script used to extract the data from the first disk device.
  283:     -->
  284:   <define name="bootloader">
  285:     <interleave>
  286:       <element name="bootloader">
  287:         <choice>
  288:           <ref name="absFilePath"/>
  289:           <empty/>
  290:         </choice>
  291:       </element>
  292:       <optional>
  293:         <element name="bootloader_args">
  294:           <text/>
  295:         </element>
  296:       </optional>
  297:     </interleave>
  298:   </define>
  299:   <define name="osbootkernel">
  300:     <interleave>
  301:       <element name="kernel">
  302:         <ref name="absFilePath"/>
  303:       </element>
  304:       <optional>
  305:         <element name="initrd">
  306:           <ref name="absFilePath"/>
  307:         </element>
  308:       </optional>
  309:       <optional>
  310:         <element name="root">
  311:           <ref name="devicePath"/>
  312:         </element>
  313:       </optional>
  314:       <optional>
  315:         <element name="cmdline">
  316:           <text/>
  317:         </element>
  318:       </optional>
  319:     </interleave>
  320:   </define>
  321:   <define name="osbootdev">
  322:     <element name="boot">
  323:       <attribute name="dev">
  324:         <choice>
  325:           <value>hd</value>
  326:           <value>fd</value>
  327:           <value>cdrom</value>
  328:           <value>network</value>
  329:         </choice>
  330:       </attribute>
  331:       <empty/>
  332:     </element>
  333:   </define>
  334:   <define name="diskspec">
  335:     <optional>
  336:       <ref name="driver"/>
  337:     </optional>
  338:     <ref name="target"/>
  339:     <optional>
  340:       <element name="readonly">
  341:         <empty/>
  342:       </element>
  343:     </optional>
  344:     <optional>
  345:       <element name="shareable">
  346:         <empty/>
  347:       </element>
  348:     </optional>
  349:     <optional>
  350:       <element name="serial">
  351:         <ref name="diskSerial"/>
  352:       </element>
  353:     </optional>
  354:   </define>
  355:   <!--
  356:       A disk description can be either of type file or block
  357:       The name of the attribute on the source element depends on the type
  358: 
  359:     -->
  360:   <define name="disk">
  361:     <element name="disk">
  362:       <optional>
  363:         <attribute name="device">
  364:           <choice>
  365:             <value>floppy</value>
  366:             <value>disk</value>
  367:             <value>cdrom</value>
  368:           </choice>
  369:         </attribute>
  370:       </optional>
  371:       <choice>
  372:         <group>
  373:           <attribute name="type">
  374:             <value>file</value>
  375:           </attribute>
  376:           <interleave>
  377:             <optional>
  378:               <element name="source">
  379:                 <attribute name="file">
  380:                   <ref name="absFilePath"/>
  381:                 </attribute>
  382:                 <empty/>
  383:               </element>
  384:             </optional>
  385:             <ref name="diskspec"/>
  386:           </interleave>
  387:         </group>
  388:         <group>
  389:           <attribute name="type">
  390:             <value>block</value>
  391:           </attribute>
  392:           <interleave>
  393:             <optional>
  394:               <element name="source">
  395:                 <attribute name="dev">
  396:                   <ref name="deviceName"/>
  397:                 </attribute>
  398:                 <empty/>
  399:               </element>
  400:             </optional>
  401:             <ref name="diskspec"/>
  402:           </interleave>
  403:         </group>
  404:         <ref name="diskspec"/>
  405:       </choice>
  406:     </element>
  407:   </define>
  408:   <define name="target">
  409:     <element name="target">
  410:       <attribute name="dev">
  411:         <ref name="deviceName"/>
  412:       </attribute>
  413:       <optional>
  414:         <attribute name="bus">
  415:           <choice>
  416:             <value>ide</value>
  417:             <value>fdc</value>
  418:             <value>scsi</value>
  419:             <value>virtio</value>
  420:             <value>xen</value>
  421:             <value>usb</value>
  422:             <value>uml</value>
  423:           </choice>
  424:         </attribute>
  425:       </optional>
  426:     </element>
  427:   </define>
  428:   <!--
  429:       Disk may use a special driver for access. Currently this is
  430:       only defined for Xen for tap/aio and file, but will certainly be
  431:       extended in the future, and libvirt doesn't look for specific values.
  432:     -->
  433:   <define name="driver">
  434:     <element name="driver">
  435:       <choice>
  436:         <group>
  437:           <ref name="driverFormat"/>
  438:           <optional>
  439:             <ref name="driverCache"/>
  440:           </optional>
  441:         </group>
  442:         <group>
  443:           <optional>
  444:             <ref name="driverFormat"/>
  445:           </optional>
  446:           <ref name="driverCache"/>
  447:         </group>
  448:       </choice>
  449:       <empty/>
  450:     </element>
  451:   </define>
  452:   <define name="driverFormat">
  453:     <attribute name="name">
  454:       <ref name="genericName"/>
  455:     </attribute>
  456:     <optional>
  457:       <attribute name="type">
  458:         <ref name="genericName"/>
  459:       </attribute>
  460:     </optional>
  461:   </define>
  462:   <define name="driverCache">
  463:     <attribute name="cache">
  464:       <choice>
  465:         <value>none</value>
  466:         <value>writeback</value>
  467:         <value>writethrough</value>
  468:       </choice>
  469:     </attribute>
  470:   </define>
  471:   <define name="filesystem">
  472:     <element name="filesystem">
  473:       <choice>
  474:         <group>
  475:           <attribute name="type">
  476:             <value>file</value>
  477:           </attribute>
  478:           <interleave>
  479:             <element name="source">
  480:               <attribute name="file">
  481:                 <ref name="absFilePath"/>
  482:               </attribute>
  483:               <empty/>
  484:             </element>
  485:             <ref name="filesystemtgt"/>
  486:           </interleave>
  487:         </group>
  488:         <group>
  489:           <attribute name="type">
  490:             <value>block</value>
  491:           </attribute>
  492:           <interleave>
  493:             <element name="source">
  494:               <attribute name="dev">
  495:                 <ref name="deviceName"/>
  496:               </attribute>
  497:               <empty/>
  498:             </element>
  499:             <ref name="filesystemtgt"/>
  500:           </interleave>
  501:         </group>
  502:         <group>
  503:           <attribute name="type">
  504:             <value>mount</value>
  505:           </attribute>
  506:           <interleave>
  507:             <element name="source">
  508:               <attribute name="dir">
  509:                 <ref name="absFilePath"/>
  510:               </attribute>
  511:               <empty/>
  512:             </element>
  513:             <ref name="filesystemtgt"/>
  514:           </interleave>
  515:         </group>
  516:         <group>
  517:           <attribute name="type">
  518:             <value>template</value>
  519:           </attribute>
  520:           <interleave>
  521:             <element name="source">
  522:               <attribute name="name">
  523:                 <ref name="genericName"/>
  524:               </attribute>
  525:               <empty/>
  526:             </element>
  527:             <ref name="filesystemtgt"/>
  528:           </interleave>
  529:         </group>
  530:       </choice>
  531:     </element>
  532:   </define>
  533:   <define name="filesystemtgt">
  534:     <element name="target">
  535:       <attribute name="dir">
  536:         <ref name="absDirPath"/>
  537:       </attribute>
  538:       <empty/>
  539:     </element>
  540:   </define>
  541:   <!--
  542:       An interface description can either be of type bridge in which case
  543:       it will use a bridging source, or of type ethernet which uses a device
  544:       source and a device target instead. They both share a set of interface
  545:       options. FIXME
  546:     -->
  547:   <define name="interface">
  548:     <element name="interface">
  549:       <choice>
  550:         <group>
  551:           <attribute name="type">
  552:             <value>bridge</value>
  553:           </attribute>
  554:           <interleave>
  555:             <optional>
  556:               <element name="source">
  557:                 <attribute name="bridge">
  558:                   <ref name="deviceName"/>
  559:                 </attribute>
  560:                 <empty/>
  561:               </element>
  562:             </optional>
  563:             <ref name="interface-options"/>
  564:           </interleave>
  565:         </group>
  566:         <group>
  567:           <attribute name="type">
  568:             <value>ethernet</value>
  569:           </attribute>
  570:           <interleave>
  571:             <optional>
  572:               <element name="source">
  573:                 <attribute name="dev">
  574:                   <ref name="deviceName"/>
  575:                 </attribute>
  576:                 <empty/>
  577:               </element>
  578:             </optional>
  579:             <ref name="interface-options"/>
  580:           </interleave>
  581:         </group>
  582:         <group>
  583:           <attribute name="type">
  584:             <value>network</value>
  585:           </attribute>
  586:           <interleave>
  587:             <element name="source">
  588:               <attribute name="network">
  589:                 <ref name="deviceName"/>
  590:               </attribute>
  591:               <empty/>
  592:             </element>
  593:             <ref name="interface-options"/>
  594:           </interleave>
  595:         </group>
  596:         <group>
  597:           <attribute name="type">
  598:             <value>user</value>
  599:           </attribute>
  600:           <interleave>
  601:             <ref name="interface-options"/>
  602:           </interleave>
  603:         </group>
  604:         <group>
  605:           <attribute name="type">
  606:             <value>internal</value>
  607:           </attribute>
  608:           <interleave>
  609:             <element name="source">
  610:               <attribute name="name">
  611:                 <ref name="deviceName"/>
  612:               </attribute>
  613:               <empty/>
  614:             </element>
  615:             <ref name="interface-options"/>
  616:           </interleave>
  617:         </group>
  618:       </choice>
  619:     </element>
  620:   </define>
  621:   <!--
  622:       The interface options possible are:
  623:         - the MAC address
  624:         - the IP address bound to the interface
  625:         - the name of the script used to set up the binding
  626:         - the target device used
  627:     -->
  628:   <define name="interface-options">
  629:     <interleave>
  630:       <optional>
  631:         <element name="target">
  632:           <attribute name="dev">
  633:             <ref name="deviceName"/>
  634:           </attribute>
  635:           <empty/>
  636:         </element>
  637:       </optional>
  638:       <optional>
  639:         <element name="mac">
  640:           <attribute name="address">
  641:             <ref name="addrMAC"/>
  642:           </attribute>
  643:           <empty/>
  644:         </element>
  645:       </optional>
  646:       <optional>
  647:         <element name="ip">
  648:           <attribute name="address">
  649:             <ref name="addrIP"/>
  650:           </attribute>
  651:           <empty/>
  652:         </element>
  653:       </optional>
  654:       <optional>
  655:         <element name="script">
  656:           <attribute name="path">
  657:             <ref name="filePath"/>
  658:           </attribute>
  659:           <empty/>
  660:         </element>
  661:       </optional>
  662:       <optional>
  663:         <element name="model">
  664:           <attribute name="type"/>
  665:           <empty/>
  666:         </element>
  667:       </optional>
  668:     </interleave>
  669:   </define>
  670:   <!--
  671:       An emulator description is just a path to the binary used for the task
  672:     -->
  673:   <define name="emulator">
  674:     <element name="emulator">
  675:       <ref name="absFilePath"/>
  676:     </element>
  677:   </define>
  678:   <!--
  679:       A graphic description, currently in Xen only 2 types are supported:
  680:         - sdl with optional display, xauth and fullscreen
  681:         - vnc with a required port and optional listen IP address, password
  682:           and keymap
  683:     -->
  684:   <define name="graphic">
  685:     <element name="graphics">
  686:       <choice>
  687:         <group>
  688:           <attribute name="type">
  689:             <value>sdl</value>
  690:           </attribute>
  691:           <optional>
  692:             <attribute name="display">
  693:               <text/>
  694:             </attribute>
  695:           </optional>
  696:           <optional>
  697:             <attribute name="xauth">
  698:               <text/>
  699:             </attribute>
  700:           </optional>
  701:           <optional>
  702:             <attribute name="fullscreen">
  703:               <choice>
  704:                 <value>yes</value>
  705:                 <value>no</value>
  706:               </choice>
  707:             </attribute>
  708:           </optional>
  709:         </group>
  710:         <group>
  711:           <attribute name="type">
  712:             <value>vnc</value>
  713:           </attribute>
  714:           <optional>
  715:             <attribute name="port">
  716:               <ref name="PortNumber"/>
  717:             </attribute>
  718:           </optional>
  719:           <optional>
  720:             <attribute name="autoport">
  721:               <choice>
  722:                 <value>yes</value>
  723:                 <value>no</value>
  724:               </choice>
  725:             </attribute>
  726:           </optional>
  727:           <optional>
  728:             <attribute name="listen">
  729:               <ref name="addrIP"/>
  730:             </attribute>
  731:           </optional>
  732:           <optional>
  733:             <attribute name="passwd">
  734:               <text/>
  735:             </attribute>
  736:           </optional>
  737:           <optional>
  738:             <attribute name="keymap">
  739:               <text/>
  740:             </attribute>
  741:           </optional>
  742:         </group>
  743:         <group>
  744:           <attribute name="type">
  745:             <value>rdp</value>
  746:           </attribute>
  747:           <optional>
  748:             <attribute name="port">
  749:               <ref name="PortNumber"/>
  750:             </attribute>
  751:           </optional>
  752:           <optional>
  753:             <attribute name="autoport">
  754:               <choice>
  755:                 <value>yes</value>
  756:                 <value>no</value>
  757:               </choice>
  758:             </attribute>
  759:           </optional>
  760:           <optional>
  761:             <attribute name="replaceUser">
  762:               <choice>
  763:                 <value>yes</value>
  764:                 <value>no</value>
  765:               </choice>
  766:             </attribute>
  767:           </optional>
  768:           <optional>
  769:             <attribute name="multiUser">
  770:               <choice>
  771:                 <value>yes</value>
  772:                 <value>no</value>
  773:               </choice>
  774:             </attribute>
  775:           </optional>
  776:           <optional>
  777:             <attribute name="listen">
  778:               <ref name="addrIP"/>
  779:             </attribute>
  780:           </optional>
  781:         </group>
  782:         <group>
  783:           <attribute name="type">
  784:             <value>desktop</value>
  785:           </attribute>
  786:           <optional>
  787:             <attribute name="display">
  788:               <text/>
  789:             </attribute>
  790:           </optional>
  791:           <optional>
  792:             <attribute name="fullscreen">
  793:               <choice>
  794:                 <value>yes</value>
  795:                 <value>no</value>
  796:               </choice>
  797:             </attribute>
  798:           </optional>
  799:         </group>
  800:       </choice>
  801:     </element>
  802:   </define>
  803:   <!--
  804:      A graphic description, currently in Xen only 2 types are supported:
  805:        - sdl with optional display, xauth and fullscreen
  806:        - vnc with a required port and optional listen IP address, password
  807:          and keymap
  808:    -->
  809:   <define name="video">
  810:     <element name="video">
  811:       <optional>
  812: 	<element name="model">
  813:           <attribute name="type">
  814:             <choice>
  815:               <value>vga</value>
  816:               <value>cirrus</value>
  817:               <value>vmvga</value>
  818:               <value>xen</value>
  819:               <value>vbox</value>
  820:             </choice>
  821:           </attribute>
  822:           <optional>
  823:             <attribute name="vram">
  824:               <ref name="unsignedInt"/>
  825:             </attribute>
  826:           </optional>
  827:           <optional>
  828:             <attribute name="heads">
  829:               <ref name="unsignedInt"/>
  830:             </attribute>
  831:           </optional>
  832:           <optional>
  833:             <element name="acceleration">
  834:               <optional>
  835:                 <attribute name="accel3d">
  836:                   <choice>
  837:                     <value>yes</value>
  838:                     <value>no</value>
  839:                   </choice>
  840:                 </attribute>
  841:               </optional>
  842:               <optional>
  843:                 <attribute name="accel2d">
  844:                   <choice>
  845:                     <value>yes</value>
  846:                     <value>no</value>
  847:                   </choice>
  848:                 </attribute>
  849:               </optional>
  850:             </element>
  851:           </optional>
  852: 	</element>
  853:       </optional>
  854:     </element>
  855:   </define>
  856:   <!--
  857:       When a domain terminates multiple policies can be applied depending
  858:       on how it ended:
  859:     -->
  860:   <define name="termination">
  861:     <interleave>
  862:       <optional>
  863:         <element name="on_reboot">
  864:           <ref name="offOptions"/>
  865:         </element>
  866:       </optional>
  867:       <optional>
  868:         <element name="on_poweroff">
  869:           <ref name="offOptions"/>
  870:         </element>
  871:       </optional>
  872:       <optional>
  873:         <element name="on_crash">
  874:           <ref name="offOptions"/>
  875:         </element>
  876:       </optional>
  877:     </interleave>
  878:   </define>
  879:   <!--
  880:       Options when a domain terminates:
  881:       destroy: The domain is cleaned up
  882:       restart: A new domain is started in place of the old one
  883:       preserve: The domain will remain in memory until it is destroyed manually
  884:       rename-restart: a variant of the previous one but where the old domain is
  885:                       renamed before being saved to allow a restart
  886:     -->
  887:   <define name="offOptions">
  888:     <choice>
  889:       <value>destroy</value>
  890:       <value>restart</value>
  891:       <value>preserve</value>
  892:       <value>rename-restart</value>
  893:     </choice>
  894:   </define>
  895:   <!--
  896:       Specific setup for a qemu emulated character device.  Note: this
  897:       definition doesn't fully specify the constraints on this node.
  898:     -->
  899:   <define name="qemucdev">
  900:     <attribute name="type">
  901:       <choice>
  902:         <value>dev</value>
  903:         <value>file</value>
  904:         <value>pipe</value>
  905:         <value>unix</value>
  906:         <value>tcp</value>
  907:         <value>udp</value>
  908:         <value>null</value>
  909:         <value>stdio</value>
  910:         <value>vc</value>
  911:         <value>pty</value>
  912:       </choice>
  913:     </attribute>
  914:     <interleave>
  915:       <optional>
  916:         <oneOrMore>
  917:           <element name="source">
  918:             <optional>
  919:               <attribute name="mode"/>
  920:             </optional>
  921:             <optional>
  922:               <attribute name="path"/>
  923:             </optional>
  924:             <optional>
  925:               <attribute name="host"/>
  926:             </optional>
  927:             <optional>
  928:               <attribute name="service"/>
  929:             </optional>
  930:             <optional>
  931:               <attribute name="wiremode"/>
  932:             </optional>
  933:           </element>
  934:         </oneOrMore>
  935:       </optional>
  936:       <optional>
  937:         <element name="protocol">
  938:           <optional>
  939:             <attribute name="type"/>
  940:           </optional>
  941:         </element>
  942:       </optional>
  943:       <optional>
  944:         <element name="target">
  945:           <optional>
  946:             <attribute name="port"/>
  947:           </optional>
  948:         </element>
  949:       </optional>
  950:     </interleave>
  951:   </define>
  952:   <!--
  953:       The description for a console
  954:       just a tty device
  955:     -->
  956:   <define name="console">
  957:     <element name="console">
  958:       <choice>
  959:         <group>
  960:           <optional>
  961:             <attribute name="tty">
  962:               <ref name="devicePath"/>
  963:             </attribute>
  964:           </optional>
  965:           <empty/>
  966:         </group>
  967:         <ref name="qemucdev"/>
  968:       </choice>
  969:     </element>
  970:   </define>
  971:   <define name="sound">
  972:     <element name="sound">
  973:       <attribute name="model">
  974:         <choice>
  975:           <value>sb16</value>
  976:           <value>es1370</value>
  977:           <value>pcspk</value>
  978:           <value>ac97</value>
  979:         </choice>
  980:       </attribute>
  981:     </element>
  982:   </define>
  983:   <define name="parallel">
  984:     <element name="parallel">
  985:       <ref name="qemucdev"/>
  986:     </element>
  987:   </define>
  988:   <define name="serial">
  989:     <element name="serial">
  990:       <ref name="qemucdev"/>
  991:     </element>
  992:   </define>
  993:   <define name="input">
  994:     <element name="input">
  995:       <attribute name="type">
  996:         <choice>
  997:           <value>tablet</value>
  998:           <value>mouse</value>
  999:         </choice>
 1000:       </attribute>
 1001:       <optional>
 1002:         <attribute name="bus">
 1003:           <choice>
 1004:             <value>ps2</value>
 1005:             <value>usb</value>
 1006:             <value>xen</value>
 1007:           </choice>
 1008:         </attribute>
 1009:       </optional>
 1010:     </element>
 1011:   </define>
 1012:   <define name="hostdev">
 1013:     <element name="hostdev">
 1014:       <optional>
 1015:         <attribute name="mode">
 1016:           <choice>
 1017:             <value>subsystem</value>
 1018:             <value>capabilities</value>
 1019:           </choice>
 1020:         </attribute>
 1021:         <attribute name="type">
 1022:           <choice>
 1023:             <value>usb</value>
 1024:             <value>pci</value>
 1025:           </choice>
 1026:         </attribute>
 1027:         <attribute name="managed">
 1028:           <choice>
 1029:             <value>yes</value>
 1030:             <value>no</value>
 1031:           </choice>
 1032:         </attribute>
 1033:       </optional>
 1034:       <group>
 1035:         <element name="source">
 1036:           <choice>
 1037:             <ref name="usbproduct"/>
 1038:             <ref name="usbaddress"/>
 1039:             <ref name="pciaddress"/>
 1040:           </choice>
 1041:         </element>
 1042:       </group>
 1043:     </element>
 1044:   </define>
 1045:   <define name="usbproduct">
 1046:     <element name="vendor">
 1047:       <attribute name="id">
 1048:         <ref name="usbId"/>
 1049:       </attribute>
 1050:     </element>
 1051:     <element name="product">
 1052:       <attribute name="id">
 1053:         <ref name="usbId"/>
 1054:       </attribute>
 1055:     </element>
 1056:   </define>
 1057:   <define name="usbaddress">
 1058:     <element name="address">
 1059:       <attribute name="bus">
 1060:         <ref name="usbAddr"/>
 1061:       </attribute>
 1062:       <attribute name="device">
 1063:         <ref name="usbAddr"/>
 1064:       </attribute>
 1065:     </element>
 1066:   </define>
 1067:   <define name="pciaddress">
 1068:     <element name="address">
 1069:       <optional>
 1070:         <attribute name="domain">
 1071:           <ref name="pciDomain"/>
 1072:         </attribute>
 1073:       </optional>
 1074:       <attribute name="bus">
 1075:         <ref name="pciBus"/>
 1076:       </attribute>
 1077:       <attribute name="slot">
 1078:         <ref name="pciSlot"/>
 1079:       </attribute>
 1080:       <attribute name="function">
 1081:         <ref name="pciFunc"/>
 1082:       </attribute>
 1083:     </element>
 1084:   </define>
 1085:   <!--
 1086:       Devices attached to a domain.
 1087:     -->
 1088:   <define name="devices">
 1089:     <element name="devices">
 1090:       <interleave>
 1091:         <optional>
 1092:           <ref name="emulator"/>
 1093:         </optional>
 1094:         <zeroOrMore>
 1095:           <choice>
 1096:             <ref name="disk"/>
 1097:             <ref name="filesystem"/>
 1098:             <ref name="interface"/>
 1099:             <ref name="input"/>
 1100:             <ref name="sound"/>
 1101:             <ref name="hostdev"/>
 1102:             <ref name="graphic"/>
 1103:             <ref name="video"/>
 1104:             <ref name="console"/>
 1105:             <ref name="parallel"/>
 1106:             <ref name="serial"/>
 1107:           </choice>
 1108:         </zeroOrMore>
 1109:       </interleave>
 1110:     </element>
 1111:   </define>
 1112:   <!--
 1113:       A set of optional features: PAE, APIC and ACPI support
 1114:     -->
 1115:   <define name="features">
 1116:     <optional>
 1117:       <element name="features">
 1118:         <interleave>
 1119:           <optional>
 1120:             <element name="pae">
 1121:               <empty/>
 1122:             </element>
 1123:           </optional>
 1124:           <optional>
 1125:             <element name="apic">
 1126:               <empty/>
 1127:             </element>
 1128:           </optional>
 1129:           <optional>
 1130:             <element name="acpi">
 1131:               <empty/>
 1132:             </element>
 1133:           </optional>
 1134:         </interleave>
 1135:       </element>
 1136:     </optional>
 1137:   </define>
 1138:   <!--
 1139:        Type library
 1140: 
 1141:        Our unsignedInt doesn't allow a leading '+' in its lexical form
 1142:        A domain name shoul be made of ascii, numbers, _-+ and is non-empty
 1143:        UUID currently allows only the 32 characters strict syntax
 1144:        memoryKB request at least 4Mbytes though Xen will grow bigger if too low
 1145:     -->
 1146:   <define name="unsignedInt">
 1147:     <data type="unsignedInt">
 1148:       <param name="pattern">[0-9]+</param>
 1149:     </data>
 1150:   </define>
 1151:   <define name="countCPU">
 1152:     <data type="unsignedShort">
 1153:       <param name="pattern">[0-9]+</param>
 1154:       <param name="minInclusive">1</param>
 1155:     </data>
 1156:   </define>
 1157:   <define name="PortNumber">
 1158:     <data type="short">
 1159:       <param name="minInclusive">-1</param>
 1160:     </data>
 1161:   </define>
 1162:   <define name="memoryKB">
 1163:     <data type="unsignedInt">
 1164:       <param name="pattern">[0-9]+</param>
 1165:       <param name="minInclusive">4000</param>
 1166:     </data>
 1167:   </define>
 1168:   <define name="domainName">
 1169:     <data type="string">
 1170:       <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
 1171:     </data>
 1172:   </define>
 1173:   <define name="diskSerial">
 1174:     <data type="string">
 1175:       <param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
 1176:     </data>
 1177:   </define>
 1178:   <define name="genericName">
 1179:     <data type="string">
 1180:       <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
 1181:     </data>
 1182:   </define>
 1183:   <define name="UUID">
 1184:     <choice>
 1185:       <data type="string">
 1186:         <param name="pattern">[a-fA-F0-9]{32}</param>
 1187:       </data>
 1188:       <data type="string">
 1189:         <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
 1190:       </data>
 1191:     </choice>
 1192:   </define>
 1193:   <define name="filePath">
 1194:     <data type="string">
 1195:       <param name="pattern">[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
 1196:     </data>
 1197:   </define>
 1198:   <define name="absFilePath">
 1199:     <data type="string">
 1200:       <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]+</param>
 1201:     </data>
 1202:   </define>
 1203:   <define name="absDirPath">
 1204:     <data type="string">
 1205:       <param name="pattern">/[a-zA-Z0-9_\.\+\-&amp;/%]*</param>
 1206:     </data>
 1207:   </define>
 1208:   <define name="devicePath">
 1209:     <data type="string">
 1210:       <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
 1211:     </data>
 1212:   </define>
 1213:   <define name="deviceName">
 1214:     <data type="string">
 1215:       <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
 1216:     </data>
 1217:   </define>
 1218:   <define name="addrMAC">
 1219:     <data type="string">
 1220:       <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
 1221:     </data>
 1222:   </define>
 1223:   <define name="addrIP">
 1224:     <data type="string">
 1225:       <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
 1226:     </data>
 1227:   </define>
 1228:   <define name="usbId">
 1229:     <data type="string">
 1230:       <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
 1231:     </data>
 1232:   </define>
 1233:   <define name="usbAddr">
 1234:     <data type="string">
 1235:       <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
 1236:     </data>
 1237:   </define>
 1238:   <define name="pciDomain">
 1239:     <data type="string">
 1240:       <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
 1241:     </data>
 1242:   </define>
 1243:   <define name="pciBus">
 1244:     <data type="string">
 1245:       <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
 1246:     </data>
 1247:   </define>
 1248:   <define name="pciSlot">
 1249:     <data type="string">
 1250:       <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
 1251:     </data>
 1252:   </define>
 1253:   <define name="pciFunc">
 1254:     <data type="string">
 1255:       <param name="pattern">(0x)?[0-7]</param>
 1256:     </data>
 1257:   </define>
 1258: </grammar>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>