Skip to contentSkip to conversation

xend: Use parse_hex() in XendPPCI.py

PATCH New Yosuke Iwamatsu 1 participant 1 message Mar 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xend: Use parse_hex() in XendPPCI.py

tools/python/xen/xend/XendPPCI.py +6 -4
diff -r dd489125a2e7 tools/python/xen/xend/XendPPCI.py
@@ -19,6 +19,8 @@
 from xen.xend.XendBase import XendBase
 from xen.xend.XendBase import XendAPIStore
 from xen.xend import uuid as genuuid
+
+from xen.util.pci import parse_hex
 
 class XendPPCI(XendBase):
     """Representation of a physical PCI device."""
@@ -72,10 +74,10 @@
  
     def get_by_sbdf(self, domain, bus, slot, func):
         for ppci in XendAPIStore.get_all("PPCI"):
-            if ppci.get_domain() == int(domain, 16) and \
-               ppci.get_bus() == int(bus, 16) and \
-               ppci.get_slot() == int(slot, 16) and \
-               ppci.get_func() == int(func, 16):
+            if ppci.get_domain() == parse_hex(domain) and \
+               ppci.get_bus() == parse_hex(bus) and \
+               ppci.get_slot() == parse_hex(slot) and \
+               ppci.get_func() == parse_hex(func):
                 return ppci.get_uuid()
         return None