mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-21 09:34:12 +03:00
addhardware: panic: default to asking libvirt for default model
Drop our hardcoded model lists, and just ask libvirt to fill in a model for us. Add an entry to the combo box so users can type in a non-default value if they want one. Long term libvirt should be providing all this info to us via domcapabilities Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
ebeb80073e
commit
c5a4664676
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.22"/>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
@ -1294,7 +1294,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=3 n-rows=3 -->
|
||||
<!-- n-columns=2 n-rows=1 -->
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
@ -1318,33 +1318,18 @@
|
||||
<object class="GtkComboBox" id="panic-model">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="has-entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
<property name="can-focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="grid2-atkobject">
|
||||
<property name="AtkObject::accessible-name">panic-tab</property>
|
||||
|
@ -270,8 +270,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
True, None)
|
||||
add_hw_option(_("RNG"), "system-run", PAGE_RNG, True, None)
|
||||
add_hw_option(_("Panic Notifier"), "system-run", PAGE_PANIC,
|
||||
bool(DevicePanic.get_models(self.vm.get_xmlobj())),
|
||||
_("Not supported for this hypervisor/libvirt/arch combination."))
|
||||
True, None)
|
||||
add_hw_option(_("VirtIO VSOCK"), "network-idle", PAGE_VSOCK,
|
||||
self.vm.is_hvm(),
|
||||
_("Not supported for this hypervisor/libvirt/arch combination."))
|
||||
@ -512,16 +511,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
}
|
||||
return bus_mappings.get(bus, bus)
|
||||
|
||||
@staticmethod
|
||||
def panic_pretty_model(val):
|
||||
labels = {
|
||||
DevicePanic.MODEL_ISA: _("ISA"),
|
||||
DevicePanic.MODEL_PSERIES: _("pSeries"),
|
||||
DevicePanic.MODEL_HYPERV: _("Hyper-V"),
|
||||
DevicePanic.MODEL_S390: _("s390"),
|
||||
}
|
||||
return labels.get(val, val)
|
||||
|
||||
@staticmethod
|
||||
def rng_pretty_type(val):
|
||||
labels = {
|
||||
@ -871,12 +860,8 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
|
||||
def _build_panic_model_combo(self):
|
||||
values = []
|
||||
for m in DevicePanic.get_models(self.vm.get_xmlobj()):
|
||||
values.append([m, vmmAddHardware.panic_pretty_model(m)])
|
||||
|
||||
default = DevicePanic.get_default_model(self.vm.get_xmlobj())
|
||||
uiutil.build_simple_combo(self.widget("panic-model"), values, default_value=default)
|
||||
values = [[None, _("Hypervisor default")]]
|
||||
uiutil.build_simple_combo(self.widget("panic-model"), values)
|
||||
|
||||
|
||||
def _build_controller_type_combo(self):
|
||||
|
@ -2058,9 +2058,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
self.tpmdetails.set_dev(tpmdev)
|
||||
|
||||
def _refresh_panic_page(self, dev):
|
||||
model = dev.model or "isa"
|
||||
pmodel = vmmAddHardware.panic_pretty_model(model)
|
||||
self.widget("panic-model").set_text(pmodel)
|
||||
self.widget("panic-model").set_text(dev.model or "")
|
||||
|
||||
def _refresh_rng_page(self, dev):
|
||||
is_random = dev.backend_model == "random"
|
||||
|
@ -12,11 +12,6 @@ from ..xmlbuilder import XMLProperty
|
||||
class DevicePanic(Device):
|
||||
XML_NAME = "panic"
|
||||
|
||||
MODEL_ISA = "isa"
|
||||
MODEL_PSERIES = "pseries"
|
||||
MODEL_HYPERV = "hyperv"
|
||||
MODEL_S390 = "s390"
|
||||
|
||||
model = XMLProperty("./@model")
|
||||
set_stub = XMLProperty(".", is_bool=True)
|
||||
|
||||
@ -25,24 +20,6 @@ class DevicePanic(Device):
|
||||
# Default config #
|
||||
##################
|
||||
|
||||
@staticmethod
|
||||
def get_models(guest):
|
||||
if guest.os.is_x86():
|
||||
return [DevicePanic.MODEL_ISA,
|
||||
DevicePanic.MODEL_HYPERV]
|
||||
elif guest.os.is_pseries():
|
||||
return [DevicePanic.MODEL_PSERIES]
|
||||
elif guest.os.is_s390x():
|
||||
return [DevicePanic.MODEL_S390]
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def get_default_model(guest):
|
||||
models = DevicePanic.get_models(guest)
|
||||
if models:
|
||||
return models[0]
|
||||
return None
|
||||
|
||||
def set_defaults(self, guest):
|
||||
if not self.address.type and self.address.iobase:
|
||||
self.address.type = "isa"
|
||||
|
Loading…
Reference in New Issue
Block a user