ia64/xen-unstable

changeset 19246:f8916c9bc149

xend: Don't forget backend domain definitions for pvSCSI

Backend domain definitions for pvSCSI are forgotten.
This patch correctly handles them.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 10:22:23 2009 +0000 (2009-03-02)
parents e5c696aaf2a6
children d0df93e627bc
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Sun Mar 01 14:58:07 2009 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Mon Mar 02 10:22:23 2009 +0000
     1.3 @@ -1275,6 +1275,7 @@ class XendConfig(dict):
     1.4                  vscsi_dict = self.vscsi_convert_sxp_to_dict(config)
     1.5                  vscsi_devs = vscsi_dict['devs']
     1.6                  vscsi_mode = vscsi_dict['feature-host']
     1.7 +                vscsi_be = vscsi_dict.get('backend', None)
     1.8  
     1.9                  # create XenAPI DSCSI objects.
    1.10                  for vscsi_dev in vscsi_devs:
    1.11 @@ -1294,6 +1295,8 @@ class XendConfig(dict):
    1.12                      'feature-host': vscsi_mode,
    1.13                      'uuid': vscsi_devs_uuid
    1.14                  }
    1.15 +                if vscsi_be is not None:
    1.16 +                    vscsi_info['backend'] = vscsi_be
    1.17                  target['devices'][vscsi_devs_uuid] = (dev_type, vscsi_info)
    1.18                  log.debug("XendConfig: reading device: %s,%s" % \
    1.19                            (vscsi_devs, vscsi_mode))
    1.20 @@ -1621,6 +1624,7 @@ class XendConfig(dict):
    1.21          # [device,
    1.22          #   [vscsi,
    1.23          #     [feature-host, 0],
    1.24 +        #     [backend, 0],
    1.25          #     [dev,
    1.26          #       [devid, 0], [p-devname, sdb], [p-dev, 1:0:0:1],
    1.27          #       [v-dev, 0:0:0:0], [state, 1]
    1.28 @@ -1632,6 +1636,7 @@ class XendConfig(dict):
    1.29          #   ],
    1.30          #   [vscsi,
    1.31          #     [feature-host, 1],
    1.32 +        #     [backend, 0],
    1.33          #     [dev,
    1.34          #       [devid, 1], [p-devname, sdg], [p-dev, 2:0:0:0],
    1.35          #       [v-dev, 1:0:0:0], [state, 1]
    1.36 @@ -1653,6 +1658,7 @@ class XendConfig(dict):
    1.37          # [device,
    1.38          #   [vscsi,
    1.39          #     [feature-host, 0],
    1.40 +        #     [backend, 0],
    1.41          #     [dev,
    1.42          #       [devid, 0], [p-devname, sdd], [p-dev, 1:0:0:3],
    1.43          #       [v-dev, 0:0:0:2], [state, 1]
    1.44 @@ -1668,7 +1674,7 @@ class XendConfig(dict):
    1.45          #
    1.46          # { devs: [ {devid: 0, p-devname: sdd, p-dev: 1:0:0:3,
    1.47          #            v-dev: 0:0:0:2, state: 1} ],
    1.48 -        #   feature-host: 1 }
    1.49 +        #   feature-host: 1 , backend: 0 }
    1.50  
    1.51          dev_config = {}
    1.52  
    1.53 @@ -1689,6 +1695,11 @@ class XendConfig(dict):
    1.54  
    1.55          vscsi_mode = sxp.children(dev_sxp, 'feature-host')[0]
    1.56          dev_config['feature-host'] = vscsi_mode[1]
    1.57 +        try:
    1.58 +            vscsi_be = sxp.children(dev_sxp, 'backend')[0]
    1.59 +            dev_config['backend'] = vscsi_be[1]
    1.60 +        except IndexError:
    1.61 +            pass
    1.62  
    1.63          return dev_config
    1.64  
    1.65 @@ -1803,6 +1814,7 @@ class XendConfig(dict):
    1.66                  vscsi_dict = self.vscsi_convert_sxp_to_dict(config)
    1.67                  vscsi_devs = vscsi_dict['devs']
    1.68                  vscsi_mode = vscsi_dict['feature-host']
    1.69 +                vscsi_be = vscsi_dict.get('backend', None)
    1.70  
    1.71                  # destroy existing XenAPI DSCSI objects
    1.72                  for dscsi_uuid in XendDSCSI.get_by_VM(self['uuid']):
    1.73 @@ -1826,6 +1838,8 @@ class XendConfig(dict):
    1.74                      'feature-host': vscsi_mode,
    1.75                      'uuid': dev_uuid
    1.76                  }
    1.77 +                if vscsi_be is not None:
    1.78 +                    vscsi_info['backend'] = vscsi_be
    1.79                  self['devices'][dev_uuid] = (dev_type, vscsi_info)
    1.80                  return True
    1.81                  
    1.82 @@ -1919,6 +1933,8 @@ class XendConfig(dict):
    1.83                  elif dev_type == 'vscsi':
    1.84                      sxpr = ['vscsi', ['uuid', dev_info['uuid']],
    1.85                                       ['feature-host', dev_info['feature-host']]]
    1.86 +                    if dev_info.has_key('backend'):
    1.87 +                        sxpr.append(['backend', dev_info['backend']])
    1.88                  for pci_dev_info in dev_info['devs']:
    1.89                      pci_dev_sxpr = ['dev']
    1.90                      for opt, val in pci_dev_info.items():
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sun Mar 01 14:58:07 2009 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 02 10:22:23 2009 +0000
     2.3 @@ -900,6 +900,11 @@ class XendDomainInfo:
     2.4              new_dev_sxp = ['vscsi']
     2.5              cur_mode = sxp.children(cur_dev_sxp, 'feature-host')[0]
     2.6              new_dev_sxp.append(cur_mode)
     2.7 +            try:
     2.8 +                cur_be = sxp.children(cur_dev_sxp, 'backend')[0]
     2.9 +                new_dev_sxp.append(cur_be)
    2.10 +            except IndexError:
    2.11 +                pass
    2.12  
    2.13              for cur_dev in sxp.children(cur_dev_sxp, 'dev'):
    2.14                  if state == xenbusState['Closing']: