ia64/xen-unstable

changeset 1584:07af9a3715e2

bitkeeper revision 1.1010.1.8 (40dc2c36FrgEuHCnSupH0LDIdB4C4Q)

Change blkif, netif destroy to send disconnect first.
author mjw@wray-m-3.hpl.hp.com
date Fri Jun 25 13:44:22 2004 +0000 (2004-06-25)
parents fdcfd59a93e8
children cb0967db88bc
files tools/xenmgr/lib/server/blkif.py tools/xenmgr/lib/server/messages.py tools/xenmgr/lib/server/netif.py
line diff
     1.1 --- a/tools/xenmgr/lib/server/blkif.py	Fri Jun 25 13:19:35 2004 +0000
     1.2 +++ b/tools/xenmgr/lib/server/blkif.py	Fri Jun 25 13:44:22 2004 +0000
     1.3 @@ -215,8 +215,12 @@ class BlkifController(controller.Control
     1.4  
     1.5      def destroy(self):
     1.6          print 'BlkifController>destroy> dom=', self.dom
     1.7 -        self.destroyDevices()
     1.8 -        self.send_be_destroy()
     1.9 +        def cb_destroy(val):
    1.10 +            self.send_be_destroy()
    1.11 +        d = self.factory.addDeferred()
    1.12 +        d.addCallback(cb_destroy)
    1.13 +        self.send_be_disconnect()
    1.14 +        #self.destroyDevices()
    1.15  
    1.16      def destroyDevices(self):
    1.17          for dev in self.getDevices():
    1.18 @@ -290,6 +294,13 @@ class BlkifController(controller.Control
    1.19                          'blkif_handle' : 0 })
    1.20          self.factory.writeRequest(msg)
    1.21  
    1.22 +    def send_be_disconnect(self):
    1.23 +        print '>BlkifController>send_be_disconnect>', 'dom=', self.dom
    1.24 +        msg = packMsg('blkif_be_disconnect_t',
    1.25 +                      { 'domid'        : self.dom,
    1.26 +                        'blkif_handle' : 0 })
    1.27 +        self.factory.writeRequest(msg)
    1.28 +
    1.29      def send_be_destroy(self):
    1.30          print '>BlkifController>send_be_destroy>', 'dom=', self.dom
    1.31          msg = packMsg('blkif_be_destroy_t',
     2.1 --- a/tools/xenmgr/lib/server/messages.py	Fri Jun 25 13:19:35 2004 +0000
     2.2 +++ b/tools/xenmgr/lib/server/messages.py	Fri Jun 25 13:44:22 2004 +0000
     2.3 @@ -67,6 +67,9 @@ blkif_formats = {
     2.4      'blkif_be_create_t':
     2.5      (CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE),
     2.6  
     2.7 +    'blkif_be_disconnect_t':
     2.8 +    (CMSG_BLKIF_BE, CMSG_BLKIF_BE_DISCONNECT),
     2.9 +
    2.10      'blkif_be_destroy_t':
    2.11      (CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY),
    2.12  
    2.13 @@ -123,12 +126,12 @@ netif_formats = {
    2.14      'netif_be_create_t':
    2.15      (CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE),
    2.16  
    2.17 +    'netif_be_disconnect_t':
    2.18 +    (CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT),
    2.19 +
    2.20      'netif_be_destroy_t':
    2.21      (CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY),
    2.22  
    2.23 -    'netif_be_disconnect_t':
    2.24 -    (CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT),
    2.25 -
    2.26      'netif_be_driver_status_changed_t':
    2.27      (CMSG_NETIF_BE, CMSG_NETIF_BE_DRIVER_STATUS_CHANGED),
    2.28  
     3.1 --- a/tools/xenmgr/lib/server/netif.py	Fri Jun 25 13:19:35 2004 +0000
     3.2 +++ b/tools/xenmgr/lib/server/netif.py	Fri Jun 25 13:44:22 2004 +0000
     3.3 @@ -137,10 +137,15 @@ class NetDev(controller.Dev):
     3.4          self.bridge = None
     3.5  
     3.6      def destroy(self):
     3.7 +        def cb_destroy(val):
     3.8 +            self.controller.send_be_destroy(self.vif)
     3.9          print 'NetDev>destroy>', 'vif=', self.vif
    3.10          PrettyPrint.prettyprint(self.sxpr())
    3.11          self.bridge_rem()
    3.12 -        self.controller.send_be_destroy(self.vif)
    3.13 +        d = self.controller.factory.addDeferred()
    3.14 +        d.addCallback(cb_destroy)
    3.15 +        self.controller.send_be_disconnect(self.vif)
    3.16 +        #self.controller.send_be_destroy(self.vif)
    3.17          
    3.18  
    3.19  class NetifController(controller.Controller):
    3.20 @@ -281,6 +286,13 @@ class NetifController(controller.Control
    3.21                          'mac'          : dev.mac })
    3.22          self.factory.writeRequest(msg)
    3.23  
    3.24 +    def send_be_disconnect(self, vif):
    3.25 +        dev = self.devices[vif]
    3.26 +        msg = packMsg('netif_be_disconnect_t',
    3.27 +                      { 'domid'        : self.dom,
    3.28 +                        'netif_handle' : dev.vif })
    3.29 +        self.factory.writeRequest(msg)
    3.30 +
    3.31      def send_be_destroy(self, vif):
    3.32          print 'NetifController>send_be_destroy>', 'dom=', self.dom, 'vif=', vif
    3.33          PrettyPrint.prettyprint(self.sxpr())