Skip to contentSkip to conversation

Raise DevError for device not found at blkif.py

PATCH Superseded Glauber de Oliveira Costa 2 participants 2 messages Oct 20, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Raise DevError for device not found at blkif.py

Sorry if you get it twice. I have no idea why wasn't it delivered. Follows:

Anthony,

Hope this is a better error raising for the device not found construction in blkif.py. I imagine this Error can be used for generic device-related errors during Vm Construction.

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
tools/python/xen/xend/XendError.py renamed from tools/python/xen/xend/XendError.py.orig +3 -0
@@ -36,4 +36,7 @@ class VmError(XendError):
     """Vm construction error."""
 
     pass
+class DevError(VmError):
+    """Device probing/constructing"""
 
+    pass
tools/python/build/lib.linux-x86_64-2.4/xen/xend/server/blkif.py renamed from tools/python/build/lib.linux-x86_64-2.4/xen/xend/server/blkif.py.orig +4 -1
@@ -23,7 +23,7 @@ import string
 from xen.util import blkif
 from xen.util import security
 from xen.xend import sxp
-from xen.xend.XendError import VmError
+from xen.xend.XendError import VmError,DevError
 
 from xen.xend.server.DevController import DevController
 
@@ -81,6 +81,9 @@ class BlkifController(DevController):
                          'acm_policy' : policy})
 
         devid = blkif.blkdev_name_to_number(dev)
+        if not devid:
+            raise DevError('Unable to find number for device (%s)'%(dev))
+
         front = { 'virtual-device' : "%i" % devid,
                   'device-type' : dev_type
                 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 10 lines · Glauber de Oliveira Costa

Sorry if you get it twice. I have no idea why wasn't it delivered. Follows:

Anthony,

Hope this is a better error raising for the device not found construction in blkif.py. I imagine this Error can be used for generic device-related errors during Vm Construction.

Looks okay to me.

Regards,

Anthony Liguori

Quoted 34 lines

------------------------------------------------------------------------

tools/python/xen/xend/XendError.py renamed from tools/python/xen/xend/XendError.py.orig +3 -0
@@ -36,4 +36,7 @@ class VmError(XendError):
     """Vm construction error."""
 
     pass
+class DevError(VmError):
+    """Device probing/constructing"""
 
+    pass
tools/python/build/lib.linux-x86_64-2.4/xen/xend/server/blkif.py renamed from tools/python/build/lib.linux-x86_64-2.4/xen/xend/server/blkif.py.orig +4 -1
@@ -23,7 +23,7 @@ import string
 from xen.util import blkif
 from xen.util import security
 from xen.xend import sxp
-from xen.xend.XendError import VmError
+from xen.xend.XendError import VmError,DevError
 
 from xen.xend.server.DevController import DevController
 
@@ -81,6 +81,9 @@ class BlkifController(DevController):
                          'acm_policy' : policy})
 
         devid = blkif.blkdev_name_to_number(dev)
+        if not devid:
+            raise DevError('Unable to find number for device (%s)'%(dev))
+
         front = { 'virtual-device' : "%i" % devid,
                   'device-type' : dev_type
                 }