mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
devicepanic: add all models supported by libvirt
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
48604bfb37
commit
9f191da5c5
@ -0,0 +1,18 @@
|
||||
<domain type="kvm">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="ppc64le" machine="pseries">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<clock offset="utc"/>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type="usb" index="0" model="none"/>
|
||||
<console type="pty"/>
|
||||
<panic model="pseries"/>
|
||||
</devices>
|
||||
</domain>
|
@ -0,0 +1,20 @@
|
||||
<domain type="kvm">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="s390x" machine="s390-ccw-virtio">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<clock offset="utc"/>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-s390x</emulator>
|
||||
<controller type="usb" index="0" model="none"/>
|
||||
<console type="pty">
|
||||
<target type="sclp"/>
|
||||
</console>
|
||||
<panic model="s390"/>
|
||||
</devices>
|
||||
</domain>
|
@ -654,6 +654,12 @@ c.add_compare("--panic default", "panic-default")
|
||||
c.add_compare("--panic isa", "panic-isa")
|
||||
c.add_compare("--panic isa,iobase=0x505", "panic-isa-iobase")
|
||||
|
||||
c = vinst.add_category("panic", "--connect %(URI-KVM-PPC64LE)s --noautoconsole --import --disk none --graphics none --controller usb,model=none --network none")
|
||||
c.add_compare("--panic default", "panic-pseries-default")
|
||||
|
||||
c = vinst.add_category("panic", "--connect %(URI-KVM-S390X)s --noautoconsole --import --disk none --graphics none --controller usb,model=none --network none")
|
||||
c.add_compare("--panic default", "panic-s390x-default")
|
||||
|
||||
|
||||
################################################
|
||||
# Invalid devices that hit virtinst code paths #
|
||||
|
@ -978,11 +978,12 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
def _build_panic_models(self, combo):
|
||||
models = []
|
||||
for m in virtinst.VirtualPanicDevice.MODELS:
|
||||
for m in virtinst.VirtualPanicDevice.get_models(self.vm.get_xmlobj().os):
|
||||
models.append([m, virtinst.VirtualPanicDevice.get_pretty_model(m)])
|
||||
|
||||
self._build_combo_with_values(combo, models,
|
||||
virtinst.VirtualPanicDevice.MODEL_ISA)
|
||||
virtinst.VirtualPanicDevice.get_default_model(
|
||||
self.vm.get_xmlobj().os))
|
||||
|
||||
|
||||
#########################
|
||||
|
@ -27,7 +27,10 @@ class VirtualPanicDevice(VirtualDevice):
|
||||
|
||||
MODEL_DEFAULT = "default"
|
||||
MODEL_ISA = "isa"
|
||||
MODELS = [MODEL_ISA]
|
||||
MODEL_PSERIES = "pseries"
|
||||
MODEL_HYPERV = "hyperv"
|
||||
MODEL_S390 = "s390"
|
||||
MODELS = [MODEL_ISA, MODEL_PSERIES, MODEL_HYPERV, MODEL_S390]
|
||||
|
||||
ISA_ADDRESS_TYPE = "isa"
|
||||
|
||||
@ -35,8 +38,31 @@ class VirtualPanicDevice(VirtualDevice):
|
||||
def get_pretty_model(panic_model):
|
||||
if panic_model == VirtualPanicDevice.MODEL_ISA:
|
||||
return _("ISA")
|
||||
elif panic_model == VirtualPanicDevice.MODEL_PSERIES:
|
||||
return _("pSeries")
|
||||
elif panic_model == VirtualPanicDevice.MODEL_HYPERV:
|
||||
return _("Hyper-V")
|
||||
elif panic_model == VirtualPanicDevice.MODEL_S390:
|
||||
return _("s390")
|
||||
return panic_model
|
||||
|
||||
@staticmethod
|
||||
def get_models(os):
|
||||
if os.is_x86():
|
||||
return [VirtualPanicDevice.MODEL_ISA, VirtualPanicDevice.MODEL_HYPERV]
|
||||
elif os.is_pseries():
|
||||
return [VirtualPanicDevice.MODEL_PSERIES]
|
||||
elif os.is_s390x():
|
||||
return [VirtualPanicDevice.MODEL_S390]
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_default_model(os):
|
||||
models = VirtualPanicDevice.get_models(os)
|
||||
if models:
|
||||
return models[0]
|
||||
return None
|
||||
|
||||
def _get_default_address_type(self):
|
||||
if self.iobase:
|
||||
return VirtualPanicDevice.ISA_ADDRESS_TYPE
|
||||
|
@ -38,6 +38,7 @@ from .devicecontroller import VirtualController
|
||||
from .devicedisk import VirtualDisk
|
||||
from .devicegraphics import VirtualGraphics
|
||||
from .deviceinput import VirtualInputDevice
|
||||
from .devicepanic import VirtualPanicDevice
|
||||
from .deviceredirdev import VirtualRedirDevice
|
||||
from .devicerng import VirtualRNGDevice
|
||||
from .devicevideo import VirtualVideoDevice
|
||||
@ -796,6 +797,7 @@ class Guest(XMLBuilder):
|
||||
self._set_net_defaults()
|
||||
self._set_video_defaults()
|
||||
self._set_sound_defaults()
|
||||
self._set_panic_defaults()
|
||||
|
||||
def _is_full_os_container(self):
|
||||
if not self.os.is_container():
|
||||
@ -1246,3 +1248,8 @@ class Guest(XMLBuilder):
|
||||
video.model = video_model
|
||||
if video.model == 'virtio' and self.has_gl():
|
||||
video.accel3d = True
|
||||
|
||||
def _set_panic_defaults(self):
|
||||
for panic in self.get_devices("panic"):
|
||||
if panic.model == VirtualPanicDevice.MODEL_DEFAULT:
|
||||
panic.model = VirtualPanicDevice.get_default_model(self.os)
|
||||
|
Loading…
Reference in New Issue
Block a user