Skip to contentSkip to conversation

Fix vscsi assignment when XenAPI is available

PATCH New Masaki Kanno 1 participant 1 message Mar 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix vscsi assignment when XenAPI is available

Hi,

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.

This patch solves the problems. Nonetheless, we cannot use SCSI devices assignment by HBA yet even if the patch is applied. In the near future, I'm going to send a patchset for SCSI devices assignment by HBA of XenAPI. However, the patchset may be too late for Xen3.4. So, for now, I send the patch solving only the problems.

Best regards,
Kan

tools/python/xen/xend/XendConfig.py +4 -1
diff -r 0e1449d6f231 tools/python/xen/xend/XendConfig.py
@@ -1848,8 +1848,11 @@ class XendConfig(dict):
                 vscsi_be = vscsi_dict.get('backend', None)
 
                 # destroy existing XenAPI DSCSI objects
+                vscsi_devid = int(dev_info['devs'][0]['devid'])
                 for dscsi_uuid in XendDSCSI.get_by_VM(self['uuid']):
-                    XendAPIStore.deregister(dscsi_uuid, "DSCSI")
+                    dscsi_inst = XendAPIStore.get(dscsi_uuid, 'DSCSI')
+                    if vscsi_devid == dscsi_inst.get_virtual_host():
+                        XendAPIStore.deregister(dscsi_uuid, "DSCSI")
 
                 # create XenAPI DSCSI objects.
                 for vscsi_dev in vscsi_devs:
tools/python/xen/xend/XendDomainInfo.py +5 -4
diff -r 0e1449d6f231 tools/python/xen/xend/XendDomainInfo.py
@@ -3702,7 +3702,8 @@ class XendDomainInfo:
                     ['v-dev', xenapi_dscsi.get('virtual_HCTL')],
                     ['state', xenbusState['Initialising']],
                     ['uuid', dscsi_uuid]
-                ]
+                ],
+                ['feature-host', 0]
             ]
 
         if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
@@ -3715,7 +3716,7 @@ class XendDomainInfo:
                     raise XendError('Failed to create device')
 
             else:
-                new_vscsi_sxp = ['vscsi']
+                new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
                 for existing_dev in sxp.children(cur_vscsi_sxp, 'dev'):
                     new_vscsi_sxp.append(existing_dev)
                 new_vscsi_sxp.append(sxp.child0(target_vscsi_sxp, 'dev'))
@@ -3809,7 +3810,7 @@ class XendDomainInfo:
         dev_uuid = sxp.child_value(cur_vscsi_sxp, 'uuid')
 
         target_dev = None
-        new_vscsi_sxp = ['vscsi']
+        new_vscsi_sxp = ['vscsi', ['feature-host', 0]]
         for dev in sxp.children(cur_vscsi_sxp, 'dev'):
             if vHCTL == sxp.child_value(dev, 'v-dev'):
                 target_dev = dev
@@ -3820,7 +3821,7 @@ class XendDomainInfo:
             raise XendError('Failed to destroy device')
 
         target_dev.append(['state', xenbusState['Closing']])
-        target_vscsi_sxp = ['vscsi', target_dev]
+        target_vscsi_sxp = ['vscsi', target_dev, ['feature-host', 0]]
 
         if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
 
tools/python/xen/xm/create.py +3 -0
diff -r 0e1449d6f231 tools/python/xen/xm/create.py
@@ -738,6 +738,9 @@ def configure_vscsis(config_devs, vals):
 
         feature_host = 0
         if v_dev == 'host':
+            if serverType == SERVER_XEN_API:
+                # TODO
+                raise ValueError("SCSI devices assignment by HBA is not implemeted")
             feature_host = 1
             scsi_info = []
             devid = get_devid(p_hctl)
tools/python/xen/xm/main.py +3 -0
diff -r 0e1449d6f231 tools/python/xen/xm/main.py
@@ -2539,6 +2539,9 @@ def parse_scsi_configuration(p_scsi, v_h
     if p_scsi is not None:
         # xm scsi-attach
         if v_hctl == "host":
+            if serverType == SERVER_XEN_API:
+                # TODO
+                raise OptionError("SCSI devices assignment by HBA is not implemeted")
             host_mode = 1
             scsi_devices = vscsi_util.vscsi_get_scsidevices()
         elif len(v_hctl.split(':')) != 4:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel