Tune default device list for Virtuozzo containers

Virtuozzo supports virtio NIC.
Also add default VNC graphics.
Privnet feature and emulator device have no sense for vz containers.
This commit is contained in:
Mikhail Feoktistov 2017-03-13 15:01:53 +03:00 committed by Cole Robinson
parent d86792fe0a
commit c25ea6537b
4 changed files with 8 additions and 8 deletions

View File

@ -8,11 +8,7 @@
<type arch="x86_64">exe</type>
<init>/sbin/init</init>
</os>
<features>
<privnet/>
</features>
<devices>
<emulator>vz</emulator>
<filesystem type="template">
<source name="centos-7-x86_64"/>
<target dir="/"/>
@ -21,6 +17,7 @@
<source network="Bridged"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
<console type="pty"/>
</devices>
</domain>

View File

@ -551,7 +551,7 @@ class vmmAddHardware(vmmGObjectUI):
model.append([None, _("Hypervisor default")])
if vm.is_hvm():
mod_list = []
if vm.get_hv_type() in ["kvm", "qemu", "test"]:
if vm.get_hv_type() in ["kvm", "qemu", "vz", "test"]:
mod_list.append("virtio")
mod_list.append("rtl8139")
mod_list.append("e1000")

View File

@ -387,6 +387,9 @@ class VirtualConnection(object):
return self._uriobj.scheme.startswith("openvz")
def is_container(self):
return self.is_lxc() or self.is_openvz()
def is_vz(self):
return (self._uriobj.scheme.startswith("vz") or
self._uriobj.scheme.startswith("parallels"))
#########################

View File

@ -637,7 +637,7 @@ class Guest(XMLBuilder):
return
if self.get_devices("graphics"):
return
if self.os.is_container():
if self.os.is_container() and not self.conn.is_vz():
return
if self.os.arch not in ["x86_64", "i686", "ppc64", "ppc64le", "ia64"]:
return
@ -786,7 +786,7 @@ class Guest(XMLBuilder):
hyperv.present = True
def _set_emulator_defaults(self):
if self.os.is_xenpv():
if self.os.is_xenpv() or self.type == "vz":
self.emulator = None
return
@ -850,7 +850,7 @@ class Guest(XMLBuilder):
self.features.acpi = None
self.features.apic = None
self.features.pae = None
if self._is_full_os_container():
if self._is_full_os_container() and self.type != "vz":
self.features.privnet = True
return