ia64/xen-unstable

changeset 19680:401a793c4b42

xend: Fix check for request to detach non-existent device

This fixes the check for a request to detatch a non-existent device
in pci_device_configure. The previous check was bogus because the
format of AUTO_PHP_SLOT_STR is not the same as that of x['vslot'].

However, it works in a slightly non-obvious way, checking that vslot
hasn't been altered from its initial value AUTO_PHP_SLOT_STR. To
make this shceme a little clearer, use an empty string as the inital
value.

Formting issues asside, neither AUTO_PHP_SLOT_STR nor the empty
string are valid values for x['vslot']. In the event
of invalid data (indicating a bug), it should be caught by
self.hvm_destroyPCIDevice.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 29 09:32:40 2009 +0100 (2009-05-29)
parents ec2bc4b9fa32
children f6dab6ff90c8
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri May 29 09:32:02 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri May 29 09:32:40 2009 +0100
     1.3 @@ -854,7 +854,7 @@ class XendDomainInfo:
     1.4                  existing_dev_uuid = sxp.child_value(existing_dev_info, 'uuid')
     1.5                  existing_pci_conf = self.info['devices'][existing_dev_uuid][1]
     1.6                  existing_pci_devs = existing_pci_conf['devs']
     1.7 -                vslot = AUTO_PHP_SLOT_STR
     1.8 +                vslot = ""
     1.9                  for x in existing_pci_devs:
    1.10                      if ( int(x['domain'], 16) == int(dev['domain'], 16) and
    1.11                           int(x['bus'], 16) == int(dev['bus'], 16) and
    1.12 @@ -862,7 +862,7 @@ class XendDomainInfo:
    1.13                           int(x['func'], 16) == int(dev['func'], 16) ):
    1.14                          vslot = assigned_or_requested_vslot(x)
    1.15                          break
    1.16 -                if vslot == AUTO_PHP_SLOT_STR:
    1.17 +                if vslot == "":
    1.18                      raise VmError("Device %04x:%02x:%02x.%01x is not connected"
    1.19                                    % (int(dev['domain'],16), int(dev['bus'],16),
    1.20                                       int(dev['slot'],16), int(dev['func'],16)))