ia64/xen-unstable

changeset 19383:6e619d8eece5

xend: Fix vscsi assignment when XenAPI is available

When XenAPI is available, xm scsi-attach fails. Also xm new and
xm create fail if a vscsi parameter is defined into domain
configuration files.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 18 11:34:20 2009 +0000 (2009-03-18)
parents f8201aea88a4
children 33270c9a3d2f
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Wed Mar 18 11:32:46 2009 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Wed Mar 18 11:34:20 2009 +0000
     1.3 @@ -1848,8 +1848,11 @@ class XendConfig(dict):
     1.4                  vscsi_be = vscsi_dict.get('backend', None)
     1.5  
     1.6                  # destroy existing XenAPI DSCSI objects
     1.7 +                vscsi_devid = int(dev_info['devs'][0]['devid'])
     1.8                  for dscsi_uuid in XendDSCSI.get_by_VM(self['uuid']):
     1.9 -                    XendAPIStore.deregister(dscsi_uuid, "DSCSI")
    1.10 +                    dscsi_inst = XendAPIStore.get(dscsi_uuid, 'DSCSI')
    1.11 +                    if vscsi_devid == dscsi_inst.get_virtual_host():
    1.12 +                        XendAPIStore.deregister(dscsi_uuid, "DSCSI")
    1.13  
    1.14                  # create XenAPI DSCSI objects.
    1.15                  for vscsi_dev in vscsi_devs:
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Mar 18 11:32:46 2009 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Mar 18 11:34:20 2009 +0000
     2.3 @@ -3703,7 +3703,8 @@ class XendDomainInfo:
     2.4                      ['v-dev', xenapi_dscsi.get('virtual_HCTL')],
     2.5                      ['state', xenbusState['Initialising']],
     2.6                      ['uuid', dscsi_uuid]
     2.7 -                ]
     2.8 +                ],
     2.9 +                ['feature-host', 0]
    2.10              ]
    2.11  
    2.12          if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
    2.13 @@ -3716,7 +3717,7 @@ class XendDomainInfo:
    2.14                      raise XendError('Failed to create device')
    2.15  
    2.16              else:
    2.17 -                new_vscsi_sxp = ['vscsi']
    2.18 +                new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
    2.19                  for existing_dev in sxp.children(cur_vscsi_sxp, 'dev'):
    2.20                      new_vscsi_sxp.append(existing_dev)
    2.21                  new_vscsi_sxp.append(sxp.child0(target_vscsi_sxp, 'dev'))
    2.22 @@ -3810,7 +3811,7 @@ class XendDomainInfo:
    2.23          dev_uuid = sxp.child_value(cur_vscsi_sxp, 'uuid')
    2.24  
    2.25          target_dev = None
    2.26 -        new_vscsi_sxp = ['vscsi']
    2.27 +        new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
    2.28          for dev in sxp.children(cur_vscsi_sxp, 'dev'):
    2.29              if vHCTL == sxp.child_value(dev, 'v-dev'):
    2.30                  target_dev = dev
    2.31 @@ -3821,7 +3822,7 @@ class XendDomainInfo:
    2.32              raise XendError('Failed to destroy device')
    2.33  
    2.34          target_dev.append(['state', xenbusState['Closing']])
    2.35 -        target_vscsi_sxp = ['vscsi', target_dev]
    2.36 +        target_vscsi_sxp = ['vscsi', target_dev, ['feature-host', 0]]
    2.37  
    2.38          if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
    2.39  
     3.1 --- a/tools/python/xen/xm/create.py	Wed Mar 18 11:32:46 2009 +0000
     3.2 +++ b/tools/python/xen/xm/create.py	Wed Mar 18 11:34:20 2009 +0000
     3.3 @@ -738,6 +738,9 @@ def configure_vscsis(config_devs, vals):
     3.4  
     3.5          feature_host = 0
     3.6          if v_dev == 'host':
     3.7 +            if serverType == SERVER_XEN_API:
     3.8 +                # TODO
     3.9 +                raise ValueError("SCSI devices assignment by HBA is not implemeted")
    3.10              feature_host = 1
    3.11              scsi_info = []
    3.12              devid = get_devid(p_hctl)
     4.1 --- a/tools/python/xen/xm/main.py	Wed Mar 18 11:32:46 2009 +0000
     4.2 +++ b/tools/python/xen/xm/main.py	Wed Mar 18 11:34:20 2009 +0000
     4.3 @@ -2539,6 +2539,9 @@ def parse_scsi_configuration(p_scsi, v_h
     4.4      if p_scsi is not None:
     4.5          # xm scsi-attach
     4.6          if v_hctl == "host":
     4.7 +            if serverType == SERVER_XEN_API:
     4.8 +                # TODO
     4.9 +                raise OptionError("SCSI devices assignment by HBA is not implemeted")
    4.10              host_mode = 1
    4.11              scsi_devices = vscsi_util.vscsi_get_scsidevices()
    4.12          elif len(v_hctl.split(':')) != 4: