WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: xen-api, pass-through: Add create_d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: xen-api, pass-through: Add create_dpci_from_sxp()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 10:25:40 -0700
Delivery-date: Thu, 04 Jun 2009 10:28:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108473 -3600
# Node ID 8f64f43624e8ad3a28069c992274cb3240980f40
# Parent  728eb34bbfcc1520255e71eeadd6dd26fc79ecad
xend: xen-api, pass-through: Add create_dpci_from_sxp()

Move some duplicated code into create_dpci_from_sxp()

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py |   64 ++++++++++++++----------------------
 1 files changed, 25 insertions(+), 39 deletions(-)

diff -r 728eb34bbfcc -r 8f64f43624e8 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Jun 04 10:40:24 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Thu Jun 04 10:41:13 2009 +0100
@@ -1221,7 +1221,29 @@ class XendConfig(dict):
                         raise XendConfigError('The mac "%s" is already 
defined' %
                                               dev_mac)
         return None
-    
+
+    def create_dpci_from_sxp(self, pci_devs):
+        for pci_dev in pci_devs:
+            dpci_uuid = pci_dev.get('uuid')
+            log.debug("create_dpci_from_sxp: %s" % pci_dev)
+            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)
+            }
+
+            dpci_opts = pci_dev.get('opts')
+            if dpci_opts and len(dpci_opts) > 0:
+                dpci_record['options'] = dpci_opts
+
+            XendDPCI(dpci_uuid, dpci_record)
+
     def device_add(self, dev_type, cfg_sxp = None, cfg_xenapi = None,
                    target = None):
         """Add a device configuration in SXP format or XenAPI struct format.
@@ -1276,25 +1298,7 @@ class XendConfig(dict):
                 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)
-                    }
-
-                    dpci_opts = pci_dev.get('opts')
-                    if dpci_opts and len(dpci_opts) > 0:
-                        dpci_record['options'] = dpci_opts
-
-                    XendDPCI(dpci_uuid, dpci_record)
+                self.create_dpci_from_sxp(pci_devs)
 
                 target['devices'][pci_devs_uuid] = (dev_type,
                                                     {'devs': pci_devs,
@@ -1846,25 +1850,7 @@ class XendConfig(dict):
                     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)
-                    }
-
-                    dpci_opts = pci_dev.get('opts')
-                    if dpci_opts and len(dpci_opts) > 0:
-                        dpci_record['options'] = dpci_opts
-
-                    XendDPCI(dpci_uuid, dpci_record)
+                self.create_dpci_from_sxp(pci_devs)
 
                 self['devices'][dev_uuid] = (dev_type,
                                              {'devs': pci_devs,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: xen-api, pass-through: Add create_dpci_from_sxp(), Xen patchbot-unstable <=