Преглед на файлове

Merge remote-tracking branch 'qubesos/pr/154'

* qubesos/pr/154:
  Add basic PVHv2 support
Marek Marczykowski-Górecki преди 7 години
родител
ревизия
08640f4779
променени са 2 файла, в които са добавени 12 реда и са изтрити 5 реда
  1. 2 2
      qubes/vm/qubesvm.py
  2. 10 3
      templates/libvirt/xen.xml

+ 2 - 2
qubes/vm/qubesvm.py

@@ -93,9 +93,9 @@ def _setter_default_user(self, prop, value):
 def _setter_virt_mode(self, prop, value):
     value = str(value)
     value = value.lower()
-    if value not in ('hvm', 'pv'):
+    if value not in ('hvm', 'pv', 'pvh'):
         raise qubes.exc.QubesPropertyValueError(self, prop, value,
-            'Invalid virtualization mode, supported values: hvm, pv')
+            'Invalid virtualization mode, supported values: hvm, pv, pvh')
     return value
 
 

+ 10 - 3
templates/libvirt/xen.xml

@@ -11,7 +11,7 @@
         <vcpu placement="static">{{ vm.vcpus }}</vcpu>
     {% endblock %}
     {% block cpu %}
-    {% if vm.virt_mode == 'hvm' %}
+    {% if vm.virt_mode != 'pv' %}
         <cpu mode='host-passthrough'>
             <!-- disable nested HVM -->
             <feature name='vmx' policy='disable'/>
@@ -35,7 +35,11 @@
                 <boot dev="hd" />
             <!-- server_ip is the address of stubdomain. It hosts it's own DNS server. -->
             {% else %}
-                <type arch="x86_64" machine="xenpv">linux</type>
+                {% if vm.virt_mode == 'pvh' %}
+                    <type arch="x86_64" machine="xenfv">hvm</type>
+                {% else %}
+                    <type arch="x86_64" machine="xenpv">linux</type>
+                {% endif %}
                 <kernel>{{ vm.storage.kernels_dir }}/vmlinuz</kernel>
                 <initrd>{{ vm.storage.kernels_dir }}/initramfs</initrd>
                 <cmdline>root=/dev/mapper/dmroot ro nomodeset console=hvc0 rd_NO_PLYMOUTH rd.plymouth.enable=0 plymouth.enable=0 {{ vm.kernelopts }}</cmdline>
@@ -45,7 +49,7 @@
 
     <features>
         {% block features %}
-            {% if vm.virt_mode == 'hvm' %}
+            {% if vm.virt_mode != 'pv' %}
                 <pae/>
                 <acpi/>
                 <apic/>
@@ -168,6 +172,9 @@
                     <graphics type="qubes"/>
                 {% endif %}
             {% else %}
+                {% if vm.virt_mode == 'pvh' %}
+                    <emulator type="none"/>
+                {% endif %}
                 <console type="pty">
                     <target type="xen" port="0"/>
                 </console>