All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] XenD: Check for device model if path is not specified (i.e. using auxbin path)
@ 2010-11-30 12:19 Michal Novotny
  2011-01-11 18:51 ` Ian Jackson
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Novotny @ 2010-11-30 12:19 UTC (permalink / raw)
  To: 'xen-devel@lists.xensource.com'

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

Hi,
this is the patch to check for device model (in XendConfig.py) when the 
device_model had no path specified, i.e. XenD was trying to read the 
file on the auxbin path. Without this patch applied the meaningless 
python error "coercing to Unicode: need string or buffer, NoneType 
found" occurred:

[2010-11-30 13:56:47 5255] ERROR (xmlrpclib2:181) Internal error 
handling xend.domain.create
Traceback (most recent call last):
   File "/usr/lib64/python2.4/site-packages/xen/util/xmlrpclib2.py", 
line 134, in _marshaled_dispatch
     response = self._dispatch(method, params)
   File "/usr/lib64/python2.4/SimpleXMLRPCServer.py", line 406, in _dispatch
     return func(*params)
   File 
"/usr/lib64/python2.4/site-packages/xen/xend/server/XMLRPCServer.py", 
line 80, in domain_create
     info = XendDomain.instance().domain_create(config)
   File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomain.py", 
line 1001, in domain_create
     dominfo = XendDomainInfo.create(config)
   File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", 
line 97, in create
     domconfig = XendConfig.XendConfig(sxp_obj = config)
   File "/usr/lib64/python2.4/site-packages/xen/xend/XendConfig.py", 
line 367, in __init__
     self.validate()
   File "/usr/lib64/python2.4/site-packages/xen/xend/XendConfig.py", 
line 558, in validate
     self._platform_sanity_check()
   File "/usr/lib64/python2.4/site-packages/xen/xend/XendConfig.py", 
line 502, in _platform_sanity_check
     if not os.path.exists(self['platform']['device_model']):
   File "/usr/lib64/python2.4/posixpath.py", line 171, in exists
     st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

This patch raises VmError with message that no valid device model was 
specified if None type was found in the device_model specification.

It's been tested on non-existing device model where the message is being 
printed. If an invalid (but existing) device_model is set in the 
configuration file the domain was destroyed because it crashed. If there 
is a path specified (i.e. it's not using auxbin path) it bails with 
error that the device model was not found (which was already implemented 
there).

Michal

Signed-off-by: Michal Novotny <minovotn@redhat.com>

-- 
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat


[-- Attachment #2: xen-check-for-device-model.patch --]
[-- Type: text/x-patch, Size: 896 bytes --]

diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py
index 4181d6c..5568d35 100644
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -498,6 +498,10 @@ class XendConfig(dict):
             if os.path.dirname(self['platform']['device_model']) == "":
                 self['platform']['device_model'] = \
                     auxbin.pathTo(self['platform']['device_model'])
+            # If the device_model is not set the os.path.exists() would raise
+            # an exception so we return our error message instead if applicable
+            if not self['platform']['device_model']:
+                raise VmError("No valid device model specified")
             if not os.path.exists(self['platform']['device_model']):
                 raise VmError("device model '%s' not found" % str(self['platform']['device_model']))
 

[-- 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 related	[flat|nested] 2+ messages in thread

* Re: [PATCH] XenD: Check for device model if path is not specified (i.e. using auxbin path)
  2010-11-30 12:19 [PATCH] XenD: Check for device model if path is not specified (i.e. using auxbin path) Michal Novotny
@ 2011-01-11 18:51 ` Ian Jackson
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Jackson @ 2011-01-11 18:51 UTC (permalink / raw)
  To: Michal Novotny; +Cc: 'xen-devel@lists.xensource.com'

Michal Novotny writes ("[Xen-devel] [PATCH] XenD: Check for device model if path is not specified (i.e. using auxbin path)"):
> Hi,
> this is the patch to check for device model (in XendConfig.py) when the 
> device_model had no path specified, i.e. XenD was trying to read the 
> file on the auxbin path. Without this patch applied the meaningless 
> python error "coercing to Unicode: need string or buffer, NoneType 
> found" occurred:

Thanks, I have applied this patch, and sorry for the delay.

Ian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-11 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-30 12:19 [PATCH] XenD: Check for device model if path is not specified (i.e. using auxbin path) Michal Novotny
2011-01-11 18:51 ` Ian Jackson

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.