[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [rfc 2/2 v2] xend: Use AUTO_PHP_SLOT_STR=0xff rather than0x0 for auto slot allocation
Rather than use "0x0" to signify that the hotplug slot should be automatically selected by qemu-dm, define AUTO_PHP_SLOT_STR. At the same time, change the magic value form 0x0 to 0xff, in line with changes made to qemu-dm to allow any unused PCI device to be used for hotplug. Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx> --- tools/python/xen/xend/XendConstants.py | 3 +++ tools/python/xen/xend/XendDomainInfo.py | 4 ++-- tools/python/xen/xend/server/pciif.py | 3 ++- tools/python/xen/xm/main.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) * Fri, 13 Mar 2009 18:07:36 +1100 Initial public release * Mon, 16 Mar 2009 10:59:53 +1100 Put constancs in python/xen/xend/XendConstants.py instead of tools/python/xen/util/xsconstants.py which is for security constants. As suggested by Masaki Kanno along with other possible locations: tools/python/xen/util/pci.py tools/python/xen/xend/server/DevConstants.py XendConstants.py seemed most appropriate to me. Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-unstable.hg.orig/tools/python/xen/xend/XendDomainInfo.py 2009-03-16 10:08:40.000000000 +1100 +++ xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py 2009-03-16 10:35:59.000000000 +1100 @@ -793,7 +793,7 @@ class XendDomainInfo: existing_dev_uuid = sxp.child_value(existing_dev_info, 'uuid') existing_pci_conf = self.info['devices'][existing_dev_uuid][1] existing_pci_devs = existing_pci_conf['devs'] - vslt = '0x0' + vslt = AUTO_PHP_SLOT_STR for x in existing_pci_devs: if ( int(x['domain'], 16) == int(dev['domain'], 16) and int(x['bus'], 16) == int(dev['bus'], 16) and @@ -801,7 +801,7 @@ class XendDomainInfo: int(x['func'], 16) == int(dev['func'], 16) ): vslt = x['vslt'] break - if vslt == '0x0': + if vslt == AUTO_PHP_SLOT_STR: raise VmError("Device %04x:%02x:%02x.%01x is not connected" % (int(dev['domain'],16), int(dev['bus'],16), int(dev['slot'],16), int(dev['func'],16))) Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py =================================================================== --- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py 2009-03-16 10:08:40.000000000 +1100 +++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py 2009-03-16 10:23:21.000000000 +1100 @@ -24,6 +24,7 @@ from xen.xend import sxp from xen.xend import arch from xen.xend.XendError import VmError from xen.xend.XendLogging import log +from xen.xend.XendConstants import * from xen.xend.server.DevController import DevController from xen.xend.server.DevConstants import xenbusState @@ -218,7 +219,7 @@ class PciController(DevController): try: dev_dict['vslt'] = slot_list[i] except IndexError: - dev_dict['vslt'] = '0x0' + dev_dict['vslt'] = AUTO_PHP_SLOT_STR pci_devs.append(dev_dict) Index: xen-unstable.hg/tools/python/xen/xm/main.py =================================================================== --- xen-unstable.hg.orig/tools/python/xen/xm/main.py 2009-03-16 10:08:40.000000000 +1100 +++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-03-16 10:51:59.000000000 +1100 @@ -2456,7 +2456,7 @@ def parse_pci_configuration(args, state, if len(args) == 3: vslt = args[2] else: - vslt = '0x0' #chose a free virtual PCI slot + vslt = AUTO_PHP_SLOT_STR pci=['pci'] pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \ r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \ Index: xen-unstable.hg/tools/python/xen/xend/XendConstants.py =================================================================== --- xen-unstable.hg.orig/tools/python/xen/xend/XendConstants.py 2009-03-16 10:52:21.000000000 +1100 +++ xen-unstable.hg/tools/python/xen/xend/XendConstants.py 2009-03-16 10:53:03.000000000 +1100 @@ -135,3 +135,6 @@ VTPM_DELETE_SCRIPT = '/etc/xen/scripts/v XS_VMROOT = "/vm/" +NR_PCI_DEV = 32 +AUTO_PHP_SLOT = NR_PCI_DEV +AUTO_PHP_SLOT_STR = "%02x" % NR_PCI_DEV _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |