All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@suse.de>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] xend: Fix block device type check
Date: Thu, 29 Jan 2009 14:01:12 +0100	[thread overview]
Message-ID: <4981A898.2020700@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Since changeset 17617 the block device protocols are checked to be
either file or phy. This has later been fixed to also include tap. This
is still not a correct check as there can be arbitrary additional
protocols. Before this check was added you could have a block-xyz
hotplug script and xyz would work as a protocol, now it is refused. An
example for this mechanism is the block-nbd script which is included in
the tree.

This patch changes the check to allow file, phy, tap and all protocol
names for which a block-$protocol hotplug script exists. This should fix
the last regressions introduced by the check.

Signed-off-by: Kevin Wolf <kwolf@suse.de>

[-- Attachment #2: reenable-block-protocols.patch --]
[-- Type: text/x-patch, Size: 1449 bytes --]

Index: xen-unstable.hg/tools/python/xen/xend/server/blkif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/blkif.py
+++ xen-unstable.hg/tools/python/xen/xend/server/blkif.py
@@ -18,6 +18,7 @@
 
 import re
 import string
+import os
 
 from xen.util import blkif
 import xen.util.xsm.xsm as security
@@ -35,6 +36,13 @@ class BlkifController(DevController):
         """
         DevController.__init__(self, vm)
 
+    def _isValidProtocol(self, protocol):
+        if protocol in ('phy', 'file', 'tap'):
+            return True
+
+        return os.access('/etc/xen/scripts/block-%s' % protocol, os.X_OK)
+
+
     def getDeviceDetails(self, config):
         """@see DevController.getDeviceDetails"""
         uname = config.get('uname', '')
@@ -56,10 +64,8 @@ class BlkifController(DevController):
         else:
             try:
                 (typ, params) = string.split(uname, ':', 1)
-                if typ not in ('phy', 'file', 'tap'):
-                    raise VmError(
-                        'Block device must have "phy", "file" or "tap" '
-                        'specified to type')
+                if not self._isValidProtocol(typ):
+                    raise VmError('Block device type "%s" is invalid.' % typ)
             except ValueError:
                 raise VmError(
                     'Block device must have physical details specified')

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2009-01-29 13:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4981A898.2020700@suse.de \
    --to=kwolf@suse.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.