ia64/xen-unstable

changeset 17993:bd97e45e073a

pvSCSI: fix xend

Previous "xend" assumed initial Xenbus state would be "Connected" when
LUN hot-plug starts. However it was not guaranteed in general, and it
may cause some problems.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 08 09:28:50 2008 +0100 (2008-07-08)
parents f14dbf6a4118
children 914a31d2ad08
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/vscsiif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Tue Jul 08 09:26:58 2008 +0100
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Tue Jul 08 09:28:50 2008 +0100
     1.3 @@ -1223,22 +1223,23 @@ class XendConfig(dict):
     1.4                  pci_dict = self.pci_convert_sxp_to_dict(config)
     1.5                  pci_devs = pci_dict['devs']
     1.6  
     1.7 -                # create XenAPI DPCI objects.
     1.8 -                for pci_dev in pci_devs:
     1.9 -                    dpci_uuid = pci_dev.get('uuid')
    1.10 -                    ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
    1.11 -                                                    pci_dev['bus'],
    1.12 -                                                    pci_dev['slot'],
    1.13 -                                                    pci_dev['func'])
    1.14 -                    if ppci_uuid is None:
    1.15 -                        continue
    1.16 -                    dpci_record = {
    1.17 -                        'VM': self['uuid'],
    1.18 -                        'PPCI': ppci_uuid,
    1.19 -                        'hotplug_slot': pci_dev.get('vslot', 0)
    1.20 -                    }
    1.21 -                    XendDPCI(dpci_uuid, dpci_record)
    1.22 -                    
    1.23 +                if dev_type != 'vscsi':
    1.24 +                    # create XenAPI DPCI objects.
    1.25 +                    for pci_dev in pci_devs:
    1.26 +                        dpci_uuid = pci_dev.get('uuid')
    1.27 +                        ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
    1.28 +                                                        pci_dev['bus'],
    1.29 +                                                        pci_dev['slot'],
    1.30 +                                                        pci_dev['func'])
    1.31 +                        if ppci_uuid is None:
    1.32 +                            continue
    1.33 +                        dpci_record = {
    1.34 +                            'VM': self['uuid'],
    1.35 +                            'PPCI': ppci_uuid,
    1.36 +                            'hotplug_slot': pci_dev.get('vslot', 0)
    1.37 +                        }
    1.38 +                        XendDPCI(dpci_uuid, dpci_record)
    1.39 +
    1.40                  target['devices'][pci_devs_uuid] = (dev_type,
    1.41                                                      {'devs': pci_devs,
    1.42                                                       'uuid': pci_devs_uuid})
    1.43 @@ -1633,21 +1634,22 @@ class XendConfig(dict):
    1.44                  for dpci_uuid in XendDPCI.get_by_VM(self['uuid']):
    1.45                      XendAPIStore.deregister(dpci_uuid, "DPCI")
    1.46  
    1.47 -                # create XenAPI DPCI objects.
    1.48 -                for pci_dev in pci_devs:
    1.49 -                    dpci_uuid = pci_dev.get('uuid')
    1.50 -                    ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
    1.51 -                                                     pci_dev['bus'],
    1.52 -                                                     pci_dev['slot'],
    1.53 -                                                     pci_dev['func'])
    1.54 -                    if ppci_uuid is None:
    1.55 -                        continue
    1.56 -                    dpci_record = {
    1.57 -                        'VM': self['uuid'],
    1.58 -                        'PPCI': ppci_uuid,
    1.59 -                        'hotplug_slot': pci_dev.get('vslot', 0)
    1.60 -                    }
    1.61 -                    XendDPCI(dpci_uuid, dpci_record)
    1.62 +                if dev_type != 'vscsi':
    1.63 +                    # create XenAPI DPCI objects.
    1.64 +                    for pci_dev in pci_devs:
    1.65 +                        dpci_uuid = pci_dev.get('uuid')
    1.66 +                        ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
    1.67 +                                                         pci_dev['bus'],
    1.68 +                                                         pci_dev['slot'],
    1.69 +                                                         pci_dev['func'])
    1.70 +                        if ppci_uuid is None:
    1.71 +                            continue
    1.72 +                        dpci_record = {
    1.73 +                            'VM': self['uuid'],
    1.74 +                            'PPCI': ppci_uuid,
    1.75 +                            'hotplug_slot': pci_dev.get('vslot', 0)
    1.76 +                        }
    1.77 +                        XendDPCI(dpci_uuid, dpci_record)
    1.78  
    1.79                  self['devices'][dev_uuid] = (dev_type,
    1.80                                               {'devs': pci_devs,
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Jul 08 09:26:58 2008 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Jul 08 09:28:50 2008 +0100
     2.3 @@ -758,7 +758,7 @@ class XendDomainInfo:
     2.4          if dev_class != 'vscsi':
     2.5              return False
     2.6  
     2.7 -        dev_config = self.pci_convert_sxp_to_dict(dev_sxp)
     2.8 +        dev_config = self.info.pci_convert_sxp_to_dict(dev_sxp)
     2.9          dev = dev_config['devs'][0]
    2.10          req_devid = sxp.child_value(dev_sxp, 'devid')
    2.11          req_devid = int(req_devid)
     3.1 --- a/tools/python/xen/xend/server/vscsiif.py	Tue Jul 08 09:26:58 2008 +0100
     3.2 +++ b/tools/python/xen/xend/server/vscsiif.py	Tue Jul 08 09:28:50 2008 +0100
     3.3 @@ -169,6 +169,10 @@ class VSCSIController(DevController):
     3.4          devid = int(devid)
     3.5          vscsi_config = config['devs'][0]
     3.6          states = config.get('states', [])
     3.7 +        driver_state = self.readBackend(devid, 'state')
     3.8 +        if str(xenbusState['Connected']) != driver_state:
     3.9 +            raise VmError("Driver status is not connected")
    3.10 +
    3.11          uuid = self.readBackend(devid, 'uuid')
    3.12          if states[0] == 'Initialising':
    3.13              back['uuid'] = uuid