mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: device: Remove set_addrstr()
There's only one user now, in cli.py. Open code it there Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
@@ -3498,7 +3498,17 @@ class ParserController(VirtCLIParser):
|
||||
###################
|
||||
|
||||
def set_address_cb(self, inst, val, virtarg):
|
||||
inst.address.set_addrstr(val)
|
||||
addrstr = val
|
||||
if addrstr.count(":") in [1, 2] and "." in addrstr:
|
||||
inst.address.type = inst.address.ADDRESS_TYPE_PCI
|
||||
addrstr, inst.address.function = addrstr.split(".", 1)
|
||||
addrstr, inst.address.slot = addrstr.rsplit(":", 1)
|
||||
inst.address.domain = "0"
|
||||
if ":" in addrstr:
|
||||
inst.address.domain, inst.address.bus = addrstr.split(":", 1)
|
||||
return
|
||||
raise ValueError(
|
||||
_("Expected PCI format string for '%s'") % addrstr)
|
||||
|
||||
@classmethod
|
||||
def _init_class(cls, **kwargs):
|
||||
|
||||
@@ -58,21 +58,6 @@ class DeviceAddress(XMLBuilder):
|
||||
_XML_PROP_ORDER = ["type", "domain", "controller", "bus", "slot",
|
||||
"function", "target", "unit", "multifunction"]
|
||||
|
||||
def set_addrstr(self, addrstr):
|
||||
if addrstr is None:
|
||||
return
|
||||
|
||||
if addrstr.count(":") in [1, 2] and "." in addrstr:
|
||||
self.type = self.ADDRESS_TYPE_PCI
|
||||
addrstr, self.function = addrstr.split(".", 1)
|
||||
addrstr, self.slot = addrstr.rsplit(":", 1)
|
||||
self.domain = "0"
|
||||
if ":" in addrstr:
|
||||
self.domain, self.bus = addrstr.split(":", 1)
|
||||
else:
|
||||
raise ValueError(_("Could not determine or unsupported "
|
||||
"format of '%s'") % addrstr)
|
||||
|
||||
def pretty_desc(self):
|
||||
pretty_desc = None
|
||||
if self.type == self.ADDRESS_TYPE_DRIVE:
|
||||
|
||||
Reference in New Issue
Block a user