]> xenbits.xensource.com Git - xen.git/commitdiff
xend: Use AUTO_PHP_SLOT_STR=0xff rather than 0x0 for auto pci allocation
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Mar 2009 10:42:32 +0000 (10:42 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Mar 2009 10:42:32 +0000 (10:42 +0000)
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@verge.net.au>
tools/python/xen/xend/XendConstants.py
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/server/pciif.py
tools/python/xen/xm/main.py

index fa72edc5af2d629933cdb3fcd5368042625d29f0..b1c2957a7afca71ea3136dbce1d8c7ac3fd36300 100644 (file)
@@ -135,3 +135,6 @@ VTPM_DELETE_SCRIPT = '/etc/xen/scripts/vtpm-delete'
 
 XS_VMROOT = "/vm/"
 
+NR_PCI_DEV = 32
+AUTO_PHP_SLOT = NR_PCI_DEV
+AUTO_PHP_SLOT_STR = "%02x" % NR_PCI_DEV
index d1161944ea7dc056d2ca6060bb576a5f3b6bdbc1..0050a3ac72c321f206fa2baf838e3d29685ccfde 100644 (file)
@@ -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 51189c7e7862934c92dfaa880f2d739d633588c4..2344de40415bb9ef90cbcf37024349797b9fa936 100644 (file)
@@ -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 c7bc21e523c0fe33ef6b732b7afd53623711accc..985e21de6d370a18b6400c1021481cd39649b594 100644 (file)
@@ -2456,7 +2456,7 @@ def parse_pci_configuration(args, state, opts = ''):
     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})[:,]" + \