ia64/xen-unstable

changeset 14649:2e05921d4f78

Make network.name_label == bridge name

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author Tom Wilkie <tom.wilkie@gmail.com>
date Thu Mar 29 15:59:53 2007 +0100 (2007-03-29)
parents a9dc65d34b14
children 2ac29d446366
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendNode.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Mar 29 16:18:39 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Mar 29 15:59:53 2007 +0100
     1.3 @@ -1823,9 +1823,6 @@ class XendAPI(object):
     1.4      VM_metrics_attr_rw = []
     1.5      VM_metrics_methods = []
     1.6  
     1.7 -    def VIF_metrics_get_all(self, session):
     1.8 -        return self.VIF_get_all(session)
     1.9 -
    1.10      def _VM_metrics_get(self, _, ref):
    1.11          return XendVMMetrics.get_by_uuid(ref)
    1.12  
    1.13 @@ -2135,6 +2132,9 @@ class XendAPI(object):
    1.14      VIF_metrics_attr_rw = []
    1.15      VIF_metrics_methods = []
    1.16  
    1.17 +    def VIF_metrics_get_all(self, session):
    1.18 +        return self.VIF_get_all(session)
    1.19 +
    1.20      def VIF_metrics_get_record(self, _, ref):
    1.21          vm = XendDomain.instance().get_vm_with_dev_uuid('vif', ref)
    1.22          if not vm:
     2.1 --- a/tools/python/xen/xend/XendNode.py	Thu Mar 29 16:18:39 2007 +0100
     2.2 +++ b/tools/python/xen/xend/XendNode.py	Thu Mar 29 15:59:53 2007 +0100
     2.3 @@ -143,8 +143,14 @@ class XendNode:
     2.4              for net_uuid, network in saved_networks.items():
     2.5                  self.network_create(network, False, net_uuid)
     2.6          else:
     2.7 -            self.network_create({'name_label' : 'net0' }, False)
     2.8 +            bridges = Brctl.get_state().keys()
     2.9 +            for bridge in bridges:
    2.10 +                self.network_create({'name_label' : bridge }, False)
    2.11 +                
    2.12 +        # Get a mapping from interface to bridge
    2.13  
    2.14 +        if_to_br = dict(reduce(lambda ls,(b,ifs):[(i,b) for i in ifs] + ls,
    2.15 +                               Brctl.get_state().items(), []))
    2.16          # initialise PIFs
    2.17          saved_pifs = self.state_store.load_state('pif')
    2.18          if saved_pifs:
    2.19 @@ -174,8 +180,14 @@ class XendNode:
    2.20                                    pif_uuid, pif['network'], exn.pif_uuid)
    2.21          else:
    2.22              for name, mtu, mac in linux_get_phy_ifaces():
    2.23 -                network = self.networks.values()[0]
    2.24 -                self._PIF_create(name, mtu, -1, mac, network, False)
    2.25 +                bridge_name = if_to_br.get(name, None)
    2.26 +                if bridge_name is not None:
    2.27 +                    networks = [network for
    2.28 +                                network in self.networks.values()
    2.29 +                                if network.get_name_label() == bridge_name]
    2.30 +                    if len(networks) > 0:
    2.31 +                        network = networks[0]
    2.32 +                        self._PIF_create(name, mtu, -1, mac, network, False)
    2.33  
    2.34          # initialise storage
    2.35          saved_srs = self.state_store.load_state('sr')