def get_projects(self, uid=None): """Retrieve list of projects""" if uid: result = db.project_get_by_user(context.get_admin_context(), uid) else: result = db.project_get_all(context.get_admin_context()) return [self._db_project_to_auth_projectuser(proj) for proj in result]
def delete_network(self, context, fixed_range, uuid): """Lookup network by uuid, delete both the IPAM subnet and the corresponding Quantum network. The fixed_range parameter is kept here for interface compatibility but is not used. """ quantum_net_id = uuid project_id = context.project_id # TODO(bgh): The project_id isn't getting populated here for some # reason.. I'm not sure if it's an invalid assumption or just a bug. # In order to get the right quantum_net_id we'll have to query all the # project_ids for now. if project_id is None: projects = db.project_get_all(context) for p in projects: if self.q_conn.network_exists(p['id'], uuid): project_id = p['id'] break if project_id is None: # If nothing was found we default to this project_id = FLAGS.quantum_default_tenant_id LOG.debug("Deleting network for tenant: %s" % project_id) self.ipam.delete_subnets_by_net_id(context, quantum_net_id, project_id) q_tenant_id = project_id or FLAGS.quantum_default_tenant_id self.q_conn.delete_network(q_tenant_id, quantum_net_id)
def get_all_networks(self): networks = [] admin_context = context.get_admin_context() networks.extend(self.ipam.get_global_networks(admin_context)) projects = db.project_get_all(admin_context) for p in projects: networks.extend(self.ipam.get_project_networks(admin_context, p['id'])) return networks
def get_all_networks(self): networks = [] admin_context = context.get_admin_context() networks.extend(self.ipam.get_global_networks(admin_context)) projects = db.project_get_all(admin_context) for p in projects: networks.extend( self.ipam.get_project_networks(admin_context, p['id'])) return networks