ia64/xen-unstable

changeset 19704:ffcc665158ae

xend: requested_vslots is no longer needed

...following removal of the boot-time pci passthru protocol.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 03 11:19:51 2009 +0100 (2009-06-03)
parents 3ee4e1884c4e
children 4e22d660ece3
files tools/python/xen/util/pci.py tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/pciif.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/util/pci.py	Wed Jun 03 11:17:00 2009 +0100
     1.2 +++ b/tools/python/xen/util/pci.py	Wed Jun 03 11:19:51 2009 +0100
     1.3 @@ -146,20 +146,6 @@ def parse_pci_name(pci_name_string):
     1.4  
     1.5      return (domain, bus, slot, func)
     1.6  
     1.7 -def assigned_or_requested_vslot(dev):
     1.8 -    if isinstance(dev, types.DictType):
     1.9 -        if dev.has_key("vslot"):
    1.10 -            return dev["vslot"]
    1.11 -        if dev.has_key("requested_vslot"):
    1.12 -            return dev["requested_vslot"]
    1.13 -    elif isinstance(dev, (types.ListType, types.TupleType)):
    1.14 -        vslot = sxp.child_value(dev, 'vslot', None)
    1.15 -        if not vslot:
    1.16 -            vslot = sxp.child_value(dev, 'requested_vslot', None)
    1.17 -        if vslot:
    1.18 -            return vslot
    1.19 -    raise PciDeviceVslotMissing("%s" % dev)
    1.20 -
    1.21  def find_sysfs_mnt():
    1.22      try:
    1.23          return utils.find_sysfs_mount()
    1.24 @@ -379,7 +365,7 @@ class PciDeviceVslotMissing(Exception):
    1.25      def __init__(self,msg):
    1.26          self.message = msg
    1.27      def __str__(self):
    1.28 -        return 'pci: no vslot or requested_vslot: ' + self.message
    1.29 +        return 'pci: no vslot: ' + self.message
    1.30  
    1.31  class PciDevice:
    1.32      def __init__(self, domain, bus, slot, func):
     2.1 --- a/tools/python/xen/xend/XendConfig.py	Wed Jun 03 11:17:00 2009 +0100
     2.2 +++ b/tools/python/xen/xend/XendConfig.py	Wed Jun 03 11:19:51 2009 +0100
     2.3 @@ -36,7 +36,6 @@ from xen.xend.xenstore.xstransact import
     2.4  from xen.xend.server.BlktapController import blktap_disk_types
     2.5  from xen.xend.server.netif import randomMAC
     2.6  from xen.util.blkif import blkdev_name_to_number, blkdev_uname_to_file
     2.7 -from xen.util.pci import assigned_or_requested_vslot
     2.8  from xen.util import xsconstants
     2.9  import xen.util.auxbin
    2.10  
    2.11 @@ -1288,7 +1287,7 @@ class XendConfig(dict):
    2.12                      dpci_record = {
    2.13                          'VM': self['uuid'],
    2.14                          'PPCI': ppci_uuid,
    2.15 -                        'hotplug_slot': pci_dev.get('requested_vslot', 0)
    2.16 +                        'hotplug_slot': pci_dev.get('vslot', 0)
    2.17                      }
    2.18  
    2.19                      dpci_opts = pci_dev.get('opts')
    2.20 @@ -1858,7 +1857,7 @@ class XendConfig(dict):
    2.21                      dpci_record = {
    2.22                          'VM': self['uuid'],
    2.23                          'PPCI': ppci_uuid,
    2.24 -                        'hotplug_slot': pci_dev.get('requested_vslot', 0)
    2.25 +                        'hotplug_slot': pci_dev.get('vslot', 0)
    2.26                      }
    2.27  
    2.28                      dpci_opts = pci_dev.get('opts')
    2.29 @@ -2131,7 +2130,7 @@ class XendConfig(dict):
    2.30                  bus = sxp.child_value(dev, 'bus')
    2.31                  slot = sxp.child_value(dev, 'slot')
    2.32                  func = sxp.child_value(dev, 'func')
    2.33 -                vslot = assigned_or_requested_vslot(dev) 
    2.34 +                vslot = sxp.child_value(dev, 'vslot')
    2.35                  opts = ''
    2.36                  for opt in sxp.child_value(dev, 'opts', []):
    2.37                      if opts:
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Jun 03 11:17:00 2009 +0100
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Jun 03 11:19:51 2009 +0100
     3.3 @@ -39,7 +39,7 @@ from xen.util import asserts, auxbin
     3.4  from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
     3.5  import xen.util.xsm.xsm as security
     3.6  from xen.util import xsconstants
     3.7 -from xen.util.pci import assigned_or_requested_vslot, serialise_pci_opts
     3.8 +from xen.util.pci import serialise_pci_opts
     3.9  
    3.10  from xen.xend import balloon, sxp, uuid, image, arch
    3.11  from xen.xend import XendOptions, XendNode, XendConfig
    3.12 @@ -641,10 +641,9 @@ class XendDomainInfo:
    3.13              pci_conf = self.info['devices'][dev_uuid][1]
    3.14              pci_devs = pci_conf['devs']
    3.15              for x in pci_devs:
    3.16 -                x_vslot = assigned_or_requested_vslot(x)
    3.17 -                if (int(x_vslot, 16) == int(new_dev['requested_vslot'], 16) and
    3.18 -                   int(x_vslot, 16) != AUTO_PHP_SLOT):
    3.19 -                    raise VmError("vslot %s already have a device." % (new_dev['requested_vslot']))
    3.20 +                if (int(x['vslot'], 16) == int(new_dev['vslot'], 16) and
    3.21 +                   int(x['vslot'], 16) != AUTO_PHP_SLOT):
    3.22 +                    raise VmError("vslot %s already have a device." % (new_dev['vslot']))
    3.23  
    3.24                  if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
    3.25                     int(x['bus'], 16)    == int(new_dev['bus'], 16) and
    3.26 @@ -747,17 +746,14 @@ class XendDomainInfo:
    3.27                  new_dev['bus'],
    3.28                  new_dev['slot'],
    3.29                  new_dev['func'],
    3.30 -                # vslot will be used when activating a
    3.31 -                # previously activated domain.
    3.32 -                # Otherwise requested_vslot will be used.
    3.33 -                assigned_or_requested_vslot(new_dev),
    3.34 +                new_dev['vslot'],
    3.35                  opts)
    3.36              self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
    3.37  
    3.38              vslot = xstransact.Read("/local/domain/0/device-model/%i/parameter"
    3.39                                      % self.getDomid())
    3.40          else:
    3.41 -            vslot = new_dev['requested_vslot']
    3.42 +            vslot = new_dev['vslot']
    3.43  
    3.44          return vslot
    3.45  
    3.46 @@ -859,7 +855,7 @@ class XendDomainInfo:
    3.47                           int(x['bus'], 16) == int(dev['bus'], 16) and
    3.48                           int(x['slot'], 16) == int(dev['slot'], 16) and
    3.49                           int(x['func'], 16) == int(dev['func'], 16) ):
    3.50 -                        vslot = assigned_or_requested_vslot(x)
    3.51 +                        vslot = x['vslot']
    3.52                          break
    3.53                  if vslot == "":
    3.54                      raise VmError("Device %04x:%02x:%02x.%01x is not connected"
    3.55 @@ -1138,8 +1134,7 @@ class XendDomainInfo:
    3.56          #find the pass-through device with the virtual slot
    3.57          devnum = 0
    3.58          for x in pci_conf['devs']:
    3.59 -            x_vslot = assigned_or_requested_vslot(x)
    3.60 -            if int(x_vslot, 16) == vslot:
    3.61 +            if int(x['vslot'], 16) == vslot:
    3.62                  break
    3.63              devnum += 1
    3.64  
     4.1 --- a/tools/python/xen/xend/server/pciif.py	Wed Jun 03 11:17:00 2009 +0100
     4.2 +++ b/tools/python/xen/xend/server/pciif.py	Wed Jun 03 11:19:51 2009 +0100
     4.3 @@ -74,7 +74,7 @@ class PciController(DevController):
     4.4              bus = parse_hex(pci_config.get('bus', 0))
     4.5              slot = parse_hex(pci_config.get('slot', 0))
     4.6              func = parse_hex(pci_config.get('func', 0))            
     4.7 -            vslot = parse_hex(assigned_or_requested_vslot(pci_config))
     4.8 +            vslot = parse_hex(pci_config.get('vslot', 0))
     4.9  
    4.10              if pci_config.has_key('opts'):
    4.11                  opts = serialise_pci_opts(pci_config['opts'])
     5.1 --- a/tools/python/xen/xm/create.py	Wed Jun 03 11:17:00 2009 +0100
     5.2 +++ b/tools/python/xen/xm/create.py	Wed Jun 03 11:19:51 2009 +0100
     5.3 @@ -716,7 +716,7 @@ def configure_pci(config_devs, vals):
     5.4  
     5.5          config_pci_bdf = ['dev', ['domain', domain], ['bus', bus], \
     5.6                            ['slot', slot], ['func', func],
     5.7 -                          ['requested_vslot', vslot]]
     5.8 +                          ['vslot', vslot]]
     5.9          map(f, d.keys())
    5.10          if len(config_pci_opts)>0:
    5.11              config_pci_bdf.append(['opts', config_pci_opts])
     6.1 --- a/tools/python/xen/xm/main.py	Wed Jun 03 11:17:00 2009 +0100
     6.2 +++ b/tools/python/xen/xm/main.py	Wed Jun 03 11:19:51 2009 +0100
     6.3 @@ -2198,7 +2198,7 @@ def xm_pci_list(args):
     6.4                  "bus":      int(x["bus"], 16),
     6.5                  "slot":     int(x["slot"], 16),
     6.6                  "func":     int(x["func"], 16),
     6.7 -                "vslot":    int(assigned_or_requested_vslot(x), 16)
     6.8 +                "vslot":    int(x["vslot"], 16)
     6.9              }
    6.10              devs.append(dev)
    6.11  
    6.12 @@ -2500,7 +2500,7 @@ def parse_pci_configuration(args, state,
    6.13                  ['bus', '0x'+ pci_dev_info['bus']],
    6.14                  ['slot', '0x'+ pci_dev_info['slot']],
    6.15                  ['func', '0x'+ pci_dev_info['func']],
    6.16 -                ['requested_vslot', '0x%x' % int(vslot, 16)]]
    6.17 +                ['vslot', '0x%x' % int(vslot, 16)]]
    6.18          if len(opts) > 0:
    6.19              pci_bdf.append(['opts', opts])
    6.20          pci.append(pci_bdf)