mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
There are multiple models of the panic device, the address type is only
one and is valid only for "isa" model.
To not break the virt-install/virt-xml the command line parser needs to
be updated. Before this patch there was only one parameter that
configured the "iobase". Now the first parameter configures a model
but to keep it backward compatible it follows these rules:
1. there is only one parameter and it matches known model:
--panic isa
<panic model='isa'>
<address iobase='0x505' type='isa'/>
</panic>
2. there is only one parameter and it doesn't match any model:
--panic 0x505
<panic model='isa'>
<address iobase='0x505' type='isa'/>
</panic>
3. there are two parameters:
--panic isa,iobase=0x505
<panic model='isa'>
<address iobase='0x505' type='isa'/>
</panic>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
#
|
|
# Copyright 2013 Fujitsu Limited.
|
|
# Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
# MA 02110-1301 USA.
|
|
|
|
from .device import VirtualDevice
|
|
from .xmlbuilder import XMLProperty
|
|
|
|
|
|
class VirtualPanicDevice(VirtualDevice):
|
|
|
|
virtual_device_type = VirtualDevice.VIRTUAL_DEV_PANIC
|
|
|
|
MODEL_DEFAULT = "default"
|
|
MODEL_ISA = "isa"
|
|
MODELS = [MODEL_ISA]
|
|
|
|
ISA_ADDRESS_TYPE = "isa"
|
|
IOBASE_DEFAULT = "0x505"
|
|
|
|
@staticmethod
|
|
def get_pretty_model(panic_model):
|
|
if panic_model == VirtualPanicDevice.MODEL_ISA:
|
|
return _("ISA")
|
|
return panic_model
|
|
|
|
def _get_default_address_type(self):
|
|
if self.iobase:
|
|
return VirtualPanicDevice.ISA_ADDRESS_TYPE
|
|
return None
|
|
|
|
model = XMLProperty("./@model",
|
|
default_cb=lambda s: VirtualPanicDevice.MODEL_ISA,
|
|
default_name=MODEL_DEFAULT)
|
|
type = XMLProperty("./address/@type",
|
|
default_cb=_get_default_address_type)
|
|
iobase = XMLProperty("./address/@iobase",
|
|
default_cb=lambda s: s.IOBASE_DEFAULT)
|
|
|
|
VirtualPanicDevice.register_type()
|