ia64/xen-unstable

changeset 2265:af0729973950

bitkeeper revision 1.1159.38.1 (41231e93omwWBjFZGIgG3ek6UMbDYA)

Refactor device setup code so that the devices do more of
the messaging.
author mjw@wray-m-3.hpl.hp.com
date Wed Aug 18 09:17:07 2004 +0000 (2004-08-18)
parents 613af610be8a
children a63157177284
files tools/python/xen/lowlevel/xu/xu.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/channel.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/messages.py tools/python/xen/xend/server/netif.py
line diff
     1.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Mon Aug 16 09:59:28 2004 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Wed Aug 18 09:17:07 2004 +0000
     1.3 @@ -426,6 +426,12 @@ static PyObject *xu_message_get_payload(
     1.4          C2P(netif_fe_interface_status_changed_t, handle, Int, Long);
     1.5          C2P(netif_fe_interface_status_changed_t, status, Int, Long);
     1.6          C2P(netif_fe_interface_status_changed_t, evtchn, Int, Long);
     1.7 +        C2P(netif_fe_interface_status_changed_t, mac[0], Int, Long);
     1.8 +        C2P(netif_fe_interface_status_changed_t, mac[1], Int, Long);
     1.9 +        C2P(netif_fe_interface_status_changed_t, mac[2], Int, Long);
    1.10 +        C2P(netif_fe_interface_status_changed_t, mac[3], Int, Long);
    1.11 +        C2P(netif_fe_interface_status_changed_t, mac[4], Int, Long);
    1.12 +        C2P(netif_fe_interface_status_changed_t, mac[5], Int, Long);
    1.13          return dict;
    1.14      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED):
    1.15          C2P(netif_fe_driver_status_changed_t, status,        Int, Long);
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 16 09:59:28 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Aug 18 09:17:07 2004 +0000
     2.3 @@ -1074,8 +1074,8 @@ def vm_dev_vif(vm, val, index):
     2.4      @param index:     vif index
     2.5      @return: deferred
     2.6      """
     2.7 -    if vm.netif_backend:
     2.8 -        raise VmError('vif: vif in netif backend domain')
     2.9 +    #if vm.netif_backend:
    2.10 +    #    raise VmError('vif: vif in netif backend domain')
    2.11      vif = vm.next_device_index('vif')
    2.12      vmac = sxp.child_value(val, "mac")
    2.13      backend = vm.get_device_backend('vif')
    2.14 @@ -1098,8 +1098,8 @@ def vm_dev_vbd(vm, val, index):
    2.15      @param index:     vbd index
    2.16      @return: deferred
    2.17      """
    2.18 -    if vm.blkif_backend:
    2.19 -        raise VmError('vbd: vbd in blkif backend domain')
    2.20 +    #if vm.blkif_backend:
    2.21 +    #    raise VmError('vbd: vbd in blkif backend domain')
    2.22      uname = sxp.child_value(val, 'uname')
    2.23      if not uname:
    2.24          raise VmError('vbd: Missing uname')
     3.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Mon Aug 16 09:59:28 2004 +0000
     3.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Wed Aug 18 09:17:07 2004 +0000
     3.3 @@ -48,7 +48,7 @@ class SrvDomain(SrvDir):
     3.4          fn = FormFn(self.xd.domain_shutdown,
     3.5                      [['dom', 'str'],
     3.6                       ['reason', 'str']])
     3.7 -        val = fn(req.args, {'dom': self.dom.name})
     3.8 +        val = fn(req.args, {'dom': self.dom.id})
     3.9          req.setResponseCode(http.ACCEPTED)
    3.10          req.setHeader("Location", "%s/.." % req.prePathURL())
    3.11          return val
    3.12 @@ -57,7 +57,7 @@ class SrvDomain(SrvDir):
    3.13          fn = FormFn(self.xd.domain_destroy,
    3.14                      [['dom', 'str'],
    3.15                       ['reason', 'str']])
    3.16 -        val = fn(req.args, {'dom': self.dom.name})
    3.17 +        val = fn(req.args, {'dom': self.dom.id})
    3.18          req.setHeader("Location", "%s/.." % req.prePathURL())
    3.19          return val
    3.20  
    3.21 @@ -65,7 +65,7 @@ class SrvDomain(SrvDir):
    3.22          fn = FormFn(self.xd.domain_save,
    3.23                      [['dom', 'str'],
    3.24                       ['file', 'str']])
    3.25 -        deferred = fn(req.args, {'dom': self.dom.name})
    3.26 +        deferred = fn(req.args, {'dom': self.dom.id})
    3.27          deferred.addCallback(self._op_save_cb, req)
    3.28          deferred.addErrback(self._op_save_err, req)
    3.29          return deferred
    3.30 @@ -81,7 +81,7 @@ class SrvDomain(SrvDir):
    3.31          fn = FormFn(self.xd.domain_migrate,
    3.32                      [['dom', 'str'],
    3.33                       ['destination', 'str']])
    3.34 -        deferred = fn(req.args, {'dom': self.dom.name})
    3.35 +        deferred = fn(req.args, {'dom': self.dom.id})
    3.36          print 'op_migrate>', deferred
    3.37          deferred.addCallback(self._op_migrate_cb, req)
    3.38          deferred.addErrback(self._op_migrate_err, req)
    3.39 @@ -107,7 +107,7 @@ class SrvDomain(SrvDir):
    3.40          fn = FormFn(self.xd.domain_pincpu,
    3.41                      [['dom', 'str'],
    3.42                       ['cpu', 'int']])
    3.43 -        val = fn(req.args, {'dom': self.dom.name})
    3.44 +        val = fn(req.args, {'dom': self.dom.id})
    3.45          return val
    3.46  
    3.47      def op_cpu_bvt_set(self, op, req):
    3.48 @@ -118,7 +118,7 @@ class SrvDomain(SrvDir):
    3.49                       ['warpvalue', 'int'],
    3.50                       ['warpl', 'long'],
    3.51                       ['warpu', 'long']])
    3.52 -        val = fn(req.args, {'dom': self.dom.name})
    3.53 +        val = fn(req.args, {'dom': self.dom.id})
    3.54          return val
    3.55      
    3.56      def op_cpu_fbvt_set(self, op, req):
    3.57 @@ -128,7 +128,7 @@ class SrvDomain(SrvDir):
    3.58                       ['warp', 'int'],
    3.59                       ['warpl', 'int'],
    3.60                       ['warpu', 'int']])
    3.61 -        val = fn(req.args, {'dom': self.dom.name})
    3.62 +        val = fn(req.args, {'dom': self.dom.id})
    3.63          return val
    3.64  
    3.65      def op_cpu_atropos_set(self, op, req):
    3.66 @@ -138,21 +138,21 @@ class SrvDomain(SrvDir):
    3.67                       ['slice', 'int'],
    3.68                       ['latency', 'int'],
    3.69                       ['xtratime', 'int']])
    3.70 -        val = fn(req.args, {'dom': self.dom.name})
    3.71 +        val = fn(req.args, {'dom': self.dom.id})
    3.72          return val
    3.73  
    3.74      def op_maxmem_set(self, op, req):
    3.75          fn = FormFn(self.xd.domain_maxmem_set,
    3.76                      [['dom', 'str'],
    3.77                       ['memory', 'int']])
    3.78 -        val = fn(req.args, {'dom': self.dom.name})
    3.79 +        val = fn(req.args, {'dom': self.dom.id})
    3.80          return val
    3.81  
    3.82      def op_device_create(self, op, req):
    3.83          fn = FormFn(self.xd.domain_device_create,
    3.84                      [['dom', 'str'],
    3.85                       ['config', 'sxpr']])
    3.86 -        d = fn(req.args, {'dom': self.dom.name})
    3.87 +        d = fn(req.args, {'dom': self.dom.id})
    3.88          return d
    3.89  
    3.90      def op_device_destroy(self, op, req):
    3.91 @@ -160,29 +160,29 @@ class SrvDomain(SrvDir):
    3.92                      [['dom', 'str'],
    3.93                       ['type', 'str'],
    3.94                       ['idx', 'str']])
    3.95 -        val = fn(req.args, {'dom': self.dom.name})
    3.96 +        val = fn(req.args, {'dom': self.dom.id})
    3.97          return val
    3.98                  
    3.99      def op_vifs(self, op, req):
   3.100 -        devs = self.xd.domain_vif_ls(self.dom.name)
   3.101 +        devs = self.xd.domain_vif_ls(self.dom.id)
   3.102          return [ dev.sxpr() for dev in devs ]
   3.103  
   3.104      def op_vif(self, op, req):
   3.105          fn = FormFn(self.xd.domain_vif_get,
   3.106                      [['dom', 'str'],
   3.107                       ['vif', 'str']])
   3.108 -        val = fn(req.args, {'dom': self.dom.name})
   3.109 +        val = fn(req.args, {'dom': self.dom.id})
   3.110          return val
   3.111  
   3.112      def op_vbds(self, op, req):
   3.113 -        devs = self.xd.domain_vbd_ls(self.dom.name)
   3.114 +        devs = self.xd.domain_vbd_ls(self.dom.id)
   3.115          return [ dev.sxpr() for dev in devs ]
   3.116  
   3.117      def op_vbd(self, op, req):
   3.118          fn = FormFn(self.xd.domain_vbd_get,
   3.119                      [['dom', 'str'],
   3.120                       ['vbd', 'str']])
   3.121 -        val = fn(req.args, {'dom': self.dom.name})
   3.122 +        val = fn(req.args, {'dom': self.dom.id})
   3.123          return val
   3.124  
   3.125      def render_POST(self, req):
     4.1 --- a/tools/python/xen/xend/server/blkif.py	Mon Aug 16 09:59:28 2004 +0000
     4.2 +++ b/tools/python/xen/xend/server/blkif.py	Wed Aug 18 09:17:07 2004 +0000
     4.3 @@ -22,74 +22,7 @@ class BlkifBackendController(controller.
     4.4          self.addMethod(CMSG_BLKIF_BE,
     4.5                         CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED,
     4.6                         self.recv_be_driver_status_changed)
     4.7 -        self.attached = 1
     4.8          self.registerChannel()
     4.9 -        
    4.10 -    def respond_be_create(self, msg, d):
    4.11 -        """Response handler for a be_create message.
    4.12 -        Calls I{d} with the block interface created.
    4.13 -
    4.14 -        @param msg: message
    4.15 -        @type  msg: xu message
    4.16 -        @param d: deferred to call
    4.17 -        @type  d: Deferred
    4.18 -        """
    4.19 -        val = unpackMsg('blkif_be_create_t', msg)
    4.20 -        blkif = self.factory.getInstanceByDom(val['domid'])
    4.21 -        d.callback(blkif)
    4.22 -
    4.23 -    def respond_be_connect(self, msg):
    4.24 -        """Response handler for a be_connect message.
    4.25 -
    4.26 -        @param msg: message
    4.27 -        @type  msg: xu message
    4.28 -        """
    4.29 -        val = unpackMsg('blkif_be_connect_t', msg)
    4.30 -        blkif = self.factory.getInstanceByDom(val['domid'])
    4.31 -        if blkif:
    4.32 -            blkif.send_fe_interface_status_changed()
    4.33 -        else:
    4.34 -            pass
    4.35 -    
    4.36 -    def respond_be_vbd_create(self, msg, dev, d):
    4.37 -        """Response handler for a be_vbd_create message.
    4.38 -        Tries to grow the vbd, and passes the deferred I{d} on for
    4.39 -        the grow to call.
    4.40 -
    4.41 -        @param msg: message
    4.42 -        @type  msg: xu message
    4.43 -        @param dev: device
    4.44 -        @type  dev: BlkDev
    4.45 -        @param d: deferred to call
    4.46 -        @type  d: Deferred
    4.47 -        """
    4.48 -        val = unpackMsg('blkif_be_vbd_create_t', msg)
    4.49 -        blkif = self.factory.getInstanceByDom(val['domid'])
    4.50 -        if blkif:
    4.51 -            d1 = defer.Deferred()
    4.52 -            d1.addCallback(self.respond_be_vbd_grow, dev, d)
    4.53 -            if d: d1.addErrback(d.errback)
    4.54 -            blkif.send_be_vbd_grow(val['vdevice'], response=d1)
    4.55 -        else:
    4.56 -            pass
    4.57 -    
    4.58 -    def respond_be_vbd_grow(self, msg, dev, d):
    4.59 -        """Response handler for a be_vbd_grow message.
    4.60 -
    4.61 -        @param msg: message
    4.62 -        @type  msg: xu message
    4.63 -        @param dev: device
    4.64 -        @type  dev: BlkDev
    4.65 -        @param d: deferred to call
    4.66 -        @type  d: Deferred or None
    4.67 -        """
    4.68 -        val = unpackMsg('blkif_be_vbd_grow_t', msg)
    4.69 -	status = val['status']
    4.70 -	if status != BLKIF_BE_STATUS_OKAY:
    4.71 -            raise XendError("Adding extent to vbd failed: device %x, error %d"
    4.72 -                            % (val['extent.device'], status))
    4.73 -        if d:
    4.74 -            d.callback(dev)
    4.75  
    4.76      def recv_be_driver_status_changed(self, msg, req):
    4.77          """Request handler for be_driver_status_changed messages.
    4.78 @@ -101,11 +34,6 @@ class BlkifBackendController(controller.
    4.79          """
    4.80          val = unpackMsg('blkif_be_driver_status_changed_t', msg)
    4.81          status = val['status']
    4.82 -        if status == BLKIF_DRIVER_STATUS_UP and not self.attached:
    4.83 -            for blkif in self.factory.getInstances():
    4.84 -                if blkif.backendController == self:
    4.85 -                    blkif.detach()
    4.86 - 
    4.87  
    4.88  class BlkifControllerFactory(controller.SplitControllerFactory):
    4.89      """Factory for creating block device interface controllers.
    4.90 @@ -113,7 +41,6 @@ class BlkifControllerFactory(controller.
    4.91  
    4.92      def __init__(self):
    4.93          controller.SplitControllerFactory.__init__(self)
    4.94 -        self.attached = 1
    4.95  
    4.96      def createInstance(self, dom, recreate=0, backend=0):
    4.97          """Create a block device controller for a domain.
    4.98 @@ -125,20 +52,14 @@ class BlkifControllerFactory(controller.
    4.99          @return: deferred
   4.100          @rtype: twisted.internet.defer.Deferred
   4.101          """
   4.102 -        d = defer.Deferred()
   4.103          blkif = self.getInstanceByDom(dom)
   4.104          if blkif:
   4.105 +            d = defer.Deferred()
   4.106              d.callback(blkif)
   4.107          else:
   4.108              blkif = BlkifController(self, dom, backend)
   4.109              self.addInstance(blkif)
   4.110 -            if recreate:
   4.111 -                d.callback(blkif)
   4.112 -            else:
   4.113 -                d1 = defer.Deferred()
   4.114 -                d1.addCallback(blkif.backendController.respond_be_create, d)
   4.115 -                d1.addErrback(d.errback)
   4.116 -                blkif.send_be_create(response=d1)
   4.117 +            d = blkif.connect(recreate=recreate)
   4.118          return d
   4.119  
   4.120      def getDomainDevices(self, dom):
   4.121 @@ -158,7 +79,7 @@ class BlkifControllerFactory(controller.
   4.122          @param dom: domain
   4.123          @type  dom: int
   4.124          @param vdev: device index
   4.125 -        @type  vedv: int
   4.126 +        @type  vdev: int
   4.127          @return: device
   4.128          @rtype:  device
   4.129          """
   4.130 @@ -168,66 +89,6 @@ class BlkifControllerFactory(controller.
   4.131      def createBackendController(self, dom):
   4.132          return BlkifBackendController(self, dom)
   4.133  
   4.134 -    def setControlDomain(self, dom, recreate=0):
   4.135 -        """Set the back-end block device controller domain.
   4.136 -
   4.137 -        @param dom: domain
   4.138 -        @type  dom: int
   4.139 -        @param recreate: if true it's a recreate (after xend restart)
   4.140 -        @type  recreate: int
   4.141 -        """
   4.142 -        if self.dom == dom: return
   4.143 -        self.deregisterChannel()
   4.144 -        if not recreate:
   4.145 -            self.attached = 0
   4.146 -        self.dom = dom
   4.147 -        self.registerChannel()
   4.148 -
   4.149 -    def getControlDomain(self):
   4.150 -        """Get the back-end block device controller domain.
   4.151 -
   4.152 -        @return: domain
   4.153 -        @rtype:  int
   4.154 -        """
   4.155 -        return self.dom
   4.156 -
   4.157 -    def reattachDevice(self, dom, vdev):
   4.158 -        """Reattach a device (on changing control domain).
   4.159 -
   4.160 -        @param dom: domain
   4.161 -        @type  dom: int
   4.162 -        @param vdev: device index
   4.163 -        @type  vdev: int
   4.164 -        """
   4.165 -        blkif = self.getInstanceByDom(dom)
   4.166 -        if blkif:
   4.167 -            blkif.reattachDevice(vdev)
   4.168 -        self.attached = self.devicesAttached()
   4.169 -        if self.attached:
   4.170 -            self.reattached()
   4.171 -
   4.172 -    def devicesAttached(self):
   4.173 -        """Check if all devices are attached.
   4.174 -
   4.175 -        @return: true if all devices attached
   4.176 -        @rtype:  bool
   4.177 -        """
   4.178 -        attached = 1
   4.179 -        for blkif in self.getInstances():
   4.180 -            if not blkif.attached:
   4.181 -                attached = 0
   4.182 -                break
   4.183 -        return attached
   4.184 -                         
   4.185 -    def reattached(self):
   4.186 -        """Notify all block interfaces we have been reattached
   4.187 -        (after changing control domain).
   4.188 -        """
   4.189 -        for blkif in self.getInstances():
   4.190 -            blkif.reattached()
   4.191 -
   4.192 -
   4.193 -
   4.194  class BlkDev(controller.Dev):
   4.195      """Info record for a block device.
   4.196      """
   4.197 @@ -241,7 +102,9 @@ class BlkDev(controller.Dev):
   4.198          self.device = segment['device']
   4.199          self.start_sector = segment['start_sector']
   4.200          self.nr_sectors = segment['nr_sectors']
   4.201 -        self.attached = 1
   4.202 +
   4.203 +    def getBackendController(self):
   4.204 +        return self.controller.backendController
   4.205  
   4.206      def readonly(self):
   4.207          return 'w' not in self.mode
   4.208 @@ -260,7 +123,80 @@ class BlkDev(controller.Dev):
   4.209  
   4.210      def destroy(self):
   4.211          log.debug("Destroying vbd domain=%d vdev=%d", self.controller.dom, self.vdev)
   4.212 -        self.controller.send_be_vbd_destroy(self.vdev)
   4.213 +        self.send_be_vbd_destroy()
   4.214 +
   4.215 +    def attach(self, d):
   4.216 +        """Attach the device to its controller.
   4.217 +
   4.218 +        @param d: deferred to call with the device on success
   4.219 +        """
   4.220 +        d1 = defer.Deferred()
   4.221 +        d1.addCallback(self.respond_be_vbd_create, d)
   4.222 +        d1.addErrback(d.errback)
   4.223 +        self.send_be_vbd_create(response=d1)
   4.224 +        
   4.225 +    def send_be_vbd_create(self, response=None):
   4.226 +        msg = packMsg('blkif_be_vbd_create_t',
   4.227 +                      { 'domid'        : self.controller.dom,
   4.228 +                        'blkif_handle' : self.controller.handle,
   4.229 +                        'vdevice'      : self.vdev,
   4.230 +                        'readonly'     : self.readonly() })
   4.231 +        self.getBackendController().writeRequest(msg, response=response)
   4.232 +        
   4.233 +    def respond_be_vbd_create(self, msg, d):
   4.234 +        """Response handler for a be_vbd_create message.
   4.235 +        Tries to grow the vbd.
   4.236 +
   4.237 +        @param msg: message
   4.238 +        @type  msg: xu message
   4.239 +        @param d: deferred to call
   4.240 +        @type  d: Deferred
   4.241 +        """
   4.242 +        val = unpackMsg('blkif_be_vbd_create_t', msg)
   4.243 +        d1 = defer.Deferred()
   4.244 +        d1.addCallback(self.respond_be_vbd_grow, d)
   4.245 +        if d: d1.addErrback(d.errback)
   4.246 +        self.send_be_vbd_grow(response=d1)
   4.247 +    
   4.248 +    def send_be_vbd_grow(self, response=None):
   4.249 +        msg = packMsg('blkif_be_vbd_grow_t',
   4.250 +                      { 'domid'                : self.controller.dom,
   4.251 +                        'blkif_handle'         : self.controller.handle,
   4.252 +                        'vdevice'              : self.vdev,
   4.253 +                        'extent.device'        : self.device,
   4.254 +                        'extent.sector_start'  : self.start_sector,
   4.255 +                        'extent.sector_length' : self.nr_sectors })
   4.256 +        self.getBackendController().writeRequest(msg, response=response)
   4.257 +
   4.258 +    def respond_be_vbd_grow(self, msg, d):
   4.259 +        """Response handler for a be_vbd_grow message.
   4.260 +
   4.261 +        @param msg: message
   4.262 +        @type  msg: xu message
   4.263 +        @param d: deferred to call
   4.264 +        @type  d: Deferred or None
   4.265 +        """
   4.266 +        val = unpackMsg('blkif_be_vbd_grow_t', msg)
   4.267 +	status = val['status']
   4.268 +	if status != BLKIF_BE_STATUS_OKAY:
   4.269 +            err = XendError("Adding extent to vbd failed: device %d, error %d"
   4.270 +                            % (self.vdev, status))
   4.271 +            #if(d):
   4.272 +            #    d.errback(err)
   4.273 +            raise err
   4.274 +        if d:
   4.275 +            d.callback(self)
   4.276 +
   4.277 +    def send_be_vbd_destroy(self, response=None):
   4.278 +        log.debug('>BlkDev>send_be_vbd_destroy> dom=%d vdev=%d',
   4.279 +                  self.controller.dom, self.vdev)
   4.280 +        msg = packMsg('blkif_be_vbd_destroy_t',
   4.281 +                      { 'domid'                : self.controller.dom,
   4.282 +                        'blkif_handle'         : self.controller.handle,
   4.283 +                        'vdevice'              : self.vdev })
   4.284 +        self.controller.delDevice(self.vdev)
   4.285 +        self.getBackendController().writeRequest(msg, response=response)
   4.286 +        
   4.287          
   4.288  class BlkifController(controller.SplitController):
   4.289      """Block device interface controller. Handles all block devices
   4.290 @@ -268,6 +204,10 @@ class BlkifController(controller.SplitCo
   4.291      """
   4.292      
   4.293      def __init__(self, factory, dom, backend):
   4.294 +        """Create a block device controller.
   4.295 +        The controller must be connected using connect() before it can be used.
   4.296 +        Do not call directly - use createInstance() on the factory instead.
   4.297 +        """
   4.298          controller.SplitController.__init__(self, factory, dom, backend)
   4.299          self.devices = {}
   4.300          self.addMethod(CMSG_BLKIF_FE,
   4.301 @@ -276,7 +216,7 @@ class BlkifController(controller.SplitCo
   4.302          self.addMethod(CMSG_BLKIF_FE,
   4.303                         CMSG_BLKIF_FE_INTERFACE_CONNECT,
   4.304                         self.recv_fe_interface_connect)
   4.305 -        self.attached = 1
   4.306 +        self.handle = 0
   4.307          self.evtchn = None
   4.308          self.registerChannel()
   4.309  
   4.310 @@ -311,6 +251,10 @@ class BlkifController(controller.SplitCo
   4.311          self.devices[vdev] = dev
   4.312          return dev
   4.313  
   4.314 +    def delDevice(self, vdev):
   4.315 +        if vdev in self.devices:
   4.316 +            del self.devices[vdev]
   4.317 +
   4.318      def attachDevice(self, vdev, mode, segment, recreate=0):
   4.319          """Attach a device to the specified interface.
   4.320          On success the returned deferred will be called with the device.
   4.321 @@ -332,63 +276,75 @@ class BlkifController(controller.SplitCo
   4.322          if recreate:
   4.323              d.callback(dev)
   4.324          else:
   4.325 -            d1 = defer.Deferred()
   4.326 -            d1.addCallback(self.backendController.respond_be_vbd_create, dev, d)
   4.327 -            d1.addErrback(d.errback)
   4.328 -            self.send_be_vbd_create(vdev, response=d1)
   4.329 +            dev.attach(d)
   4.330          return d
   4.331  
   4.332      def destroy(self):
   4.333 -        def cb_destroy(val):
   4.334 -            self.send_be_destroy()
   4.335 +        """Destroy the controller and all devices.
   4.336 +        """
   4.337          log.debug("Destroying blkif domain=%d", self.dom)
   4.338 -        d = defer.Deferred()
   4.339 -        d.addCallback(cb_destroy)
   4.340 -        self.send_be_disconnect(response=d)
   4.341 +        self.destroyDevices()
   4.342 +        self.disconnect()
   4.343  
   4.344      def destroyDevices(self):
   4.345 +        """Destroy all devices.
   4.346 +        """
   4.347          for dev in self.getDevices():
   4.348              dev.destroy()
   4.349  
   4.350 -    def detach(self):
   4.351 -        """Detach all devices, when the back-end control domain has changed.
   4.352 -        """
   4.353 -        self.attached = 0
   4.354 -        for dev in self.devices.values():
   4.355 -            dev.attached = 0
   4.356 -            d1 = defer.Deferred()
   4.357 -            d1.addCallback(self.backendController.respond_be_vbd_create, None, None)
   4.358 -            self.send_be_vbd_create(vdev, response=d1)
   4.359 +    def connect(self, recreate=0):
   4.360 +        """Connect the controller to the blkif control interface.
   4.361  
   4.362 -    def reattachDevice(self, vdev):
   4.363 -        """Reattach a device, when the back-end control domain has changed.
   4.364 +        @param recreate: true if after xend restart
   4.365 +        @return: deferred
   4.366          """
   4.367 -        dev = self.devices[vdev]
   4.368 -        dev.attached = 1
   4.369 -        attached = 1
   4.370 -        for dev in self.devices.values():
   4.371 -            if not dev.attached:
   4.372 -                attached = 0
   4.373 -                break
   4.374 -        self.attached = attached
   4.375 -        return self.attached
   4.376 +        log.debug("Connecting blkif domain=%d", self.dom)
   4.377 +        d = defer.Deferred()
   4.378 +        if recreate:
   4.379 +            d.callback(self)
   4.380 +        else:
   4.381 +            def cbresp(msg):
   4.382 +                return self
   4.383 +            d.addCallback(cbresp)
   4.384 +            self.send_be_create(response=d)
   4.385 +        return d
   4.386 +        
   4.387 +    def send_be_create(self, response=None):
   4.388 +        msg = packMsg('blkif_be_create_t',
   4.389 +                      { 'domid'        : self.dom,
   4.390 +                        'blkif_handle' : self.handle })
   4.391 +        self.backendController.writeRequest(msg, response=response)
   4.392 +    
   4.393 +    def disconnect(self):
   4.394 +        """Disconnect from the blkif control interface and destroy it.
   4.395 +        """
   4.396 +        def cb_destroy(val):
   4.397 +            self.send_be_destroy()
   4.398 +        d = defer.Deferred()
   4.399 +        d.addCallback(cb_destroy)
   4.400 +        self.send_be_disconnect(response=d)
   4.401 +        
   4.402 +    def send_be_disconnect(self, response=None):
   4.403 +        log.debug('>BlkifController>send_be_disconnect> dom=%d', self.dom)
   4.404 +        msg = packMsg('blkif_be_disconnect_t',
   4.405 +                      { 'domid'        : self.dom,
   4.406 +                        'blkif_handle' : self.handle })
   4.407 +        self.backendController.writeRequest(msg, response=response)
   4.408  
   4.409 -    def reattached(self):
   4.410 -        """All devices have been reattached after the back-end control
   4.411 -        domain has changed.
   4.412 -        """
   4.413 -        msg = packMsg('blkif_fe_interface_status_changed_t',
   4.414 -                      { 'handle' : 0,
   4.415 -                        'status' : BLKIF_INTERFACE_STATUS_DISCONNECTED})
   4.416 -        self.writeRequest(msg)
   4.417 -
   4.418 +    def send_be_destroy(self, response=None):
   4.419 +        log.debug('>BlkifController>send_be_destroy> dom=%d', self.dom)
   4.420 +        msg = packMsg('blkif_be_destroy_t',
   4.421 +                      { 'domid'        : self.dom,
   4.422 +                        'blkif_handle' : self.handle })
   4.423 +        self.backendController.writeRequest(msg, response=response)
   4.424 +        
   4.425      def recv_fe_driver_status_changed(self, msg, req):
   4.426          msg = packMsg('blkif_fe_interface_status_changed_t',
   4.427 -                      { 'handle' : 0,
   4.428 +                      { 'handle' : self.handle,
   4.429                          'status' : BLKIF_INTERFACE_STATUS_DISCONNECTED,
   4.430                          'evtchn' : 0 })
   4.431          self.writeRequest(msg)
   4.432 -    
   4.433 +
   4.434      def recv_fe_interface_connect(self, msg, req):
   4.435          val = unpackMsg('blkif_fe_interface_connect_t', msg)
   4.436          self.evtchn = channel.eventChannel(0, self.dom)
   4.437 @@ -400,63 +356,23 @@ class BlkifController(controller.SplitCo
   4.438                          'evtchn'       : self.evtchn['port1'],
   4.439                          'shmem_frame'  : val['shmem_frame'] })
   4.440          d = defer.Deferred()
   4.441 -        d.addCallback(self.backendController.respond_be_connect)
   4.442 +        d.addCallback(self.respond_be_connect)
   4.443          self.backendController.writeRequest(msg, response=d)
   4.444  
   4.445 +    def respond_be_connect(self, msg):
   4.446 +        """Response handler for a be_connect message.
   4.447 +
   4.448 +        @param msg: message
   4.449 +        @type  msg: xu message
   4.450 +        """
   4.451 +        val = unpackMsg('blkif_be_connect_t', msg)
   4.452 +        self.send_fe_interface_status_changed()
   4.453 +            
   4.454      def send_fe_interface_status_changed(self, response=None):
   4.455          msg = packMsg('blkif_fe_interface_status_changed_t',
   4.456 -                      { 'handle' : 0,
   4.457 +                      { 'handle' : self.handle,
   4.458                          'status' : BLKIF_INTERFACE_STATUS_CONNECTED,
   4.459                          'evtchn' : self.evtchn['port2'] })
   4.460          self.writeRequest(msg, response=response)
   4.461 -
   4.462 -    def send_be_create(self, response=None):
   4.463 -        msg = packMsg('blkif_be_create_t',
   4.464 -                      { 'domid'        : self.dom,
   4.465 -                        'blkif_handle' : 0 })
   4.466 -        self.backendController.writeRequest(msg, response=response)
   4.467 -
   4.468 -    def send_be_disconnect(self, response=None):
   4.469 -        log.debug('>BlkifController>send_be_disconnect> dom=%d', self.dom)
   4.470 -        msg = packMsg('blkif_be_disconnect_t',
   4.471 -                      { 'domid'        : self.dom,
   4.472 -                        'blkif_handle' : 0 })
   4.473 -        self.backendController.writeRequest(msg, response=response)
   4.474 -
   4.475 -    def send_be_destroy(self, response=None):
   4.476 -        log.debug('>BlkifController>send_be_destroy> dom=%d', self.dom)
   4.477 -        msg = packMsg('blkif_be_destroy_t',
   4.478 -                      { 'domid'        : self.dom,
   4.479 -                        'blkif_handle' : 0 })
   4.480 -        self.backendController.writeRequest(msg, response=response)
   4.481 +    
   4.482  
   4.483 -    def send_be_vbd_create(self, vdev, response=None):
   4.484 -        dev = self.devices[vdev]
   4.485 -        msg = packMsg('blkif_be_vbd_create_t',
   4.486 -                      { 'domid'        : self.dom,
   4.487 -                        'blkif_handle' : 0,
   4.488 -                        'vdevice'      : dev.vdev,
   4.489 -                        'readonly'     : dev.readonly() })
   4.490 -        self.backendController.writeRequest(msg, response=response)
   4.491 -        
   4.492 -    def send_be_vbd_grow(self, vdev, response=None):
   4.493 -        dev = self.devices[vdev]
   4.494 -        msg = packMsg('blkif_be_vbd_grow_t',
   4.495 -                      { 'domid'                : self.dom,
   4.496 -                        'blkif_handle'         : 0,
   4.497 -                        'vdevice'              : dev.vdev,
   4.498 -                        'extent.device'        : dev.device,
   4.499 -                        'extent.sector_start'  : dev.start_sector,
   4.500 -                        'extent.sector_length' : dev.nr_sectors })
   4.501 -        self.backendController.writeRequest(msg, response=response)
   4.502 -
   4.503 -    def send_be_vbd_destroy(self, vdev, response=None):
   4.504 -        log.debug('>BlkifController>send_be_vbd_destroy> dom=%d vdev=%d', self.dom, vdev)
   4.505 -        dev = self.devices[vdev]
   4.506 -        msg = packMsg('blkif_be_vbd_destroy_t',
   4.507 -                      { 'domid'                : self.dom,
   4.508 -                        'blkif_handle'         : 0,
   4.509 -                        'vdevice'              : dev.vdev })
   4.510 -        del self.devices[vdev]
   4.511 -        self.backendController.writeRequest(msg, response=response)
   4.512 -    
     5.1 --- a/tools/python/xen/xend/server/channel.py	Mon Aug 16 09:59:28 2004 +0000
     5.2 +++ b/tools/python/xen/xend/server/channel.py	Wed Aug 18 09:17:07 2004 +0000
     5.3 @@ -333,13 +333,15 @@ class Channel(BaseChannel):
     5.4          (ty, subty) = self.getMessageType(msg)
     5.5          #todo:  Must respond before writing any more messages.
     5.6          #todo:  Should automate this (respond on write)
     5.7 -        self.port.write_response(msg)
     5.8 +        responded = 0
     5.9          dev = self.getDevice(ty)
    5.10          if dev:
    5.11 -            dev.requestReceived(msg, ty, subty)
    5.12 +            responded = dev.requestReceived(msg, ty, subty)
    5.13          else:
    5.14              print ("requestReceived> No device: Message type %s %d:%d"
    5.15                     % (msgTypeName(ty, subty), ty, subty)), self
    5.16 +        if not responded:
    5.17 +            self.port.write_response(msg)
    5.18  
    5.19      def handleResponses(self):
    5.20          work = 0
     6.1 --- a/tools/python/xen/xend/server/controller.py	Mon Aug 16 09:59:28 2004 +0000
     6.2 +++ b/tools/python/xen/xend/server/controller.py	Wed Aug 18 09:17:07 2004 +0000
     6.3 @@ -125,12 +125,14 @@ class CtrlMsgRcvr:
     6.4          if DEBUG:
     6.5              print 'requestReceived>',
     6.6              printMsg(msg, all=1)
     6.7 +        responded = 0
     6.8          method = self.getMethod(type, subtype)
     6.9          if method:
    6.10 -            method(msg, 1)
    6.11 +            responded = method(msg, 1)
    6.12          elif DEBUG:
    6.13              print ('requestReceived> No handler: Message type %s %d:%d'
    6.14                     % (msgTypeName(type, subtype), type, subtype)), self
    6.15 +        return responded
    6.16          
    6.17      def responseReceived(self, msg, type, subtype):
    6.18          """Dispatch a response to handlers.
     7.1 --- a/tools/python/xen/xend/server/messages.py	Mon Aug 16 09:59:28 2004 +0000
     7.2 +++ b/tools/python/xen/xend/server/messages.py	Wed Aug 18 09:17:07 2004 +0000
     7.3 @@ -215,7 +215,7 @@ def packMsg(ty, params):
     7.4          else:
     7.5              args[k] = v
     7.6      msg = xu.message(major, minor, msgid, args)
     7.7 -    if DEBUG: print '<packMsg', msg.get_header()['id'], ty, params
     7.8 +    if DEBUG: print '<packMsg', msg.get_header()['id'], ty, args
     7.9      return msg
    7.10  
    7.11  def unpackMsg(ty, msg):
    7.12 @@ -231,8 +231,9 @@ def unpackMsg(ty, msg):
    7.13      @rtype: dict
    7.14      """
    7.15      args = msg.get_payload()
    7.16 +    if DEBUG: print '>unpackMsg', args
    7.17      if isinstance(args, types.StringType):
    7.18 -        args = { 'value': args }
    7.19 +        args = {'value': args}
    7.20      else:
    7.21          mac = [0, 0, 0, 0, 0, 0]
    7.22          macs = []
    7.23 @@ -284,5 +285,5 @@ def printMsg(msg, out=sys.stdout, all=0)
    7.24      ty = msgTypeName(major, minor)
    7.25      print >>out, 'message:', 'type=', ty, '%d:%d' % (major, minor), 'id=%d' % msgid
    7.26      if all:
    7.27 -        print >>out, 'payload=', unpackMsg(ty, msg)
    7.28 +        print >>out, 'payload=', msg.get_payload()
    7.29  
     8.1 --- a/tools/python/xen/xend/server/netif.py	Mon Aug 16 09:59:28 2004 +0000
     8.2 +++ b/tools/python/xen/xend/server/netif.py	Wed Aug 18 09:17:07 2004 +0000
     8.3 @@ -27,30 +27,11 @@ class NetifBackendController(controller.
     8.4          self.addMethod(CMSG_NETIF_BE,
     8.5                         CMSG_NETIF_BE_DRIVER_STATUS_CHANGED,
     8.6                         self.recv_be_driver_status_changed)
     8.7 -        self.attached = 1
     8.8          self.registerChannel()
     8.9  
    8.10 -    def respond_be_connect(self, msg):
    8.11 -        val = unpackMsg('netif_be_connect_t', msg)
    8.12 -        dom = val['domid']
    8.13 -        vif = val['netif_handle']
    8.14 -        netif = self.factory.getInstanceByDom(dom)
    8.15 -        if netif:
    8.16 -            netif.send_interface_connected(vif)
    8.17 -        else:
    8.18 -            log.warning("respond_be_connect> unknown vif dom=%d vif=%d", dom, vif)
    8.19 -            pass
    8.20 -
    8.21      def recv_be_driver_status_changed(self, msg, req):
    8.22          val = unpackMsg('netif_be_driver_status_changed_t', msg)
    8.23          status = val['status']
    8.24 -        if status == NETIF_DRIVER_STATUS_UP and not self.attached:
    8.25 -            # If we are not attached the driver domain was changed, and
    8.26 -            # this signals the new driver domain is ready.
    8.27 -            for netif in self.factory.getInstances():
    8.28 -                if netif.backendController == self:
    8.29 -                    netif.reattach_devices()
    8.30 -            self.attached = 1
    8.31  
    8.32  class NetifControllerFactory(controller.SplitControllerFactory):
    8.33      """Factory for creating network interface controllers.
    8.34 @@ -58,7 +39,6 @@ class NetifControllerFactory(controller.
    8.35  
    8.36      def __init__(self):
    8.37          controller.ControllerFactory.__init__(self)
    8.38 -        self.attached = 1
    8.39  
    8.40      def createInstance(self, dom, recreate=0, backend=0):
    8.41          """Create or find the network interface controller for a domain.
    8.42 @@ -95,26 +75,6 @@ class NetifControllerFactory(controller.
    8.43      def createBackendController(self, dom):
    8.44          return NetifBackendController(self, dom)
    8.45  
    8.46 -    def setControlDomain(self, dom, recreate=0):
    8.47 -        """Set the 'back-end' device driver domain.
    8.48 -
    8.49 -        @param dom:     domain
    8.50 -        @param recreate: if true this is a recreate (xend restarted)
    8.51 -        """
    8.52 -        if self.dom == dom: return
    8.53 -        self.deregisterChannel()
    8.54 -        if not recreate:
    8.55 -            self.attached = 0
    8.56 -        self.dom = dom
    8.57 -        self.registerChannel()
    8.58 -
    8.59 -    def getControlDomain(self):
    8.60 -        """Get the domain id of the back-end control domain.
    8.61 -
    8.62 -        @return domain id
    8.63 -        """
    8.64 -        return self.dom
    8.65 -
    8.66  class NetDev(controller.Dev):
    8.67      """Info record for a network device.
    8.68      """
    8.69 @@ -125,6 +85,9 @@ class NetDev(controller.Dev):
    8.70          self.evtchn = None
    8.71          self.configure(config)
    8.72  
    8.73 +    def getBackendController(self):
    8.74 +        return self.controller.backendController
    8.75 +
    8.76      def configure(self, config):
    8.77          self.config = config
    8.78          self.mac = None
    8.79 @@ -205,19 +168,76 @@ class NetDev(controller.Dev):
    8.80          if vnet:
    8.81              vnet.vifctl(op, self.get_vifname(), self.get_mac())
    8.82  
    8.83 +    def attach(self, d):
    8.84 +        print 'attach>', d
    8.85 +        self.send_be_create(response=d)
    8.86 +
    8.87 +    def send_be_create(self, response=None):
    8.88 +        msg = packMsg('netif_be_create_t',
    8.89 +                      { 'domid'        : self.controller.dom,
    8.90 +                        'netif_handle' : self.vif,
    8.91 +                        'mac'          : self.mac })
    8.92 +        self.getBackendController().writeRequest(msg, response=response)
    8.93 +
    8.94      def destroy(self):
    8.95          """Destroy the device's resources and disconnect from the back-end
    8.96          device controller.
    8.97          """
    8.98          def cb_destroy(val):
    8.99 -            self.controller.send_be_destroy(self.vif)
   8.100 +            self.send_be_destroy()
   8.101          log.debug("Destroying vif domain=%d vif=%d", self.controller.dom, self.vif)
   8.102          self.vifctl('down')
   8.103          d = defer.Deferred()
   8.104          d.addCallback(cb_destroy)
   8.105 -        self.controller.send_be_disconnect(self.vif, response=d)
   8.106 +        self.send_be_disconnect(response=d)
   8.107 +
   8.108 +    def send_be_disconnect(self, response=None):
   8.109 +        msg = packMsg('netif_be_disconnect_t',
   8.110 +                      { 'domid'        : self.controller.dom,
   8.111 +                        'netif_handle' : self.vif })
   8.112 +        self.getBackendController().writeRequest(msg, response=response)
   8.113 +
   8.114 +    def send_be_destroy(self, response=None):
   8.115 +        msg = packMsg('netif_be_destroy_t',
   8.116 +                      { 'domid'        : self.controller.dom,
   8.117 +                        'netif_handle' : self.vif })
   8.118 +        self.controller.delDevice(self.vif)
   8.119 +        self.getBackendController().writeRequest(msg, response=response)
   8.120 +    
   8.121 +    def recv_fe_interface_connect(self, val, req):
   8.122 +        if not req: return
   8.123 +        self.evtchn = channel.eventChannel(0, self.controller.dom)
   8.124 +        msg = packMsg('netif_be_connect_t',
   8.125 +                      { 'domid'          : self.controller.dom,
   8.126 +                        'netif_handle'   : self.vif,
   8.127 +                        'evtchn'         : self.evtchn['port1'],
   8.128 +                        'tx_shmem_frame' : val['tx_shmem_frame'],
   8.129 +                        'rx_shmem_frame' : val['rx_shmem_frame'] })
   8.130 +        d = defer.Deferred()
   8.131 +        d.addCallback(self.respond_be_connect)
   8.132 +        self.getBackendController().writeRequest(msg, response=d)
   8.133          
   8.134 +    def respond_be_connect(self, msg):
   8.135 +        val = unpackMsg('netif_be_connect_t', msg)
   8.136 +        dom = val['domid']
   8.137 +        vif = val['netif_handle']
   8.138 +        print 'respond_be_connect>', '     dom=', dom, '     vif=', vif
   8.139 +        print 'respond_be_connect>', 'self.dom=', self.controller.dom, 'self.vif=', self.vif
   8.140 +        msg = packMsg('netif_fe_interface_status_changed_t',
   8.141 +                      { 'handle' : self.vif,
   8.142 +                        'status' : NETIF_INTERFACE_STATUS_CONNECTED,
   8.143 +                        'evtchn' : self.evtchn['port2'],
   8.144 +                        'mac'    : self.mac })
   8.145 +        self.controller.writeRequest(msg)
   8.146  
   8.147 +    def attach_fe_device(self):
   8.148 +        msg = packMsg('netif_fe_interface_status_changed_t',
   8.149 +                      { 'handle' : self.vif,
   8.150 +                        'status' : NETIF_INTERFACE_STATUS_DISCONNECTED,
   8.151 +                        'evtchn' : 0,
   8.152 +                        'mac'    : self.mac })
   8.153 +        self.controller.writeRequest(msg)
   8.154 +        
   8.155  class NetifController(controller.SplitController):
   8.156      """Network interface controller. Handles all network devices for a domain.
   8.157      """
   8.158 @@ -266,6 +286,10 @@ class NetifController(controller.SplitCo
   8.159          self.devices[vif] = dev
   8.160          return dev
   8.161  
   8.162 +    def delDevice(self, vif):
   8.163 +        if vif in self.devices:
   8.164 +            del self.devices[vif]
   8.165 +
   8.166      def destroy(self):
   8.167          """Destroy the controller and all devices.
   8.168          """
   8.169 @@ -285,79 +309,29 @@ class NetifController(controller.SplitCo
   8.170          @param recreate: recreate flag (true after xend restart)
   8.171          @return: deferred
   8.172          """
   8.173 -        self.addDevice(vif, config)
   8.174 +        dev = self.addDevice(vif, config)
   8.175          d = defer.Deferred()
   8.176          if recreate:
   8.177              d.callback(self)
   8.178          else:
   8.179 -            self.send_be_create(vif, response=d)
   8.180 +            dev.attach(d)
   8.181          return d
   8.182  
   8.183 -    def reattach_devices(self):
   8.184 -        """Reattach all devices when the back-end control domain has changed.
   8.185 -        """
   8.186 -        self.send_be_create(vif)
   8.187 -        self.attach_fe_devices()
   8.188 -
   8.189 -    def attach_fe_devices(self):
   8.190 -        for dev in self.devices.values():
   8.191 -            msg = packMsg('netif_fe_interface_status_changed_t',
   8.192 -                          { 'handle' : dev.vif,
   8.193 -                            'status' : NETIF_INTERFACE_STATUS_DISCONNECTED,
   8.194 -                            'evtchn' : 0,
   8.195 -                            'mac'    : dev.mac })
   8.196 -            self.writeRequest(msg)
   8.197 -    
   8.198      def recv_fe_driver_status_changed(self, msg, req):
   8.199          if not req: return
   8.200          msg = packMsg('netif_fe_driver_status_changed_t',
   8.201                        { 'status'        : NETIF_DRIVER_STATUS_UP,
   8.202                          'nr_interfaces' : len(self.devices) })
   8.203          self.writeRequest(msg)
   8.204 -        self.attach_fe_devices()
   8.205 -
   8.206 +        for dev in self.devices.values():
   8.207 +            dev.attach_fe_device()
   8.208 +    
   8.209      def recv_fe_interface_connect(self, msg, req):
   8.210          val = unpackMsg('netif_fe_interface_connect_t', msg)
   8.211 -        dev = self.devices[val['handle']]
   8.212 -        dev.evtchn = channel.eventChannel(0, self.dom)
   8.213 -        msg = packMsg('netif_be_connect_t',
   8.214 -                      { 'domid'          : self.dom,
   8.215 -                        'netif_handle'   : dev.vif,
   8.216 -                        'evtchn'         : dev.evtchn['port1'],
   8.217 -                        'tx_shmem_frame' : val['tx_shmem_frame'],
   8.218 -                        'rx_shmem_frame' : val['rx_shmem_frame'] })
   8.219 -        d = defer.Deferred()
   8.220 -        d.addCallback(self.backendController.respond_be_connect)
   8.221 -        self.backendController.writeRequest(msg, response=d)
   8.222 -
   8.223 -    def send_interface_connected(self, vif, response=None):
   8.224 -        dev = self.devices[vif]
   8.225 -        msg = packMsg('netif_fe_interface_status_changed_t',
   8.226 -                      { 'handle' : dev.vif,
   8.227 -                        'status' : NETIF_INTERFACE_STATUS_CONNECTED,
   8.228 -                        'evtchn' : dev.evtchn['port2'],
   8.229 -                        'mac'    : dev.mac })
   8.230 -        self.writeRequest(msg, response=response)
   8.231 +        vif = val['handle']
   8.232 +        dev = self.devices.get(vif)
   8.233 +        if dev:
   8.234 +            dev.recv_fe_interface_connect(val, req)
   8.235 +        else:
   8.236 +            log.error('Received netif_fe_interface_connect for unknown vif: '+vif)
   8.237  
   8.238 -    def send_be_create(self, vif, response=None):
   8.239 -        dev = self.devices[vif]
   8.240 -        msg = packMsg('netif_be_create_t',
   8.241 -                      { 'domid'        : self.dom,
   8.242 -                        'netif_handle' : dev.vif,
   8.243 -                        'mac'          : dev.mac })
   8.244 -        self.backendController.writeRequest(msg, response=response)
   8.245 -
   8.246 -    def send_be_disconnect(self, vif, response=None):
   8.247 -        dev = self.devices[vif]
   8.248 -        msg = packMsg('netif_be_disconnect_t',
   8.249 -                      { 'domid'        : self.dom,
   8.250 -                        'netif_handle' : dev.vif })
   8.251 -        self.backendController.writeRequest(msg, response=response)
   8.252 -
   8.253 -    def send_be_destroy(self, vif, response=None):
   8.254 -        dev = self.devices[vif]
   8.255 -        del self.devices[vif]
   8.256 -        msg = packMsg('netif_be_destroy_t',
   8.257 -                      { 'domid'        : self.dom,
   8.258 -                        'netif_handle' : vif })
   8.259 -        self.backendController.writeRequest(msg, response=response)