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

[Xen-changelog] [xen-unstable] pvSCSI: fix xend



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1215505730 -3600
# Node ID bd97e45e073aa57fa5d472e125b60b628f78517f
# Parent  f14dbf6a4118dbcd8351538ef046f264c2fd394f
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@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |   64 ++++++++++++++++----------------
 tools/python/xen/xend/XendDomainInfo.py |    2 -
 tools/python/xen/xend/server/vscsiif.py |    4 ++
 3 files changed, 38 insertions(+), 32 deletions(-)

diff -r f14dbf6a4118 -r bd97e45e073a tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Tue Jul 08 09:26:58 2008 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Tue Jul 08 09:28:50 2008 +0100
@@ -1223,22 +1223,23 @@ class XendConfig(dict):
                 pci_dict = self.pci_convert_sxp_to_dict(config)
                 pci_devs = pci_dict['devs']
 
-                # create XenAPI DPCI objects.
-                for pci_dev in pci_devs:
-                    dpci_uuid = pci_dev.get('uuid')
-                    ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
-                                                    pci_dev['bus'],
-                                                    pci_dev['slot'],
-                                                    pci_dev['func'])
-                    if ppci_uuid is None:
-                        continue
-                    dpci_record = {
-                        'VM': self['uuid'],
-                        'PPCI': ppci_uuid,
-                        'hotplug_slot': pci_dev.get('vslot', 0)
-                    }
-                    XendDPCI(dpci_uuid, dpci_record)
-                    
+                if dev_type != 'vscsi':
+                    # create XenAPI DPCI objects.
+                    for pci_dev in pci_devs:
+                        dpci_uuid = pci_dev.get('uuid')
+                        ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
+                                                        pci_dev['bus'],
+                                                        pci_dev['slot'],
+                                                        pci_dev['func'])
+                        if ppci_uuid is None:
+                            continue
+                        dpci_record = {
+                            'VM': self['uuid'],
+                            'PPCI': ppci_uuid,
+                            'hotplug_slot': pci_dev.get('vslot', 0)
+                        }
+                        XendDPCI(dpci_uuid, dpci_record)
+
                 target['devices'][pci_devs_uuid] = (dev_type,
                                                     {'devs': pci_devs,
                                                      'uuid': pci_devs_uuid})
@@ -1633,21 +1634,22 @@ class XendConfig(dict):
                 for dpci_uuid in XendDPCI.get_by_VM(self['uuid']):
                     XendAPIStore.deregister(dpci_uuid, "DPCI")
 
-                # create XenAPI DPCI objects.
-                for pci_dev in pci_devs:
-                    dpci_uuid = pci_dev.get('uuid')
-                    ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
-                                                     pci_dev['bus'],
-                                                     pci_dev['slot'],
-                                                     pci_dev['func'])
-                    if ppci_uuid is None:
-                        continue
-                    dpci_record = {
-                        'VM': self['uuid'],
-                        'PPCI': ppci_uuid,
-                        'hotplug_slot': pci_dev.get('vslot', 0)
-                    }
-                    XendDPCI(dpci_uuid, dpci_record)
+                if dev_type != 'vscsi':
+                    # create XenAPI DPCI objects.
+                    for pci_dev in pci_devs:
+                        dpci_uuid = pci_dev.get('uuid')
+                        ppci_uuid = XendPPCI.get_by_sbdf(pci_dev['domain'],
+                                                         pci_dev['bus'],
+                                                         pci_dev['slot'],
+                                                         pci_dev['func'])
+                        if ppci_uuid is None:
+                            continue
+                        dpci_record = {
+                            'VM': self['uuid'],
+                            'PPCI': ppci_uuid,
+                            'hotplug_slot': pci_dev.get('vslot', 0)
+                        }
+                        XendDPCI(dpci_uuid, dpci_record)
 
                 self['devices'][dev_uuid] = (dev_type,
                                              {'devs': pci_devs,
diff -r f14dbf6a4118 -r bd97e45e073a tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Jul 08 09:26:58 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Jul 08 09:28:50 2008 +0100
@@ -758,7 +758,7 @@ class XendDomainInfo:
         if dev_class != 'vscsi':
             return False
 
-        dev_config = self.pci_convert_sxp_to_dict(dev_sxp)
+        dev_config = self.info.pci_convert_sxp_to_dict(dev_sxp)
         dev = dev_config['devs'][0]
         req_devid = sxp.child_value(dev_sxp, 'devid')
         req_devid = int(req_devid)
diff -r f14dbf6a4118 -r bd97e45e073a tools/python/xen/xend/server/vscsiif.py
--- a/tools/python/xen/xend/server/vscsiif.py   Tue Jul 08 09:26:58 2008 +0100
+++ b/tools/python/xen/xend/server/vscsiif.py   Tue Jul 08 09:28:50 2008 +0100
@@ -169,6 +169,10 @@ class VSCSIController(DevController):
         devid = int(devid)
         vscsi_config = config['devs'][0]
         states = config.get('states', [])
+        driver_state = self.readBackend(devid, 'state')
+        if str(xenbusState['Connected']) != driver_state:
+            raise VmError("Driver status is not connected")
+
         uuid = self.readBackend(devid, 'uuid')
         if states[0] == 'Initialising':
             back['uuid'] = uuid

_______________________________________________
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®.