xend: Use AUTO_PHP_SLOT_STR=0xff rather than 0x0 for auto pci 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@verge.net.au>
This commit is contained in:
Keir Fraser committed 2009-03-17 10:42:32 +00:00
1 parent 27db6136ea
commit 33548d1102
4 files changed
+8 -4

No files matched your search

+3
View 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
+2 -2
View 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)))
+2 -1
View 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)
+1 -1
View 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})[:,]" + \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.