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] Refactoring device controllers to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Refactoring device controllers to its own module so it can be used by both XendConfig and XendDomainInfo.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:08:25 +0000
Delivery-date: Thu, 02 Nov 2006 21:41:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID ea65d8be211f8531db307c14f6f63dddd052280e
# Parent  59f3891b94b88da40c885ffd2d21232acbc3f598
[XEND] Refactoring device controllers to its own module so it can be used by 
both XendConfig and XendDomainInfo.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDevices.py |   68 +++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+)

diff -r 59f3891b94b8 -r ea65d8be211f tools/python/xen/xend/XendDevices.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/XendDevices.py      Thu Oct 05 17:29:19 2006 +0100
@@ -0,0 +1,68 @@
+#===========================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#============================================================================
+# Copyright (C) 2006 XenSource Ltd
+#============================================================================
+
+#
+# A collection of DevControllers 
+#
+
+from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, usbif
+from xen.xend.server.BlktapController import BlktapController
+
+class XendDevices:
+    """ An ugly halfway point between the module local device name
+    to class map we used to have in XendDomainInfo and something
+    slightly more managable.
+
+    This class should contain all the functions that have to do
+    with managing devices in Xend. Right now it is only a factory
+    function.
+    """
+
+    controllers = {
+        'vbd': blkif.BlkifController,
+        'vif': netif.NetifController,
+        'vtpm': tpmif.TPMifController,
+        'pci': pciif.PciController,
+        'ioports': iopif.IOPortsController,
+        'irq': irqif.IRQController,
+        'usb': usbif.UsbifController,
+        'tap': BlktapController,
+    }
+
+    #@classmethod
+    def valid_devices(cls):
+        return cls.controllers.keys()
+    valid_devices = classmethod(valid_devices)
+
+    #@classmethod
+    def make_controller(cls, name, domain):
+        """Factory function to make device controllers per domain.
+
+        @param name: device class name in L{VALID_DEVICES}
+        @type name: String
+        @param domain: domain this controller is handling devices for.
+        @type domain: XendDomainInfo
+        @return: DevController of class 'name' or None
+        @rtype: subclass of DevController
+        """
+        if name in cls.controllers.keys():
+            cls.controllers[name].deviceClass = name
+            return cls.controllers[name](domain)
+        return None
+
+    make_controller = classmethod(make_controller)
+

_______________________________________________
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] Refactoring device controllers to its own module so it can be used by both XendConfig and XendDomainInfo., Xen patchbot-unstable <=