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] pci: add pci option support for XenAPI se

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] pci: add pci option support for XenAPI sever
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Jan 2009 02:50:14 -0800
Delivery-date: Fri, 16 Jan 2009 02:50:19 -0800
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 1231413976 0
# Node ID 989bd3f2fd72b285310747543a97acd89654db8a
# Parent  13c8e6bac9ab4d6449bf40b558fb9354d3090d65
pci: add pci option support for XenAPI sever

Allow the per-device options for passthrough pci devices
This patch is for XenAPI server

A new key-value pair element of 'pci' named 'pci_opt' is added
to xml config file

Signed-off-by: Qing He <qing.he@xxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |   10 ++++++++++
 tools/python/xen/xend/XendDPCI.py       |    7 ++++++-
 tools/python/xen/xend/XendDomainInfo.py |    6 ++++++
 tools/python/xen/xm/create.dtd          |    7 ++++++-
 tools/python/xen/xm/main.py             |    3 ++-
 tools/python/xen/xm/xenapi_create.py    |   11 ++++++++++-
 6 files changed, 40 insertions(+), 4 deletions(-)

diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Jan 08 11:26:16 2009 +0000
@@ -1247,6 +1247,11 @@ class XendConfig(dict):
                         '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)
 
                 target['devices'][pci_devs_uuid] = (dev_type,
@@ -1762,6 +1767,11 @@ class XendConfig(dict):
                         '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['devices'][dev_uuid] = (dev_type,
diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xend/XendDPCI.py
--- a/tools/python/xen/xend/XendDPCI.py Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xend/XendDPCI.py Thu Jan 08 11:26:16 2009 +0000
@@ -41,7 +41,8 @@ class XendDPCI(XendBase):
                   'virtual_name',
                   'VM',
                   'PPCI',
-                  'hotplug_slot']
+                  'hotplug_slot',
+                  'options']
         return XendBase.getAttrRO() + attrRO
 
     def getAttrRW(self):
@@ -119,6 +120,8 @@ class XendDPCI(XendBase):
         self.VM = record['VM']
         self.PPCI = record['PPCI']
         self.hotplug_slot = record['hotplug_slot']
+        if 'options' in record.keys():
+            self.options = record['options']
 
     def destroy(self):
         xendom = XendDomain.instance()
@@ -152,3 +155,5 @@ class XendDPCI(XendBase):
     def get_hotplug_slot(self):
         return self.hotplug_slot
 
+    def get_options(self):
+        return self.options
diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Jan 08 11:26:16 2009 +0000
@@ -3538,6 +3538,11 @@ class XendDomainInfo:
 
         dpci_uuid = uuid.createString()
 
+        dpci_opts = []
+        opts_dict = xenapi_pci.get('options')
+        for k in opts_dict.keys():
+            dpci_opts.append([k, opts_dict[k]])
+
         # Convert xenapi to sxp
         ppci = XendAPIStore.get(xenapi_pci.get('PPCI'), 'PPCI')
 
@@ -3549,6 +3554,7 @@ class XendDomainInfo:
                     ['slot', '0x%02x' % ppci.get_slot()],
                     ['func', '0x%1x' % ppci.get_func()],
                     ['vslt', '0x%02x' % xenapi_pci.get('hotplug_slot')],
+                    ['opts', dpci_opts],
                     ['uuid', dpci_uuid]
                 ],
                 ['state', 'Initialising']
diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xm/create.dtd
--- a/tools/python/xen/xm/create.dtd    Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xm/create.dtd    Thu Jan 08 11:26:16 2009 +0000
@@ -82,11 +82,12 @@
 <!ELEMENT vtpm   (name*)>
 <!ATTLIST vtpm   backend         CDATA #REQUIRED>
 
-<!ELEMENT pci    EMPTY>
+<!ELEMENT pci    (pci_opt*)>
 <!ATTLIST pci    domain          CDATA #REQUIRED
                  bus             CDATA #REQUIRED
                  slot            CDATA #REQUIRED
                  func            CDATA #REQUIRED
+                 opts_str        CDATA #IMPLIED
                  vslt            CDATA #IMPLIED>
 
 <!ELEMENT vscsi  EMPTY>
@@ -138,6 +139,10 @@
 <!ATTLIST vcpu_param key   CDATA #REQUIRED
                      value CDATA #REQUIRED>
 
+<!ELEMENT pci_opt    EMPTY>
+<!ATTLIST pci_opt    key   CDATA #REQUIRED
+                     value CDATA #REQUIRED>
+
 <!ELEMENT other_config EMPTY>
 <!ATTLIST other_config key   CDATA #REQUIRED
                        value CDATA #REQUIRED>
diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xm/main.py       Thu Jan 08 11:26:16 2009 +0000
@@ -2499,7 +2499,8 @@ def xm_pci_attach(args):
         dpci_record = {
             "VM":           get_single_vm(dom),
             "PPCI":         target_ref,
-            "hotplug_slot": vslt
+            "hotplug_slot": vslt,
+            "options":      dict([k, v] for k, v in config_pci_opts)
         }
         server.xenapi.DPCI.create(dpci_record)
 
diff -r 13c8e6bac9ab -r 989bd3f2fd72 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Thu Jan 08 11:25:43 2009 +0000
+++ b/tools/python/xen/xm/xenapi_create.py      Thu Jan 08 11:26:16 2009 +0000
@@ -533,7 +533,10 @@ class xenapi_create:
             "PPCI":
                 target_ref,
             "hotplug_slot":
-                int(pci.attributes["func"].value, 16)
+                int(pci.attributes["func"].value, 16),
+            "options":
+                get_child_nodes_as_dict(pci,
+                  "pci_opt", "key", "value")
         }
 
         return server.xenapi.DPCI.create(dpci_record)
@@ -931,6 +934,12 @@ class sxp2xml:
                     = get_child_by_name(dev_sxp, "func", "0")
                 pci.attributes["vslt"] \
                     = get_child_by_name(dev_sxp, "vslt", "0")
+                for opt in get_child_by_name(dev_sxp, "opts", ""):
+                    if len(opt) > 0:
+                        pci_opt = document.createElement("pci_opt")
+                        pci_opt.attributes["key"] = opt[0]
+                        pci_opt.attributes["value"] = opt[1]
+                        pci.appendChild(pci_opt)
 
                 pcis.append(pci)
 

_______________________________________________
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] pci: add pci option support for XenAPI sever, Xen patchbot-unstable <=