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] Change blkif to use the new style

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Change blkif to use the new style configuration
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:08:28 +0000
Delivery-date: Thu, 02 Nov 2006 21:41:07 -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 16946dcbf14be9b2e12240292300fd2cfb427135
# Parent  9a932b5c7947cb1512e3f3a1fe65a5541e56e425
[XEND] Change blkif to use the new style configuration

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/server/blkif.py |   54 +++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff -r 9a932b5c7947 -r 16946dcbf14b tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     Thu Oct 05 17:29:19 2006 +0100
+++ b/tools/python/xen/xend/server/blkif.py     Thu Oct 05 17:29:19 2006 +0100
@@ -16,7 +16,6 @@
 # Copyright (C) 2005, 2006 XenSource Inc.
 #============================================================================
 
-
 import re
 import string
 
@@ -24,9 +23,7 @@ from xen.util import security
 from xen.util import security
 from xen.xend import sxp
 from xen.xend.XendError import VmError
-
 from xen.xend.server.DevController import DevController
-
 
 class BlkifController(DevController):
     """Block device interface controller. Handles all block devices
@@ -38,12 +35,10 @@ class BlkifController(DevController):
         """
         DevController.__init__(self, vm)
 
-
     def getDeviceDetails(self, config):
         """@see DevController.getDeviceDetails"""
-        uname = sxp.child_value(config, 'uname')
-
-        dev = sxp.child_value(config, 'dev')
+        uname = sxp.child_value(config, 'uname', '')
+        dev = sxp.child_value(config, 'dev', '')
 
         if 'ioemu:' in dev:
             (_, dev) = string.split(dev, ':', 1)
@@ -74,6 +69,10 @@ class BlkifController(DevController):
                  'mode'   : mode
                }
 
+        uuid = sxp.child_value(config, 'uuid')
+        if uuid:
+            back['uuid'] = uuid
+
         if security.on():
             (label, ssidref, policy) = security.get_res_security_details(uname)
             back.update({'acm_label'  : label,
@@ -105,27 +104,30 @@ class BlkifController(DevController):
                           (self.deviceClass, devid, config))
 
 
-    def configuration(self, devid):
-        """@see DevController.configuration"""
+    def getDeviceConfiguration(self, devid):
+        """Returns the configuration of a device.
 
-        result = DevController.configuration(self, devid)
+        @note: Similar to L{configuration} except it returns a dict.
+        @return: dict
+        """
+        config = DevController.getDeviceConfiguration(self, devid)
+        devinfo = self.readBackend(devid, 'dev', 'type', 'params', 'mode',
+                                   'uuid')
+        dev, typ, params, mode, uuid = devinfo
+        
+        if dev:
+            dev_type = self.readFrontend(devid, 'device-type')
+            if dev_type:
+                dev += ':' + dev_type
+            config['dev'] = dev
+        if typ and params:
+            config['uname'] = typ +':' + params
+        if mode:
+            config['mode'] = mode
+        if uuid:
+            config['uuid'] = uuid
 
-        (dev, typ, params, mode) = self.readBackend(devid,
-                                                    'dev', 'type', 'params',
-                                                    'mode')
-
-        if dev:
-            (dev_type) = self.readFrontend(devid, 'device-type')
-            if dev_type:
-                dev += ":" + dev_type
-            result.append(['dev', dev])
-        if typ and params:
-            result.append(['uname', typ + ":" + params])
-        if mode:
-            result.append(['mode', mode])
-
-        return result
-
+        return config
 
     def destroyDevice(self, devid):
         """@see DevController.destroyDevice"""

_______________________________________________
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] Change blkif to use the new style configuration, Xen patchbot-unstable <=