⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfbif.py

📁 xen虚拟机源代码安装包
💻 PY
字号:
from xen.xend.server.DevController import DevControllerfrom xen.xend.XendLogging import logfrom xen.xend.XendError import VmErrorimport xen.xendimport osCONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',                  'videoram', 'display', 'xauthority', 'keymap',                  'uuid', 'location', 'protocol', 'opengl']class VfbifController(DevController):    """Virtual frame buffer controller. Handles all vfb devices for a domain.    Note that we only support a single vfb per domain at the moment.    """    def __init__(self, vm):        DevController.__init__(self, vm)            def getDeviceDetails(self, config):        """@see DevController.getDeviceDetails"""        back = dict([(k, str(config[k])) for k in CONFIG_ENTRIES                     if config.has_key(k)])        devid = 0        return (devid, back, {})    def getDeviceConfiguration(self, devid, transaction = None):        result = DevController.getDeviceConfiguration(self, devid, transaction)        if transaction is None:            devinfo = self.readBackend(devid, *CONFIG_ENTRIES)        else:            devinfo = self.readBackendTxn(transaction, devid, *CONFIG_ENTRIES)        return dict([(CONFIG_ENTRIES[i], devinfo[i])                     for i in range(len(CONFIG_ENTRIES))                     if devinfo[i] is not None])    def waitForDevice(self, devid):        # is a qemu-dm managed device, don't wait for hotplug for these.        return    def reconfigureDevice(self, _, config):        """ Only allow appending location information of vnc port into        xenstore."""        if 'location' in config:            (devid, back, front) = self.getDeviceDetails(config)            self.writeBackend(devid, 'location', config['location'])            return back.get('uuid')        raise VmError('Refusing to reconfigure device vfb:%d' % devid)    def destroyDevice(self, devid, force):        # remove the backend xenstore entries no matter what        # because we kill qemu-dm with extreme prejudice        # not giving it a chance to remove them itself        DevController.destroyDevice(self, devid, True)    def migrate(self, deviceConfig, network, dst, step, domName):        # Handled by qemu-dm so no action needed        return 0    class VkbdifController(DevController):    """Virtual keyboard controller. Handles all vkbd devices for a domain.    """    def getDeviceDetails(self, config):        """@see DevController.getDeviceDetails"""        devid = 0        back = {}        front = {}        return (devid, back, front)    def waitForDevice(self, config):        # is a qemu-dm managed device, don't wait for hotplug for these.        return    def destroyDevice(self, devid, force):        # remove the backend xenstore entries no matter what        # because we kill qemu-dm with extreme prejudice        # not giving it a chance to remove them itself        DevController.destroyDevice(self, devid, True)    def migrate(self, deviceConfig, network, dst, step, domName):        # Handled by qemu-dm so no action needed        return 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -