示例#1
0
    def destroy(self):

        LOG.debug('-' * 80)
        LOG.debug("destroy")
        LOG.debug('-' * 80)

        for h in self._hosts:
            host = h['host']

            # Delete TZ
            if host.get('tunnel_zone'):
                tz_data = host.get('tunnel_zone')
                tzs = self._api.get_tunnel_zones()
                tz = filter(lambda x: x.get_name() == tz_data['name'], tzs)
                # Delete tz, which has(have) the name in the config
                map(lambda x: x.delete(), tz)

            if host['provided'] == True:
                LOG.info('Skipped destroying host=%r', host)
            else:
                #TODO(tomoe): when we support provisioning Midolman host with
                # this tool.
                pass
            interfaces = host['interfaces']

            futures = []
            for i in interfaces:
                iface = Interface(i['interface'], host)
                f = iface.delete()
                futures.append(f)

            wait_on_futures(futures)

        for b in self._bridges:
            bridge = b['bridge']
            # TODO(tomohiko) Need to do something when !host['provided']?
            if host['provided']:
                LOG.info('Skipped destroying bridge=%r', bridge)

        LOG.debug('-' * 80)
        LOG.debug("end destroy")
        LOG.debug('-' * 80)
    def destroy(self):

        LOG.debug("-" * 80)
        LOG.debug("destroy")
        LOG.debug("-" * 80)

        for h in self._hosts:
            host = h["host"]

            # Delete TZ
            if host.get("tunnel_zone"):
                tz_data = host.get("tunnel_zone")
                tzs = self._api.get_tunnel_zones()
                tz = filter(lambda x: x.get_name() == tz_data["name"], tzs)
                # Delete tz, which has(have) the name in the config
                map(lambda x: x.delete(), tz)

            if host["provided"] == True:
                LOG.info("Skipped destroying host=%r", host)
            else:
                # TODO(tomoe): when we support provisioning Midolman host with
                # this tool.
                pass
            interfaces = host["interfaces"]

            futures = []
            for i in interfaces:
                iface = Interface(i["interface"], host)
                f = iface.delete()
                futures.append(f)

            wait_on_futures(futures)

        for b in self._bridges:
            bridge = b["bridge"]
            # TODO(tomohiko) Need to do something when !host['provided']?
            if host["provided"]:
                LOG.info("Skipped destroying bridge=%r", bridge)

        LOG.debug("-" * 80)
        LOG.debug("end destroy")
        LOG.debug("-" * 80)