devices: panic: drop DeviceAddress wrapper opts

Just use regular address handling to represent 'type' and 'iobase'.
Add address handling to the command line
This commit is contained in:
Cole Robinson 2019-05-12 09:18:36 -04:00
parent 913c9de29b
commit 3c57b13322
5 changed files with 10 additions and 11 deletions

View File

@ -415,7 +415,7 @@
</backend>
</rng>
<panic model="isa">
<address iobase="507" type="isa"/>
<address type="isa" iobase="507"/>
</panic>
<vsock model="virtio">
<cid address="17"/>

View File

@ -179,7 +179,7 @@
</backend>
</rng>
<panic model="isa">
<address iobase="0x506" type="isa"/>
<address type="isa" iobase="0x506"/>
</panic>
</devices>
<seclabel type="static" model="selinux" relabel="yes">
@ -374,7 +374,7 @@
</backend>
</rng>
<panic model="isa">
<address iobase="0x506" type="isa"/>
<address type="isa" iobase="0x506"/>
</panic>
</devices>
<seclabel type="static" model="selinux" relabel="yes">

View File

@ -1051,8 +1051,8 @@ class XMLParseTest(unittest.TestCase):
dev1 = guest.devices.panic[0]
check = self._make_checker(dev1)
check("type", "isa", None, "isa")
check("iobase", "0x505", None, "0x506")
check("address.type", "isa", None, "isa")
check("address.iobase", "0x505", None, "0x506")
self._alter_compare(guest.get_xml(), outfile)
def testQEMUXMLNS(self):

View File

@ -2937,7 +2937,7 @@ class ParserPanic(VirtCLIParser):
def set_model_cb(self, inst, val, virtarg):
if self.compat_mode and val.startswith("0x"):
inst.model = DevicePanic.MODEL_ISA
inst.iobase = val
inst.address.iobase = val
else:
inst.model = val
@ -2950,9 +2950,10 @@ class ParserPanic(VirtCLIParser):
@classmethod
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
_add_device_address_args(cls)
cls.add_arg("model", "model", cb=cls.set_model_cb,
ignore_default=True)
cls.add_arg("iobase", "iobase")
cls.add_arg("iobase", "address.iobase")
###################

View File

@ -41,8 +41,6 @@ class DevicePanic(Device):
return []
model = XMLProperty("./@model")
type = XMLProperty("./address/@type")
iobase = XMLProperty("./address/@iobase")
##################
@ -57,7 +55,7 @@ class DevicePanic(Device):
return None
def set_defaults(self, guest):
if not self.type and self.iobase:
self.type = "isa"
if not self.address.type and self.address.iobase:
self.address.type = "isa"
if not self.model:
self.model = self.get_default_model(guest)