Skip to contentSkip to conversation

Fix xm sysrq command for inactive managed domain

PATCH New Masaki Kanno 1 participant 1 message Jul 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm sysrq command for inactive managed domain

Hi,

I tried to test a wrong operation on purpose again. When I tried xm sysrq command to a inactive managed domain, I saw the following error message. The error message did not have a message text behind "Error:". And I found an AssertionError message in xend.log.

# xm list PVdomain.1
Name                                        ID   Mem VCPUs      State   Time(s)
PVdomain.1                                      1024     4                 0.0
# xm sysrq PVdomain.1 m
Error: 
Usage: xm sysrq <Domain> <letter>

Send a sysrq to a domain.

[2007-07-09 14:49:35 3945] ERROR (xmlrpclib2:178) Internal error handling xend.domain.send_sysrq Traceback (most recent call last):
File "//usr/lib/python/xen/util/xmlrpclib2.py", line 131, in _marshaled_dispatch
response = self._dispatch(method, params)
File "/usr/lib/python2.4/SimpleXMLRPCServer.py", line 406, in _dispatch
return func(*params)
File "<string>", line 1, in <lambda>
File "//usr/lib/python/xen/xend/server/XMLRPCServer.py", line 55, in dispatch
return getattr(info, fn)(*args)
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 493, in send_sysrq

    self.storeDom("control/sysrq", '%c' % key)

File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 774, in storeDom
return xstransact.Store(self.dompath, *args)
File "//usr/lib/python/xen/xend/xenstore/xstransact.py", line 338, in Store
complete(path, lambda t: t.store(*args))
File "//usr/lib/python/xen/xend/xenstore/xstransact.py", line 352, in complete
t = xstransact(path)
File "//usr/lib/python/xen/xend/xenstore/xstransact.py", line 19, in __init__
assert path is not None
AssertionError

I fixed the error message as follows.
Could you apply the attached patch?

# xm list PVdomain.1
Name                                        ID   Mem VCPUs      State   Time(s)
PVdomain.1                                      1024     4                 0.0
# xm sysrq PVdomain.1 m
Error: Domain 'PVdomain.1' is not started
Usage: xm sysrq <Domain> <letter>

Send a sysrq to a domain.

Best regards,
Kan

tools/python/xen/xend/XendDomainInfo.py +3 -0
diff -r 5fbe4c7ec743 tools/python/xen/xend/XendDomainInfo.py
@@ -488,6 +488,9 @@ class XendDomainInfo:
 
     def send_sysrq(self, key):
         """ Send a Sysrq equivalent key via xenstored."""
+        if self._stateGet() not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+            raise XendError("Domain '%s' is not started" % self.info['name_label'])
+
         asserts.isCharConvertible(key)
         self.storeDom("control/sysrq", '%c' % key)
 

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