mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
create: Allow switching between KVM and TCG for armv7l (bz 1214592)
Otherwise we tried to always force KVM which reduces the usefulness here. We still get the defaults right though https://bugzilla.redhat.com/show_bug.cgi?id=1214592
This commit is contained in:
parent
2fda875072
commit
d896dd7347
41
ui/create.ui
41
ui/create.ui
@ -436,14 +436,14 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkComboBox" id="hv">
|
<object class="GtkComboBox" id="xen-type">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<signal name="changed" handler="on_hv_changed" swapped="no"/>
|
<signal name="changed" handler="on_xen_type_changed" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
@ -454,9 +454,9 @@
|
|||||||
<object class="GtkLabel" id="label28">
|
<object class="GtkLabel" id="label28">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">_Virt Type:</property>
|
<property name="label" translatable="yes">_Xen Type:</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="mnemonic_widget">hv</property>
|
<property name="mnemonic_widget">xen-type</property>
|
||||||
<property name="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -475,7 +475,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -489,7 +489,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -500,7 +500,32 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label31">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">_Virt Type:</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">virt-type</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox" id="virt-type">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<signal name="changed" handler="on_virt_type_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -218,6 +218,10 @@ class vmmConnection(vmmGObject):
|
|||||||
label = "test (xen)"
|
label = "test (xen)"
|
||||||
elif gtype == "hvm":
|
elif gtype == "hvm":
|
||||||
label = "test (hvm)"
|
label = "test (hvm)"
|
||||||
|
elif domtype == "qemu":
|
||||||
|
label = "QEMU TCG"
|
||||||
|
elif domtype == "kvm":
|
||||||
|
label = "KVM"
|
||||||
|
|
||||||
return label
|
return label
|
||||||
|
|
||||||
|
@ -151,9 +151,10 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
|
|
||||||
"on_create_conn_changed": self._conn_changed,
|
"on_create_conn_changed": self._conn_changed,
|
||||||
"on_method_changed": self._method_changed,
|
"on_method_changed": self._method_changed,
|
||||||
"on_machine_changed": self._machine_changed,
|
"on_xen_type_changed": self._xen_type_changed,
|
||||||
"on_hv_changed": self._hv_changed,
|
|
||||||
"on_arch_changed": self._arch_changed,
|
"on_arch_changed": self._arch_changed,
|
||||||
|
"on_virt_type_changed": self._virt_type_changed,
|
||||||
|
"on_machine_changed": self._machine_changed,
|
||||||
|
|
||||||
"on_install_cdrom_radio_toggled": self._local_media_toggled,
|
"on_install_cdrom_radio_toggled": self._local_media_toggled,
|
||||||
"on_install_iso_entry_changed": self._iso_changed,
|
"on_install_iso_entry_changed": self._iso_changed,
|
||||||
@ -335,25 +336,36 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
completion.set_model(os_variant_model)
|
completion.set_model(os_variant_model)
|
||||||
|
|
||||||
# Archtecture
|
# Archtecture
|
||||||
# [value, label]
|
|
||||||
archList = self.widget("arch")
|
archList = self.widget("arch")
|
||||||
|
# [label, guest.os.arch value]
|
||||||
archModel = Gtk.ListStore(str, str)
|
archModel = Gtk.ListStore(str, str)
|
||||||
archList.set_model(archModel)
|
archList.set_model(archModel)
|
||||||
uiutil.init_combo_text_column(archList, 1)
|
uiutil.init_combo_text_column(archList, 0)
|
||||||
archList.set_row_separator_func(
|
archList.set_row_separator_func(
|
||||||
lambda m, i, ignore: m[i][0] is None, None)
|
lambda m, i, ignore: m[i][0] is None, None)
|
||||||
|
|
||||||
hyperList = self.widget("hv")
|
# guest.os.type value for xen (hvm vs. xen)
|
||||||
|
hyperList = self.widget("xen-type")
|
||||||
|
# [label, guest.os_type value]
|
||||||
hyperModel = Gtk.ListStore(str, str)
|
hyperModel = Gtk.ListStore(str, str)
|
||||||
hyperList.set_model(hyperModel)
|
hyperList.set_model(hyperModel)
|
||||||
uiutil.init_combo_text_column(hyperList, 0)
|
uiutil.init_combo_text_column(hyperList, 0)
|
||||||
|
|
||||||
|
# guest.os.machine value
|
||||||
lst = self.widget("machine")
|
lst = self.widget("machine")
|
||||||
|
# [machine ID]
|
||||||
model = Gtk.ListStore(str)
|
model = Gtk.ListStore(str)
|
||||||
lst.set_model(model)
|
lst.set_model(model)
|
||||||
uiutil.init_combo_text_column(lst, 0)
|
uiutil.init_combo_text_column(lst, 0)
|
||||||
lst.set_row_separator_func(lambda m, i, ignore: m[i][0] is None, None)
|
lst.set_row_separator_func(lambda m, i, ignore: m[i][0] is None, None)
|
||||||
|
|
||||||
|
# guest.type value for xen (qemu vs kvm)
|
||||||
|
lst = self.widget("virt-type")
|
||||||
|
# [label, guest.type value]
|
||||||
|
model = Gtk.ListStore(str, str)
|
||||||
|
lst.set_model(model)
|
||||||
|
uiutil.init_combo_text_column(lst, 0)
|
||||||
|
|
||||||
|
|
||||||
def _reset_state(self, urihint=None):
|
def _reset_state(self, urihint=None):
|
||||||
"""
|
"""
|
||||||
@ -564,12 +576,14 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
"modules are not loaded.")
|
"modules are not loaded.")
|
||||||
return self._show_startup_error(error)
|
return self._show_startup_error(error)
|
||||||
|
|
||||||
# A bit out of order, but populate arch + hv lists so we can
|
# A bit out of order, but populate the xen/virt/arch/machine lists
|
||||||
# determine a default
|
# so we can work with a default.
|
||||||
self._populate_hv()
|
self._populate_xen_type()
|
||||||
self._populate_arch()
|
self._populate_arch()
|
||||||
|
self._populate_virt_type()
|
||||||
|
|
||||||
show_arch = (self.widget("hv").get_visible() or
|
show_arch = (self.widget("xen-type").get_visible() or
|
||||||
|
self.widget("virt-type").get_visible() or
|
||||||
self.widget("arch").get_visible() or
|
self.widget("arch").get_visible() or
|
||||||
self.widget("machine").get_visible())
|
self.widget("machine").get_visible())
|
||||||
uiutil.set_grid_row_visible(self.widget("arch-expander"), show_arch)
|
uiutil.set_grid_row_visible(self.widget("arch-expander"), show_arch)
|
||||||
@ -665,7 +679,7 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
self._netlist.reset_state()
|
self._netlist.reset_state()
|
||||||
|
|
||||||
|
|
||||||
def _change_caps(self, gtype=None, arch=None):
|
def _change_caps(self, gtype=None, arch=None, domtype=None):
|
||||||
"""
|
"""
|
||||||
Change the cached capsinfo for the passed values, and trigger
|
Change the cached capsinfo for the passed values, and trigger
|
||||||
all needed UI refreshing
|
all needed UI refreshing
|
||||||
@ -678,7 +692,9 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
gtype = "hvm"
|
gtype = "hvm"
|
||||||
break
|
break
|
||||||
|
|
||||||
capsinfo = self.conn.caps.guest_lookup(os_type=gtype, arch=arch)
|
capsinfo = self.conn.caps.guest_lookup(os_type=gtype,
|
||||||
|
arch=arch,
|
||||||
|
typ=domtype)
|
||||||
|
|
||||||
if self._capsinfo:
|
if self._capsinfo:
|
||||||
if (self._capsinfo.guest == capsinfo.guest and
|
if (self._capsinfo.guest == capsinfo.guest and
|
||||||
@ -697,20 +713,20 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
# Helpers for populating hv/arch/machine/conn UI #
|
# Helpers for populating hv/arch/machine/conn UI #
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
def _populate_hv(self):
|
def _populate_xen_type(self):
|
||||||
hv_list = self.widget("hv")
|
model = self.widget("xen-type").get_model()
|
||||||
model = hv_list.get_model()
|
|
||||||
model.clear()
|
model.clear()
|
||||||
|
|
||||||
default = 0
|
default = 0
|
||||||
guests = self.conn.caps.guests[:]
|
guests = []
|
||||||
if not (self.conn.is_xen() or self.conn.is_test_conn()):
|
if self.conn.is_xen() or self.conn.is_test_conn():
|
||||||
guests = []
|
guests = self.conn.caps.guests[:]
|
||||||
|
|
||||||
for guest in self.conn.caps.guests:
|
for guest in guests:
|
||||||
gtype = guest.os_type
|
|
||||||
if not guest.domains:
|
if not guest.domains:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
gtype = guest.os_type
|
||||||
dom = guest.domains[0]
|
dom = guest.domains[0]
|
||||||
domtype = dom.hypervisor_type
|
domtype = dom.hypervisor_type
|
||||||
label = self.conn.pretty_hv(gtype, domtype)
|
label = self.conn.pretty_hv(gtype, domtype)
|
||||||
@ -725,19 +741,19 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
|
|
||||||
# Determine if this is the default given by guest_lookup
|
# Determine if this is the default given by guest_lookup
|
||||||
if (gtype == self._capsinfo.os_type and
|
if (gtype == self._capsinfo.os_type and
|
||||||
self._capsinfo.hypervisor_type == domtype):
|
domtype == self._capsinfo.hypervisor_type):
|
||||||
default = len(model)
|
default = len(model)
|
||||||
|
|
||||||
model.append([label, gtype])
|
model.append([label, gtype])
|
||||||
|
|
||||||
show = bool(guests)
|
show = bool(len(model))
|
||||||
uiutil.set_grid_row_visible(hv_list, show)
|
print "showing xen default=%s" % default
|
||||||
|
uiutil.set_grid_row_visible(self.widget("xen-type"), show)
|
||||||
if show:
|
if show:
|
||||||
hv_list.set_active(default)
|
self.widget("xen-type").set_active(default)
|
||||||
|
|
||||||
def _populate_arch(self):
|
def _populate_arch(self):
|
||||||
arch_list = self.widget("arch")
|
model = self.widget("arch").get_model()
|
||||||
model = arch_list.get_model()
|
|
||||||
model.clear()
|
model.clear()
|
||||||
|
|
||||||
default = 0
|
default = 0
|
||||||
@ -772,15 +788,46 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
default = archs.index(self._capsinfo.arch)
|
default = archs.index(self._capsinfo.arch)
|
||||||
|
|
||||||
for arch in archs:
|
for arch in archs:
|
||||||
model.append([arch, _pretty_arch(arch)])
|
model.append([_pretty_arch(arch), arch])
|
||||||
|
|
||||||
show = not (len(archs) < 2)
|
show = not (len(archs) < 2)
|
||||||
uiutil.set_grid_row_visible(arch_list, show)
|
uiutil.set_grid_row_visible(self.widget("arch"), show)
|
||||||
arch_list.set_active(default)
|
self.widget("arch").set_active(default)
|
||||||
|
|
||||||
|
def _populate_virt_type(self):
|
||||||
|
model = self.widget("virt-type").get_model()
|
||||||
|
model.clear()
|
||||||
|
|
||||||
|
# Allow choosing between qemu and kvm for archs that traditionally
|
||||||
|
# have a decent amount of TCG usage, like armv7l
|
||||||
|
domains = [d.hypervisor_type for d in self._capsinfo.guest.domains[:]]
|
||||||
|
if not self.conn.is_qemu():
|
||||||
|
domains = []
|
||||||
|
elif self._capsinfo.arch in ["i686", "x86_64", "aarch64",
|
||||||
|
"ppc64", "ppc64le"]:
|
||||||
|
domains = []
|
||||||
|
|
||||||
|
default = 0
|
||||||
|
if self._capsinfo.hypervisor_type in domains:
|
||||||
|
default = domains.index(self._capsinfo.hypervisor_type)
|
||||||
|
|
||||||
|
prios = ["kvm"]
|
||||||
|
for domain in prios:
|
||||||
|
if domain not in domains:
|
||||||
|
continue
|
||||||
|
domains.remove(domain)
|
||||||
|
domains.insert(0, domain)
|
||||||
|
|
||||||
|
for domain in domains:
|
||||||
|
label = self.conn.pretty_hv(self._capsinfo.os_type, domain)
|
||||||
|
model.append([label, domain])
|
||||||
|
|
||||||
|
show = bool(len(model) > 1)
|
||||||
|
uiutil.set_grid_row_visible(self.widget("virt-type"), show)
|
||||||
|
self.widget("virt-type").set_active(default)
|
||||||
|
|
||||||
def _populate_machine(self):
|
def _populate_machine(self):
|
||||||
lst = self.widget("machine")
|
model = self.widget("machine").get_model()
|
||||||
model = lst.get_model()
|
|
||||||
model.clear()
|
model.clear()
|
||||||
|
|
||||||
machines = self._capsinfo.machines[:]
|
machines = self._capsinfo.machines[:]
|
||||||
@ -811,11 +858,11 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
model.append([m])
|
model.append([m])
|
||||||
|
|
||||||
show = (len(machines) > 1)
|
show = (len(machines) > 1)
|
||||||
uiutil.set_grid_row_visible(lst, show)
|
uiutil.set_grid_row_visible(self.widget("machine"), show)
|
||||||
if show:
|
if show:
|
||||||
lst.set_active(default)
|
self.widget("machine").set_active(default)
|
||||||
else:
|
else:
|
||||||
lst.emit("changed")
|
self.widget("machine").emit("changed")
|
||||||
|
|
||||||
def _populate_conn_list(self, urihint=None):
|
def _populate_conn_list(self, urihint=None):
|
||||||
conn_list = self.widget("create-conn")
|
conn_list = self.widget("create-conn")
|
||||||
@ -1232,20 +1279,29 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
uiutil.set_grid_row_visible(
|
uiutil.set_grid_row_visible(
|
||||||
self.widget("dtb-warn-virtio"), show_dtb_virtio)
|
self.widget("dtb-warn-virtio"), show_dtb_virtio)
|
||||||
|
|
||||||
def _hv_changed(self, src):
|
def _xen_type_changed(self, ignore):
|
||||||
hv = uiutil.get_list_selection(src, column=1)
|
os_type = uiutil.get_list_selection(self.widget("xen-type"), column=1)
|
||||||
if not hv:
|
print "xen_type_changed", os_type
|
||||||
|
if not os_type:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._change_caps(hv)
|
self._change_caps(os_type)
|
||||||
self._populate_arch()
|
self._populate_arch()
|
||||||
|
|
||||||
def _arch_changed(self, src):
|
def _arch_changed(self, ignore):
|
||||||
arch = uiutil.get_list_selection(src)
|
arch = uiutil.get_list_selection(self.widget("arch"), column=1)
|
||||||
if not arch:
|
if not arch:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._change_caps(self._capsinfo.os_type, arch)
|
self._change_caps(self._capsinfo.os_type, arch)
|
||||||
|
self._populate_virt_type()
|
||||||
|
|
||||||
|
def _virt_type_changed(self, ignore):
|
||||||
|
domtype = uiutil.get_list_selection(self.widget("virt-type"), column=1)
|
||||||
|
if not domtype:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._change_caps(self._capsinfo.os_type, self._capsinfo.arch, domtype)
|
||||||
|
|
||||||
|
|
||||||
# Install page listeners
|
# Install page listeners
|
||||||
|
Loading…
Reference in New Issue
Block a user