* [PATCH] Xend: Fix Device Duplicate Check
@ 2007-12-17 9:28 Yosuke Iwamatsu
2007-12-18 1:21 ` Masaki Kanno
0 siblings, 1 reply; 3+ messages in thread
From: Yosuke Iwamatsu @ 2007-12-17 9:28 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
Hi,
This patch fixes device duplicate check as follows.
- Add duplicate check for the blktap device
- Do case-insensitve comparison for mac addresses
Regards,
-------------------
Yosuke Iwamatsu
NEC Corporation
[-- Attachment #2: duplicate_check.patch --]
[-- Type: text/plain, Size: 1414 bytes --]
# HG changeset patch
# User y-iwamatsu@ab.jp.nec.com
# Date 1197871440 -32400
# Node ID f9b5560cfe23eba8870bcca48fb42bf9fb4fbd65
# Parent 966a6d3b74087474df337e00b31cbecf495b442a
Xend: Fix device duplicate check.
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
diff -r 966a6d3b7408 -r f9b5560cfe23 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Fri Dec 14 11:50:24 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py Mon Dec 17 15:04:00 2007 +0900
@@ -1023,7 +1023,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)
@@ -1046,7 +1046,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)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Xend: Fix Device Duplicate Check 2007-12-17 9:28 [PATCH] Xend: Fix Device Duplicate Check Yosuke Iwamatsu @ 2007-12-18 1:21 ` Masaki Kanno 2007-12-18 6:47 ` Yosuke Iwamatsu 0 siblings, 1 reply; 3+ messages in thread From: Masaki Kanno @ 2007-12-18 1:21 UTC (permalink / raw) To: Yosuke Iwamatsu, xen-devel Hi Iwamatsu, Could you improve your patch to cause an error in the following conditions? - different blktap disk type: disk = [ 'tap:aio:/xen/root.img,hda1,w', 'tap:sync:/xen/root.img,hdb1,w' ] ^^^ ^^^^ - different device type: disk = [ 'file:/xen/root.img,hda1,w', 'tap:***:/xen/root.img,hdb1,w' ] ^^^^ ^^^ Best regards, Kan Mon, 17 Dec 2007 18:28:05 +0900, Yosuke Iwamatsu wrote: >Hi, > >This patch fixes device duplicate check as follows. > >- Add duplicate check for the blktap device >- Do case-insensitve comparison for mac addresses > >Regards, >------------------- >Yosuke Iwamatsu > NEC Corporation ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Xend: Fix Device Duplicate Check 2007-12-18 1:21 ` Masaki Kanno @ 2007-12-18 6:47 ` Yosuke Iwamatsu 0 siblings, 0 replies; 3+ messages in thread From: Yosuke Iwamatsu @ 2007-12-18 6:47 UTC (permalink / raw) To: Masaki Kanno, xen-devel [-- Attachment #1: Type: text/plain, Size: 940 bytes --] Hi, Masaki Kanno wrote: > Hi Iwamatsu, > > Could you improve your patch to cause an error in the following > conditions? > > - different blktap disk type: > disk = [ 'tap:aio:/xen/root.img,hda1,w', 'tap:sync:/xen/root.img,hdb1,w' ] > ^^^ ^^^^ > - different device type: > disk = [ 'file:/xen/root.img,hda1,w', 'tap:***:/xen/root.img,hdb1,w' ] > ^^^^ ^^^ Please take a look at the attach patch, which uses filename rather than uname for duplicate check of block devices. Thank you for the suggestion. Yosuke > > Best regards, > Kan > > Mon, 17 Dec 2007 18:28:05 +0900, Yosuke Iwamatsu wrote: > >> Hi, >> >> This patch fixes device duplicate check as follows. >> >> - Add duplicate check for the blktap device >> - Do case-insensitve comparison for mac addresses >> >> Regards, >> ------------------- >> Yosuke Iwamatsu >> NEC Corporation [-- Attachment #2: duplicate_check_r1.patch --] [-- Type: text/plain, Size: 2711 bytes --] Xend: Fix device duplicate check. Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com> diff -r 966a6d3b7408 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Dec 14 11:50:24 2007 +0000 +++ b/tools/python/xen/xend/XendConfig.py Tue Dec 18 15:33:09 2007 +0900 @@ -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 @@ -1023,7 +1023,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) @@ -1031,10 +1031,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: @@ -1046,7 +1049,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) [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-18 6:47 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-17 9:28 [PATCH] Xend: Fix Device Duplicate Check Yosuke Iwamatsu 2007-12-18 1:21 ` Masaki Kanno 2007-12-18 6:47 ` Yosuke Iwamatsu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.