def _get_instance_ips(context, instance): ret = [] for network in common.get_networks_for_instance(context, instance).values(): all_ips = itertools.chain(network["ips"], network["floating_ips"]) ret += [ip["address"] for ip in all_ips] return ret
def _get_instance_ips(context, instance): ret = [] for network in common.get_networks_for_instance( context, instance).values(): all_ips = itertools.chain(network["ips"], network["floating_ips"]) ret += [ip["address"] for ip in all_ips] return ret
def show(self, req, server_id, id): context = req.environ["patron.context"] instance = common.get_instance(self._compute_api, context, server_id) networks = common.get_networks_for_instance(context, instance) if id not in networks: msg = _("Instance is not a member of specified network") raise exc.HTTPNotFound(explanation=msg) return self._view_builder.show(networks[id], id)
def _extend_server(self, context, server, instance): key = "%s:type" % Extended_ips.alias networks = common.get_networks_for_instance(context, instance) for label, network in networks.items(): # NOTE(vish): ips are hidden in some states via the # hide_server_addresses extension. if label in server['addresses']: all_ips = itertools.chain(network["ips"], network["floating_ips"]) for i, ip in enumerate(all_ips): server['addresses'][label][i][key] = ip['type']
def _extend_server(self, context, server, instance): key = "%s:mac_addr" % Extended_ips_mac.alias networks = common.get_networks_for_instance(context, instance) for label, network in networks.items(): # NOTE(vish): ips are hidden in some states via the # hide_server_addresses extension. if label in server['addresses']: all_ips = itertools.chain(network["ips"], network["floating_ips"]) for i, ip in enumerate(all_ips): server['addresses'][label][i][key] = ip['mac_address']
def _get_addresses(self, request, instance, extend_address=False): context = request.environ["patron.context"] networks = common.get_networks_for_instance(context, instance) return self._address_builder.index(networks, extend_address)["addresses"]
def index(self, req, server_id): context = req.environ["patron.context"] instance = common.get_instance(self._compute_api, context, server_id) networks = common.get_networks_for_instance(context, instance) return self._view_builder.index(networks)
def _get_addresses(self, request, instance, extend_address=False): context = request.environ["patron.context"] networks = common.get_networks_for_instance(context, instance) return self._address_builder.index(networks, extend_address)["addresses"]