bitkeeper revision 1.1403 (4284c2edzLTGTr4gHmGzYsZMuetTRQ)

Switch to using unix-domain interface on xend instead
of http via libcurl.
Sundry other merges and fixes.
Signed-off-by: Mike Wray <mike.wray@hp.com>
This commit is contained in:
mjw@wray-m-3.hpl.hp.com committed 2005-05-13 15:08:29 +00:00
1 parent 21eaf26c10
commit 007d7b6e1e
18 files changed
+1703 -1158

No files matched your search

+1 -5
View File
@@ -60,7 +60,6 @@ class Daemon:
if not pm: continue
xm = xendre.match(pm.group('cmd'))
if not xm: continue
#print 'pid=', pm.group('pid'), 'cmd=', pm.group('cmd')
pids.append(int(pm.group('pid')))
return pids
@@ -313,7 +312,7 @@ class Daemon:
os.setuid(pwd.getpwnam(XEND_USER)[2])
return 0
except KeyError, error:
print "Error: no such user '%s'" % XEND_USER
print >>sys.stderr, "Error: no such user '%s'" % XEND_USER
return 1
def stop(self):
@@ -328,7 +327,6 @@ class Daemon:
self.listenChannels()
servers = SrvServer.create()
self.daemonize()
print 'running serverthread...'
servers.start()
except Exception, ex:
print >>sys.stderr, 'Exception starting xend:', ex
@@ -342,14 +340,12 @@ class Daemon:
def listenChannels(self):
def virqReceived(virq):
print 'virqReceived>', virq
eserver.inject('xend.virq', virq)
self.channelF.setVirqHandler(virqReceived)
self.channelF.start()
def exit(self, rc=0):
#reactor.disconnectAll()
if self.channelF:
self.channelF.stop()
# Calling sys.exit() raises a SystemExit exception, which only
+30 -16
View File
@@ -3,17 +3,13 @@ import StringIO
from xen.web import reactor, protocol
from xen.lowlevel import xu
from xen.xend import sxp
from xen.xend import PrettyPrint
from xen.xend import EventServer
eserver = EventServer.instance()
from xen.xend import EventServer; eserver = EventServer.instance()
from xen.xend.XendError import XendError
from xen.xend import XendRoot; xroot = XendRoot.instance()
DEBUG = 1
DEBUG = 0
class EventProtocol(protocol.Protocol):
"""Asynchronous handler for a connected event socket.
@@ -30,7 +26,7 @@ class EventProtocol(protocol.Protocol):
self.pretty = 0
# For debugging subscribe to everything and make output pretty.
self.subscribe(['*'])
#self.subscribe(['*'])
self.pretty = 1
def dataReceived(self, data):
@@ -45,10 +41,7 @@ class EventProtocol(protocol.Protocol):
except SystemExit:
raise
except:
if DEBUG:
raise
else:
self.send_error()
self.send_error()
def loseConnection(self):
if self.transport:
@@ -73,7 +66,11 @@ class EventProtocol(protocol.Protocol):
return 0
def send_result(self, res):
return self.send_reply(['ok', res])
if res is None:
resp = ['ok']
else:
resp = ['ok', res]
return self.send_reply(resp)
def send_error(self):
(extype, exval) = sys.exc_info()[:2]
@@ -129,7 +126,6 @@ class EventProtocol(protocol.Protocol):
def op_pretty(self, name, req):
self.pretty = 1
return ['ok']
def op_console_disconnect(self, name, req):
id = sxp.child_value(req, 'id')
@@ -137,7 +133,6 @@ class EventProtocol(protocol.Protocol):
raise XendError('Missing console id')
id = int(id)
self.daemon.console_disconnect(id)
return ['ok']
def op_info(self, name, req):
val = ['info']
@@ -151,13 +146,11 @@ class EventProtocol(protocol.Protocol):
# (sys.subscribe event*)
# Subscribe to the events:
self.subscribe(v[1:])
return ['ok']
def op_sys_inject(self, name, v):
# (sys.inject event)
event = v[1]
eserver.inject(sxp.name(event), event)
return ['ok']
def op_trace(self, name, v):
mode = (v[1] == 'on')
@@ -181,6 +174,27 @@ class EventProtocol(protocol.Protocol):
import controller
controller.DEBUG = (mode == 'on')
def op_domain_ls(self, name, v):
xd = xroot.get_component("xen.xend.XendDomain")
return xd.domain_ls()
def op_domain_configure(self, name, v):
domid = sxp.child_value(v, "dom")
config = sxp.child_value(v, "config")
if domid is None:
raise XendError("missing domain id")
if config is None:
raise XendError("missing domain config")
xd = xroot.get_component("xen.xend.XendDomain")
xd.domain_configure(domid, config)
def op_domain_unpause(self, name, v):
domid = sxp.child_value(v, "dom")
if domid is None:
raise XendError("missing domain id")
xd = xroot.get_component("xen.xend.XendDomain")
xd.domain_unpause(domid)
class EventFactory(protocol.ServerFactory):
"""Asynchronous handler for the event server socket.
"""
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.