xen.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <domain type="xen">
  2. <name>{% if prepare_dvm %}%NAME%{% else %}{{ vm.name }}{% endif %}</name>
  3. <uuid>{{ vm.uuid }}</uuid>
  4. <memory unit="MiB">{{ vm.maxmem }}</memory>
  5. <currentMemory unit="MiB">{{ vm.memory }}</currentMemory>
  6. <vcpu placement="static">{{ vm.vcpus }}</vcpu>
  7. <os>
  8. {% if vm.hvm %}
  9. <type arch="x86_64" machine="xenfv">hvm</type>
  10. <loader>hvmloader</loader>
  11. <boot dev="cdrom" />
  12. <boot dev="hd" />
  13. <!-- server_ip is the address of stubdomain. It hosts it's own DNS server. -->
  14. {% else %}
  15. <type arch="x86_64" machine="xenpv">linux</type>
  16. <kernel>{{ vm.storage.kernels_dir }}/vmlinuz</kernel>
  17. <initrd>{{ vm.storage.kernels_dir }}/initramfs</initrd>
  18. <cmdline>root=/dev/mapper/dmroot ro nomodeset console=hvc0 rd_NO_PLYMOUTH 3 {{ vm.kernelopts }}</cmdline>
  19. {% endif %}
  20. </os>
  21. {% if vm.hvm %}
  22. <features>
  23. <pae/>
  24. <acpi/>
  25. <apic/>
  26. <viridian/>
  27. </features>
  28. {% set timezone = vm.features.check_with_template('timezone', 'localtime').lower() %}
  29. {% if timezone == 'localtime' %}
  30. <clock offset="variable" adjustment="0" basis="localtime" />
  31. {% elif timezone.isdigit() %}
  32. <clock offset="variable" adjustment="{{ timezone }}" basis="UTC" />
  33. {% else %}
  34. <clock offset="variable" adjustment="0" basis="UTC" />
  35. {% endif %}
  36. {% else %}
  37. <clock offset='utc' adjustment='reset'>
  38. <timer name="tsc" mode="native"/>
  39. </clock>
  40. {% endif %}
  41. <on_poweroff>destroy</on_poweroff>
  42. <on_reboot>destroy</on_reboot>
  43. <on_crash>destroy</on_crash>
  44. <devices>
  45. {#
  46. {% for device in vm.storage %}
  47. <disk type="block" device="{{ device.type }}">
  48. <driver name="phy" />
  49. <source dev="{{ device.path }}" />
  50. <target dev="{{ device.vdev }}" />
  51. {% if not device.rw %}
  52. <readonly />
  53. {% endif %}
  54. {% if device.domain %}
  55. <domain name="{{ domain }}" />
  56. {% endif %}
  57. {% if device.script %}
  58. <script path="{{ device.script }}"></script>
  59. {% endif %}
  60. </disk>
  61. {% endfor %}
  62. #}
  63. {{ vm.storage.root_dev_config() }}
  64. {% if not prepare_dvm %}{{ vm.storage.private_dev_config() }}{% endif %}
  65. {{ vm.storage.other_dev_config() }}
  66. {% if not vm.hvm %}
  67. {{ vm.storage.volatile_dev_config() }}
  68. {% endif %}
  69. {% if vm.netvm %}
  70. <interface type="ethernet">
  71. <mac address="{{ vm.mac }}" />
  72. <ip address="
  73. {%- if prepare_dvm -%}
  74. %IP%
  75. {%- else -%}
  76. {{ vm.ip }}
  77. {%- endif %}" />
  78. <backenddomain name="{{ vm.netvm.name }}" />
  79. <script path="vif-route-qubes"></script>
  80. </interface>
  81. {% endif %}
  82. {% for device in vm.devices.pci %}
  83. <hostdev type="pci" managed="yes">
  84. <source>
  85. <address
  86. bus="0x{{ device.bus }}"
  87. slot="0x{{ device.device }}"
  88. function="0x{{ device.function }}" />
  89. </source>
  90. </hostdev>
  91. {% endfor %}
  92. {% if vm.hvm %}
  93. <emulator
  94. type="stubdom"
  95. {% if vm.netvm %}
  96. cmdline="-net lwip,client_ip={{ vm.ip -}}
  97. ,server_ip={{ vm.secondary_dns -}}
  98. ,dns={{ vm.netvm.gateway -}}
  99. ,gw={{ self.netvm.gateway -}}
  100. ,netmask={{ vm.netmask }}"
  101. {% endif %}
  102. />
  103. <input type="tablet" bus="usb"/>
  104. <video type="vga"/>
  105. {% else %}
  106. <console type="pty">
  107. <target type="xen" port="0"/>
  108. </console>
  109. {% endif %}
  110. </devices>
  111. </domain>
  112. <!-- vim: set ft=jinja ts=4 sts=4 sw=4 et tw=80 : -->