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] xm: xen-api, pass-through: Dont pass empt

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm: xen-api, pass-through: Dont pass empty opts
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 10:25:36 -0700
Delivery-date: Thu, 04 Jun 2009 10:27:59 -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 1244108343 -3600
# Node ID 94f6bf69e8e87d1f18ac9ae72a3f8ea3f6168a48
# Parent  a3125a83e40bd7cc68ec64ca89eb69be287d8e6f
xm: xen-api, pass-through: Dont pass empty opts

Internally xend doesn't know how to handle empty opts.
This code ensures that opts is only included in the sxpr
if its value will be non-empty.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/util/pci.py            |    3 +++
 tools/python/xen/xend/XendDomainInfo.py |   26 ++++++++++++--------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff -r a3125a83e40b -r 94f6bf69e8e8 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Thu Jun 04 10:38:13 2009 +0100
+++ b/tools/python/xen/util/pci.py      Thu Jun 04 10:39:03 2009 +0100
@@ -119,6 +119,9 @@ def serialise_pci_opts(opts):
 
 def split_pci_opts(opts):
     return map(lambda x: x.split('='), opts.split(','))
+
+def pci_opts_list_to_spx(list):
+    ['dev'] + map(lambda x: ['opts', x], list)
 
 def parse_hex(val):
     try:
diff -r a3125a83e40b -r 94f6bf69e8e8 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Jun 04 10:38:13 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Jun 04 10:39:03 2009 +0100
@@ -39,7 +39,7 @@ from xen.util.blkif import blkdev_uname_
 from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
 import xen.util.xsm.xsm as security
 from xen.util import xsconstants
-from xen.util.pci import serialise_pci_opts
+from xen.util.pci import serialise_pci_opts, pci_opts_list_to_spx
 
 from xen.xend import balloon, sxp, uuid, image, arch
 from xen.xend import XendOptions, XendNode, XendConfig
@@ -3771,23 +3771,21 @@ class XendDomainInfo:
         opts_dict = xenapi_pci.get('options')
         for k in opts_dict.keys():
             dpci_opts.append([k, opts_dict[k]])
+        opts_sxp = pci_opts_list_to_spx(dpci_opts)
 
         # Convert xenapi to sxp
         ppci = XendAPIStore.get(xenapi_pci.get('PPCI'), 'PPCI')
 
-        target_pci_sxp = \
-            ['pci', 
-                ['dev',
-                    ['domain', '0x%02x' % ppci.get_domain()],
-                    ['bus', '0x%02x' % ppci.get_bus()],
-                    ['slot', '0x%02x' % ppci.get_slot()],
-                    ['func', '0x%1x' % ppci.get_func()],
-                    ['vslot', '0x%02x' % xenapi_pci.get('hotplug_slot')],
-                    ['opts', dpci_opts],
-                    ['uuid', dpci_uuid]
-                ],
-                ['state', 'Initialising']
-            ]
+        dev_sxp = ['dev',
+                   ['domain', '0x%02x' % ppci.get_domain()],
+                   ['bus', '0x%02x' % ppci.get_bus()],
+                   ['slot', '0x%02x' % ppci.get_slot()],
+                   ['func', '0x%1x' % ppci.get_func()],
+                   ['vslot', '0x%02x' % xenapi_pci.get('hotplug_slot')],
+                   ['uuid', dpci_uuid]]
+        dev_sxp = sxp.merge(dev_sxp, opts_sxp)
+
+        target_pci_sxp = ['pci', dev_sxp, ['state', 'Initialising'] ]
 
         if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING:
 

_______________________________________________
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] xm: xen-api, pass-through: Dont pass empty opts, Xen patchbot-unstable <=