view tools/python/xen/xend/server/ConsoleController.py @ 16268:09d8b6eb3131

xend: Reduce xenstore transactions when listing domains

In summary, this allows a xenstore transaction object to be passed
around the various device controllers, so that they don't have to do
lots of singleton transactions. Transactions have very heavy I/O
impact from xenstored so reducing their number is important.

When running 3 guests, this patch reduces the impact of 'xm list
--long' from 176 transactions, scaling O(n) with guests, to 26
transactions with O(1) scaling.

I have previously attempted to also address the same issue with 'xm
create' but that's much harder since the device front/back handshake
requires that XenD use a number of small transactions. So i've not
changed anything here.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author Keir Fraser <keir@xensource.com>
date Tue Oct 30 09:19:43 2007 +0000 (2007-10-30)
parents 3cccf8e64296
line source
1 from xen.xend.server.DevController import DevController
2 from xen.xend.XendLogging import log
4 from xen.xend.XendError import VmError
6 class ConsoleController(DevController):
7 """A dummy controller for us to represent serial and vnc
8 console devices with persistent UUIDs.
9 """
11 valid_cfg = ['location', 'uuid', 'protocol']
13 def __init__(self, vm):
14 DevController.__init__(self, vm)
15 self.hotplug = False
17 def getDeviceDetails(self, config):
18 back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
19 return (self.allocateDeviceID(), back, {})
22 def getDeviceConfiguration(self, devid, transaction = None):
23 result = DevController.getDeviceConfiguration(self, devid, transaction)
24 if transaction is None:
25 devinfo = self.readBackend(devid, *self.valid_cfg)
26 else:
27 devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg)
28 config = dict(zip(self.valid_cfg, devinfo))
29 config = dict([(key, val) for key, val in config.items()
30 if val != None])
31 return config
33 def migrate(self, deviceConfig, network, dst, step, domName):
34 return 0
36 def destroyDevice(self, devid, force):
37 DevController.destroyDevice(self, devid, True)