ia64/xen-unstable

changeset 1727:ea24a5b766a2

bitkeeper revision 1.1058 (40ee95423ht4Gq0VKvBW7yu6DP8hZA)

Pass domain name down to vifctl to avoid recursion.
author mjw@wray-m-3.hpl.hp.com
date Fri Jul 09 12:53:22 2004 +0000 (2004-07-09)
parents 1836a17e5c3f
children 52fa3846c70b
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/netif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 09 11:46:12 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 09 12:53:22 2004 +0000
     1.3 @@ -780,7 +780,7 @@ def vm_dev_vif(vm, val, index):
     1.4      defer = xend.netif_dev_create(vm.dom, vif, val, recreate=vm.recreate)
     1.5      def fn(id):
     1.6          dev = xend.netif_dev(vm.dom, vif)
     1.7 -        dev.vifctl('up')
     1.8 +        dev.vifctl('up', vmname=vm.name)
     1.9          vm.add_device('vif', dev)
    1.10          print 'vm_dev_vif> created', dev
    1.11          return id
     2.1 --- a/tools/python/xen/xend/server/netif.py	Fri Jul 09 11:46:12 2004 +0000
     2.2 +++ b/tools/python/xen/xend/server/netif.py	Fri Jul 09 12:53:22 2004 +0000
     2.3 @@ -161,12 +161,9 @@ class NetDev(controller.Dev):
     2.4          """
     2.5          return ':'.join(map(lambda x: "%x" % x, self.mac))
     2.6  
     2.7 -    def vifctl_params(self):
     2.8 -        from xen.xend import XendDomain
     2.9 -        xd = XendDomain.instance()
    2.10 +    def vifctl_params(self, vmname=None):
    2.11          dom = self.controller.dom
    2.12 -        dominfo = xd.domain_get(dom)
    2.13 -        name = (dominfo and dominfo.name) or ('DOM%d' % dom)
    2.14 +        name = vmname or ('DOM%d' % dom)
    2.15          return { 'domain': name,
    2.16                   'vif'   : self.get_vifname(), 
    2.17                   'mac'   : self.get_mac(),
    2.18 @@ -174,10 +171,10 @@ class NetDev(controller.Dev):
    2.19                   'script': self.script,
    2.20                   'ipaddr': self.ipaddr, }
    2.21  
    2.22 -    def vifctl(self, op):
    2.23 +    def vifctl(self, op, vmname=None):
    2.24          """Bring the device up or down.
    2.25          """
    2.26 -        Vifctl.vifctl(op, **self.vifctl_params())
    2.27 +        Vifctl.vifctl(op, **self.vifctl_params(vmname=vmname))
    2.28  
    2.29      def destroy(self):
    2.30          """Destroy the device's resources and disconnect from the back-end
    2.31 @@ -186,7 +183,6 @@ class NetDev(controller.Dev):
    2.32          def cb_destroy(val):
    2.33              self.controller.send_be_destroy(self.vif)
    2.34          self.vifctl('down')
    2.35 -        #d = self.controller.factory.addDeferred()
    2.36          d = defer.Deferred()
    2.37          d.addCallback(cb_destroy)
    2.38          self.controller.send_be_disconnect(self.vif, response=d)
    2.39 @@ -272,7 +268,6 @@ class NetifController(controller.Control
    2.40      def reattach_devices(self):
    2.41          """Reattach all devices when the back-end control domain has changed.
    2.42          """
    2.43 -        #d = self.factory.addDeferred()
    2.44          self.send_be_create(vif)
    2.45          self.attach_fe_devices()
    2.46