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: Fix device duplicate check.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Fix device duplicate check.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 12:40:14 -0800
Delivery-date: Wed, 19 Dec 2007 12:41:56 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198075862 0
# Node ID e08c4cab65c85e7a3280b111956da21c5299534e
# Parent  ca461349620a59bbc94b788481dfbdcf07610fb7
xend: Fix device duplicate check.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff -r ca461349620a -r e08c4cab65c8 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Dec 19 14:50:37 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Wed Dec 19 14:51:02 2007 +0000
@@ -31,7 +31,7 @@ from xen.xend.xenstore.xstransact import
 from xen.xend.xenstore.xstransact import xstransact
 from xen.xend.server.BlktapController import blktap_disk_types
 from xen.xend.server.netif import randomMAC
-from xen.util.blkif import blkdev_name_to_number
+from xen.util.blkif import blkdev_name_to_number, blkdev_uname_to_file
 from xen.util import xsconstants
 import xen.util.auxbin
 
@@ -981,7 +981,7 @@ class XendConfig(dict):
     def device_duplicate_check(self, dev_type, dev_info, defined_config):
         defined_devices_sxpr = self.all_devices_sxpr(target = defined_config)
         
-        if dev_type == 'vbd':
+        if dev_type == 'vbd' or dev_type == 'tap':
             dev_uname = dev_info.get('uname')
             blkdev_name = dev_info.get('dev')
             devid = self._blkdev_name_to_number(blkdev_name)
@@ -989,10 +989,13 @@ class XendConfig(dict):
                 return
             
             for o_dev_type, o_dev_info in defined_devices_sxpr:
-                if dev_type == o_dev_type:
-                    if dev_uname == sxp.child_value(o_dev_info, 'uname'):
-                        raise XendConfigError('The uname "%s" is already 
defined' %
-                                              dev_uname)
+                if o_dev_type == 'vbd' or o_dev_type == 'tap':
+                    blkdev_file = blkdev_uname_to_file(dev_uname)
+                    o_dev_uname = sxp.child_value(o_dev_info, 'uname')
+                    o_blkdev_file = blkdev_uname_to_file(o_dev_uname)
+                    if blkdev_file == o_blkdev_file:
+                        raise XendConfigError('The file "%s" is already used' %
+                                              blkdev_file)
                     o_blkdev_name = sxp.child_value(o_dev_info, 'dev')
                     o_devid = self._blkdev_name_to_number(o_blkdev_name)
                     if o_devid != None and devid == o_devid:
@@ -1004,7 +1007,7 @@ class XendConfig(dict):
             
             for o_dev_type, o_dev_info in defined_devices_sxpr:
                 if dev_type == o_dev_type:
-                    if dev_mac == sxp.child_value(o_dev_info, 'mac'):
+                    if dev_mac.lower() == sxp.child_value(o_dev_info, 
'mac').lower():
                         raise XendConfigError('The mac "%s" is already 
defined' %
                                               dev_mac)
     

_______________________________________________
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: Fix device duplicate check., Xen patchbot-unstable <=