VirtualController: Convert to new style XML props
This commit is contained in:
parent
9c92d8e092
commit
a9296ec3ae
|
@ -176,7 +176,7 @@ def get_basic_paravirt_guest(installer=None):
|
|||
g.uuid = "12345678-1234-1234-1234-123456789012"
|
||||
gdev = VirtualGraphics(_conn)
|
||||
gdev.type = "vnc"
|
||||
gdev.keymap= "ja"
|
||||
gdev.keymap = "ja"
|
||||
g.add_device(gdev)
|
||||
g.vcpus = 5
|
||||
|
||||
|
|
|
@ -768,9 +768,11 @@ class TestXMLConfig(unittest.TestCase):
|
|||
g.add_device(d)
|
||||
|
||||
# Controller devices
|
||||
c1 = VirtualController.get_class_for_type(VirtualController.CONTROLLER_TYPE_IDE)(g.conn)
|
||||
c1 = VirtualController(g.conn)
|
||||
c1.type = "ide"
|
||||
c1.index = "3"
|
||||
c2 = VirtualController.get_class_for_type(VirtualController.CONTROLLER_TYPE_VIRTIOSERIAL)(g.conn)
|
||||
c2 = VirtualController(g.conn)
|
||||
c2.type = "virtio-serial"
|
||||
c2.ports = "32"
|
||||
c2.vectors = "17"
|
||||
g.add_device(c1)
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
<master startport='4'/>
|
||||
<address type='pci' domain='0' bus='0' slot='4' function='2'/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
<controller type="ide" index="1"/>
|
||||
<controller type="virtio-serial" index="7" ports="5"/>
|
||||
<controller type="scsi" index="2"/>
|
||||
<controller type="usb" index="9" model="ich9-ehci1">
|
||||
<controller type="usb" index="9" model="ich9-uhci1">
|
||||
<master startport="2"/>
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="2"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -365,25 +365,23 @@ class XMLParseTest(unittest.TestCase):
|
|||
|
||||
check = self._make_checker(dev1)
|
||||
check("type", "ide")
|
||||
check("index", "3", "1")
|
||||
check("index", 3, 1)
|
||||
|
||||
check = self._make_checker(dev2)
|
||||
check("type", "virtio-serial")
|
||||
check("index", "0", "7")
|
||||
check("ports", "32", "5")
|
||||
check("vectors", "17", None)
|
||||
check("index", 0, 7)
|
||||
check("ports", 32, 5)
|
||||
check("vectors", 17, None)
|
||||
|
||||
check = self._make_checker(dev3)
|
||||
check("type", "scsi")
|
||||
check("index", "1", "2")
|
||||
check("index", 1, 2)
|
||||
|
||||
check = self._make_checker(dev4)
|
||||
check("type", "usb")
|
||||
check("index", "3", "9")
|
||||
check("model", "ich9-ehci1")
|
||||
|
||||
check = self._make_checker(dev4.get_master())
|
||||
check("startport", "4", "2", None)
|
||||
check("type", "usb", "foo", "usb")
|
||||
check("index", 3, 9)
|
||||
check("model", "ich9-ehci1", "ich9-uhci1")
|
||||
check("master_startport", 4, 2)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ from virtinst import (VirtualCharDevice,
|
|||
VirtualVideoDevice, VirtualWatchdog,
|
||||
VirtualFilesystem, VirtualSmartCardDevice,
|
||||
VirtualRedirDevice, VirtualTPMDevice)
|
||||
from virtinst.VirtualController import VirtualControllerSCSI
|
||||
from virtinst import VirtualController
|
||||
|
||||
import virtManager.util as util
|
||||
import virtManager.uihelpers as uihelpers
|
||||
|
@ -1368,8 +1368,9 @@ class vmmAddHardware(vmmGObjectUI):
|
|||
disk.vmm_controller = None
|
||||
if (controller_model == "virtio-scsi") and (bus == "scsi"):
|
||||
controllers = self.vm.get_controller_devices()
|
||||
controller = VirtualControllerSCSI(conn)
|
||||
controller.set_model(controller_model)
|
||||
controller = VirtualController(conn)
|
||||
controller.type = "scsi"
|
||||
controller.model = controller_model
|
||||
disk.vmm_controller = controller
|
||||
for d in controllers:
|
||||
if controller.type == d.type:
|
||||
|
|
|
@ -3367,7 +3367,7 @@ class vmmDetails(vmmGObjectUI):
|
|||
combo = self.widget("controller-model-combo")
|
||||
model = combo.get_model()
|
||||
model.clear()
|
||||
if dev.type == virtinst.VirtualController.CONTROLLER_TYPE_USB:
|
||||
if dev.type == virtinst.VirtualController.TYPE_USB:
|
||||
model.append(["Default", "Default"])
|
||||
model.append(["ich9-ehci1", "USB 2"])
|
||||
self.widget("config-remove").set_sensitive(False)
|
||||
|
|
|
@ -419,7 +419,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
##############################
|
||||
|
||||
# Rename
|
||||
|
||||
def define_name(self, newname):
|
||||
# Do this, so that _guest_to_define has original inactive XML
|
||||
self._invalidate_xml()
|
||||
|
@ -480,7 +479,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return ret
|
||||
|
||||
# CPU define methods
|
||||
|
||||
def define_vcpus(self, vcpus, maxvcpus):
|
||||
def change(guest):
|
||||
guest.vcpus = int(vcpus)
|
||||
|
@ -535,7 +533,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_guest(change)
|
||||
|
||||
# Mem define methods
|
||||
|
||||
def define_both_mem(self, memory, maxmem):
|
||||
def change(guest):
|
||||
guest.memory = int(memory)
|
||||
|
@ -543,7 +540,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_guest(change)
|
||||
|
||||
# Security define methods
|
||||
|
||||
def define_seclabel(self, model, t, label, relabel):
|
||||
def change(guest):
|
||||
seclabel = guest.seclabel
|
||||
|
@ -564,7 +560,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_guest(change)
|
||||
|
||||
# Machine config define methods
|
||||
|
||||
def define_acpi(self, newvalue):
|
||||
def change(guest):
|
||||
guest.features["acpi"] = newvalue
|
||||
|
@ -590,7 +585,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_guest(change)
|
||||
|
||||
# Boot define methods
|
||||
|
||||
def set_boot_device(self, boot_list):
|
||||
def change(guest):
|
||||
guest.installer.bootconfig.bootorder = boot_list
|
||||
|
@ -611,7 +605,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_guest(change)
|
||||
|
||||
# Disk define methods
|
||||
|
||||
def define_storage_media(self, devobj, newpath):
|
||||
def change(editdev):
|
||||
editdev.path = newpath
|
||||
|
@ -730,7 +723,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Graphics define methods
|
||||
|
||||
def define_graphics_password(self, devobj, newval):
|
||||
def change(editdev):
|
||||
editdev.passwd = newval or None
|
||||
|
@ -764,7 +756,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Sound define methods
|
||||
|
||||
def define_sound_model(self, devobj, newmodel):
|
||||
def change(editdev):
|
||||
if editdev.model != newmodel:
|
||||
|
@ -772,8 +763,7 @@ class vmmDomain(vmmLibvirtObject):
|
|||
editdev.model = newmodel
|
||||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Vide define methods
|
||||
|
||||
# Video define methods
|
||||
def define_video_model(self, devobj, newmodel):
|
||||
def change(editdev):
|
||||
if newmodel == editdev.model:
|
||||
|
@ -792,7 +782,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Watchdog define methods
|
||||
|
||||
def define_watchdog_model(self, devobj, newval):
|
||||
def change(editdev):
|
||||
if editdev.model != newval:
|
||||
|
@ -805,7 +794,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Smartcard define methods
|
||||
|
||||
def define_smartcard_mode(self, devobj, newmodel):
|
||||
def change(editdev):
|
||||
editdev.mode = newmodel
|
||||
|
@ -813,7 +801,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
return self._redefine_device(change, devobj)
|
||||
|
||||
# Controller define methods
|
||||
|
||||
def define_controller_model(self, devobj, newmodel):
|
||||
def change(editdev):
|
||||
ignore = editdev
|
||||
|
@ -821,7 +808,7 @@ class vmmDomain(vmmLibvirtObject):
|
|||
guest = self._get_guest_to_define()
|
||||
ctrls = guest.get_devices("controller")
|
||||
ctrls = [x for x in ctrls if (x.type ==
|
||||
virtinst.VirtualController.CONTROLLER_TYPE_USB)]
|
||||
virtinst.VirtualController.TYPE_USB)]
|
||||
for dev in ctrls:
|
||||
guest.remove_device(dev)
|
||||
|
||||
|
@ -830,13 +817,6 @@ class vmmDomain(vmmLibvirtObject):
|
|||
|
||||
return self._redefine_device(change, devobj)
|
||||
|
||||
# TPM define methods
|
||||
|
||||
def define_tpm_type(self, devobj, newtype):
|
||||
def change(editdev):
|
||||
editdev.type = newtype
|
||||
return self._redefine_device(change, devobj)
|
||||
|
||||
|
||||
|
||||
####################
|
||||
|
|
|
@ -36,7 +36,7 @@ from virtinst.VirtualDevice import VirtualDevice
|
|||
from virtinst.VirtualDisk import VirtualDisk
|
||||
from virtinst.VirtualInputDevice import VirtualInputDevice
|
||||
from virtinst.VirtualCharDevice import VirtualCharDevice
|
||||
from virtinst.VirtualController import VirtualControllerUSB
|
||||
from virtinst.VirtualController import VirtualController
|
||||
from virtinst.Clock import Clock
|
||||
from virtinst.Seclabel import Seclabel
|
||||
from virtinst.CPU import CPU
|
||||
|
@ -721,9 +721,8 @@ class Guest(XMLBuilder):
|
|||
if origpath:
|
||||
dev.path = origpath
|
||||
def get_vscsi_ctrl_xml():
|
||||
vscsi_class = virtinst.VirtualController.get_class_for_type(
|
||||
virtinst.VirtualController.CONTROLLER_TYPE_SCSI)
|
||||
ctrl = vscsi_class(self.conn)
|
||||
ctrl = virtinst.VirtualController(self.conn)
|
||||
ctrl.type = "scsi"
|
||||
ctrl.set_address("spapr-vio")
|
||||
return ctrl.get_xml_config()
|
||||
|
||||
|
@ -1293,23 +1292,27 @@ class Guest(XMLBuilder):
|
|||
remove_func(d)
|
||||
|
||||
def add_usb_ich9_controllers(self):
|
||||
ctrl = VirtualControllerUSB(self.conn,
|
||||
model="ich9-ehci1")
|
||||
ctrl = VirtualController(self.conn)
|
||||
ctrl.type = "usb"
|
||||
ctrl.model = "ich9-ehci1"
|
||||
self.add_device(ctrl)
|
||||
|
||||
ctrl = VirtualControllerUSB(self.conn,
|
||||
model="ich9-uhci1")
|
||||
ctrl.get_master().startport = 0
|
||||
ctrl = VirtualController(self.conn)
|
||||
ctrl.type = "usb"
|
||||
ctrl.model = "ich9-uhci1"
|
||||
ctrl.master_startport = 0
|
||||
self.add_device(ctrl)
|
||||
|
||||
ctrl = VirtualControllerUSB(self.conn,
|
||||
model="ich9-uhci2")
|
||||
ctrl.get_master().startport = 2
|
||||
ctrl = VirtualController(self.conn)
|
||||
ctrl.type = "usb"
|
||||
ctrl.model = "ich9-uhci2"
|
||||
ctrl.master_startport = 2
|
||||
self.add_device(ctrl)
|
||||
|
||||
ctrl = VirtualControllerUSB(self.conn,
|
||||
model="ich9-uhci3")
|
||||
ctrl.get_master().startport = 4
|
||||
ctrl = VirtualController(self.conn)
|
||||
ctrl.type = "usb"
|
||||
ctrl.model = "ich9-uhci3"
|
||||
ctrl.master_startport = 4
|
||||
self.add_device(ctrl)
|
||||
|
||||
def _set_defaults(self, devlist_func, remove_func, features):
|
||||
|
|
|
@ -18,194 +18,48 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
import logging
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualController(VirtualDevice):
|
||||
|
||||
_virtual_device_type = VirtualDevice.VIRTUAL_DEV_CONTROLLER
|
||||
|
||||
CONTROLLER_TYPE_IDE = "ide"
|
||||
CONTROLLER_TYPE_FDC = "fdc"
|
||||
CONTROLLER_TYPE_SCSI = "scsi"
|
||||
CONTROLLER_TYPE_SATA = "sata"
|
||||
CONTROLLER_TYPE_VIRTIOSERIAL = "virtio-serial"
|
||||
CONTROLLER_TYPE_USB = "usb"
|
||||
CONTROLLER_TYPE_PCI = "pci"
|
||||
CONTROLLER_TYPE_CCID = "ccid"
|
||||
CONTROLLER_TYPES = [CONTROLLER_TYPE_IDE, CONTROLLER_TYPE_FDC,
|
||||
CONTROLLER_TYPE_SCSI, CONTROLLER_TYPE_SATA,
|
||||
CONTROLLER_TYPE_VIRTIOSERIAL, CONTROLLER_TYPE_USB,
|
||||
CONTROLLER_TYPE_PCI, CONTROLLER_TYPE_CCID]
|
||||
TYPE_IDE = "ide"
|
||||
TYPE_FDC = "fdc"
|
||||
TYPE_SCSI = "scsi"
|
||||
TYPE_SATA = "sata"
|
||||
TYPE_VIRTIOSERIAL = "virtio-serial"
|
||||
TYPE_USB = "usb"
|
||||
TYPE_PCI = "pci"
|
||||
TYPE_CCID = "ccid"
|
||||
TYPES = [TYPE_IDE, TYPE_FDC,
|
||||
TYPE_SCSI, TYPE_SATA,
|
||||
TYPE_VIRTIOSERIAL, TYPE_USB,
|
||||
TYPE_PCI, TYPE_CCID]
|
||||
|
||||
@staticmethod
|
||||
def pretty_type(ctype):
|
||||
pretty_mappings = {
|
||||
VirtualController.CONTROLLER_TYPE_IDE : "IDE",
|
||||
VirtualController.CONTROLLER_TYPE_FDC : "Floppy",
|
||||
VirtualController.CONTROLLER_TYPE_SCSI : "SCSI",
|
||||
VirtualController.CONTROLLER_TYPE_SATA : "SATA",
|
||||
VirtualController.CONTROLLER_TYPE_VIRTIOSERIAL : "Virtio Serial",
|
||||
VirtualController.CONTROLLER_TYPE_USB : "USB",
|
||||
VirtualController.CONTROLLER_TYPE_PCI : "PCI",
|
||||
VirtualController.CONTROLLER_TYPE_CCID : "CCID",
|
||||
VirtualController.TYPE_IDE : "IDE",
|
||||
VirtualController.TYPE_FDC : "Floppy",
|
||||
VirtualController.TYPE_SCSI : "SCSI",
|
||||
VirtualController.TYPE_SATA : "SATA",
|
||||
VirtualController.TYPE_VIRTIOSERIAL : "Virtio Serial",
|
||||
VirtualController.TYPE_USB : "USB",
|
||||
VirtualController.TYPE_PCI : "PCI",
|
||||
VirtualController.TYPE_CCID : "CCID",
|
||||
}
|
||||
|
||||
if ctype not in pretty_mappings:
|
||||
return ctype
|
||||
return pretty_mappings[ctype]
|
||||
|
||||
@staticmethod
|
||||
def get_class_for_type(ctype):
|
||||
if ctype not in VirtualController.CONTROLLER_TYPES:
|
||||
raise ValueError("Unknown controller type '%s'" % ctype)
|
||||
_XML_PROP_ORDER = ["type", "index", "model"]
|
||||
|
||||
if ctype == VirtualController.CONTROLLER_TYPE_IDE:
|
||||
return VirtualControllerIDE
|
||||
elif ctype == VirtualController.CONTROLLER_TYPE_FDC:
|
||||
return VirtualControllerFDC
|
||||
elif ctype == VirtualController.CONTROLLER_TYPE_SCSI:
|
||||
return VirtualControllerSCSI
|
||||
elif ctype == VirtualController.CONTROLLER_TYPE_SATA:
|
||||
return VirtualControllerSATA
|
||||
elif ctype == VirtualController.CONTROLLER_TYPE_VIRTIOSERIAL:
|
||||
return VirtualControllerVirtioSerial
|
||||
elif ctype == VirtualController.CONTROLLER_TYPE_USB:
|
||||
return VirtualControllerUSB
|
||||
type = XMLProperty(xpath="./@type")
|
||||
model = XMLProperty(xpath="./@model")
|
||||
vectors = XMLProperty(xpath="./@vectors", is_int=True)
|
||||
ports = XMLProperty(xpath="./@ports", is_int=True)
|
||||
master_startport = XMLProperty(xpath="./master/@startport", is_int=True)
|
||||
|
||||
_controller_type = None
|
||||
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None, model=None):
|
||||
VirtualDevice.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self._index = 0
|
||||
self._ports = None
|
||||
self._vectors = None
|
||||
self._model = None
|
||||
self._master = VirtualDeviceMaster(conn,
|
||||
parsexml=parsexml,
|
||||
parsexmlnode=parsexmlnode)
|
||||
|
||||
if self._is_parse():
|
||||
return
|
||||
|
||||
self.model = model
|
||||
|
||||
def get_type(self):
|
||||
return self._controller_type
|
||||
type = XMLProperty(get_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_model(self):
|
||||
return self._model
|
||||
def set_model(self, model):
|
||||
self._model = model
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def get_index(self):
|
||||
return self._index
|
||||
def set_index(self, val):
|
||||
self._index = int(val)
|
||||
index = XMLProperty(get_index, set_index,
|
||||
xpath="./@index")
|
||||
|
||||
def get_vectors(self):
|
||||
return self._vectors
|
||||
def set_vectors(self, val):
|
||||
self._vectors = val
|
||||
vectors = XMLProperty(get_vectors, set_vectors,
|
||||
xpath="./@vectors")
|
||||
|
||||
def get_ports(self):
|
||||
return self._ports
|
||||
def set_ports(self, val):
|
||||
self._ports = val
|
||||
ports = XMLProperty(get_ports, set_ports,
|
||||
xpath="./@ports")
|
||||
|
||||
def set_master(self, masterstr):
|
||||
self._master.parse_friendly_master(masterstr)
|
||||
def get_master(self):
|
||||
return self._master
|
||||
|
||||
def _extra_config(self):
|
||||
return ""
|
||||
|
||||
def _get_xml_config(self):
|
||||
extra = self._extra_config()
|
||||
|
||||
xml = " <controller type='%s' index='%s'" % (self.type, self.index)
|
||||
if self.model:
|
||||
xml += " model='%s'" % self.model
|
||||
xml += extra
|
||||
childxml = self.indent(self._master.get_xml_config(), 6)
|
||||
if childxml:
|
||||
childxml += "\n"
|
||||
if len(childxml) == 0:
|
||||
return xml + "/>"
|
||||
xml += ">\n"
|
||||
xml += childxml
|
||||
xml += " </controller>"
|
||||
return xml
|
||||
|
||||
|
||||
class VirtualControllerIDE(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_IDE
|
||||
|
||||
|
||||
class VirtualControllerFDC(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_FDC
|
||||
|
||||
|
||||
class VirtualControllerSCSI(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_SCSI
|
||||
|
||||
|
||||
class VirtualControllerSATA(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_SATA
|
||||
|
||||
|
||||
class VirtualControllerVirtioSerial(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_VIRTIOSERIAL
|
||||
|
||||
def _extra_config(self):
|
||||
xml = ""
|
||||
if self.ports is not None:
|
||||
xml += " ports='%s'" % self.ports
|
||||
if self.vectors is not None:
|
||||
xml += " vectors='%s'" % self.vectors
|
||||
|
||||
return xml
|
||||
|
||||
|
||||
class VirtualControllerUSB(VirtualController):
|
||||
_controller_type = VirtualController.CONTROLLER_TYPE_USB
|
||||
|
||||
|
||||
class VirtualDeviceMaster(XMLBuilder):
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilder.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self._startport = None
|
||||
|
||||
def parse_friendly_master(self, masterstr):
|
||||
try:
|
||||
int(masterstr)
|
||||
self._startport = masterstr
|
||||
except:
|
||||
logging.exception("Error parsing device master.")
|
||||
return None
|
||||
|
||||
def _get_startport(self):
|
||||
return self._startport
|
||||
def _set_startport(self, val):
|
||||
self._startport = val
|
||||
startport = XMLProperty(_get_startport, _set_startport, xpath="./master/@startport")
|
||||
|
||||
def _get_xml_config(self):
|
||||
if self.startport is None:
|
||||
return
|
||||
|
||||
return "<master startport='%s'/>" % self.startport
|
||||
index = XMLProperty(xpath="./@index", is_int=True, default_cb=lambda s: 0)
|
||||
|
|
|
@ -1639,21 +1639,20 @@ def parse_controller(guest, optstring, dev=None):
|
|||
|
||||
# Peel the mode off the front
|
||||
opts = parse_optstr(optstring, remove_first="type")
|
||||
ctrltype = get_opt_param(opts, "type")
|
||||
address = get_opt_param(opts, "address")
|
||||
master = get_opt_param(opts, "master")
|
||||
|
||||
if not dev:
|
||||
cl = virtinst.VirtualController.get_class_for_type(ctrltype)
|
||||
dev = cl(guest.conn, model=opts.get("model"))
|
||||
dev = virtinst.VirtualController(guest.conn)
|
||||
|
||||
set_param = _build_set_param(dev, opts)
|
||||
|
||||
set_param("type", "type")
|
||||
set_param("model", "model")
|
||||
set_param("index", "index")
|
||||
dev.set_address(address)
|
||||
if master:
|
||||
dev.set_master(master)
|
||||
set_param("master_startport", "master")
|
||||
if address:
|
||||
dev.set_address(address)
|
||||
|
||||
if opts:
|
||||
raise ValueError(_("Unknown options %s") % opts.keys())
|
||||
|
||||
|
|
|
@ -438,10 +438,10 @@ class XMLProperty(property):
|
|||
return None
|
||||
return bool(val)
|
||||
elif self._is_int and val is not None:
|
||||
base = 10
|
||||
intkwargs = {}
|
||||
if "0x" in str(val):
|
||||
base = 16
|
||||
return int(val, base=base)
|
||||
intkwargs["base"] = 16
|
||||
return int(val, **intkwargs)
|
||||
elif self._convert_value_for_getter_cb:
|
||||
return self._convert_value_for_getter_cb(xmlbuilder, val)
|
||||
elif self._is_multi and val is None:
|
||||
|
|
Loading…
Reference in New Issue