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: Add blktap disk type check

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Add blktap disk type check
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Sep 2007 09:13:45 -0700
Delivery-date: Fri, 07 Sep 2007 09:21:29 -0700
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1188565875 -3600
# Node ID 2f13d0f2b07cd3089860ee5b86c9c5b377915394
# Parent  06ac4c740c4ab3b9ed677f9be5c6582b21e78f18
xend: Add blktap disk type check

Print the following error when you give a wrong disk type to xm commands:
 # xm create /xen/vm1.conf disk='tap:xxx:/xen/root-vm1.img,hda1,w'
 Using config file "/xen/vm1.conf".
 Error: tap:xxx not a valid disk type

 # xm block-attach vm2 tap:yyy:/xen/second.img hdb1 w
 Error: tap:yyy not a valid disk type
 Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode>
 [BackDomain]

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py              |    6 ++++++
 tools/python/xen/xend/server/BlktapController.py |    8 ++++++++
 2 files changed, 14 insertions(+)

diff -r 06ac4c740c4a -r 2f13d0f2b07c tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Fri Aug 31 14:09:05 2007 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Fri Aug 31 14:11:15 2007 +0100
@@ -28,6 +28,7 @@ from xen.xend.XendDevices import XendDev
 from xen.xend.XendDevices import XendDevices
 from xen.xend.PrettyPrint import prettyprintstring
 from xen.xend.XendConstants import DOM_STATE_HALTED
+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 import xsconstants
@@ -1084,6 +1085,11 @@ class XendConfig(dict):
                 else:
                     dev_info['driver'] = 'paravirtualised'
 
+            if dev_type == 'tap':
+                if dev_info['uname'].split(':')[1] not in blktap_disk_types:
+                    raise XendConfigError("tap:%s not a valid disk type" %
+                                    dev_info['uname'].split(':')[1])
+
             if dev_type == 'vif':
                 if not dev_info.get('mac'):
                     dev_info['mac'] = randomMAC()
diff -r 06ac4c740c4a -r 2f13d0f2b07c 
tools/python/xen/xend/server/BlktapController.py
--- a/tools/python/xen/xend/server/BlktapController.py  Fri Aug 31 14:09:05 
2007 +0100
+++ b/tools/python/xen/xend/server/BlktapController.py  Fri Aug 31 14:11:15 
2007 +0100
@@ -6,6 +6,14 @@ from xen.xend.XendLogging import log
 
 phantomDev = 0;
 phantomId = 0;
+
+blktap_disk_types = [
+    'aio',
+    'sync',
+    'vmdk',
+    'ram',
+    'qcow'
+    ]
 
 class BlktapController(BlkifController):
     def __init__(self, vm):

_______________________________________________
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: Add blktap disk type check, Xen patchbot-unstable <=