[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: Fix vscsi assignment when XenAPI is available



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1237376060 0
# Node ID 6e619d8eece54ff3548a933bfe6cbc06d4559ef5
# Parent  f8201aea88a43ccf52ed6b201e5a31fc97468e35
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@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |    5 ++++-
 tools/python/xen/xend/XendDomainInfo.py |    9 +++++----
 tools/python/xen/xm/create.py           |    3 +++
 tools/python/xen/xm/main.py             |    3 +++
 4 files changed, 15 insertions(+), 5 deletions(-)

diff -r f8201aea88a4 -r 6e619d8eece5 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Mar 18 11:32:46 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Wed Mar 18 11:34:20 2009 +0000
@@ -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:
diff -r f8201aea88a4 -r 6e619d8eece5 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Mar 18 11:32:46 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Mar 18 11:34:20 2009 +0000
@@ -3703,7 +3703,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:
@@ -3716,7 +3717,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'))
@@ -3810,7 +3811,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
@@ -3821,7 +3822,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:
 
diff -r f8201aea88a4 -r 6e619d8eece5 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Mar 18 11:32:46 2009 +0000
+++ b/tools/python/xen/xm/create.py     Wed Mar 18 11:34:20 2009 +0000
@@ -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)
diff -r f8201aea88a4 -r 6e619d8eece5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Mar 18 11:32:46 2009 +0000
+++ b/tools/python/xen/xm/main.py       Wed Mar 18 11:34:20 2009 +0000
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.