Big pep8 cleanup
This commit is contained in:
		| @@ -69,7 +69,8 @@ class TagAssociation(BASEV2, HasId): | ||||
| class Tag(BASEV2, HasId, HasTenant): | ||||
|     __tablename__ = "quark_tags" | ||||
|     association_uuid = sa.Column(sa.String(36), | ||||
|                        sa.ForeignKey(TagAssociation.id), nullable=False) | ||||
|                                  sa.ForeignKey(TagAssociation.id), | ||||
|                                  nullable=False) | ||||
|  | ||||
|     tag = sa.Column(sa.String(255), nullable=False) | ||||
|     parent = associationproxy.association_proxy("association", "parent") | ||||
| @@ -208,8 +209,8 @@ class Port(BASEV2, CreatedAt, HasId, HasTenant): | ||||
| class MacAddress(BASEV2, CreatedAt, HasTenant): | ||||
|     __tablename__ = "quark_mac_addresses" | ||||
|     address = sa.Column(sa.BigInteger(), primary_key=True) | ||||
|     mac_address_range_id = sa.Column(sa.String(36), | ||||
|                                 sa.ForeignKey("quark_mac_address_ranges.id"), | ||||
|     mac_address_range_id = sa.Column( | ||||
|         sa.String(36), sa.ForeignKey("quark_mac_address_ranges.id"), | ||||
|         nullable=False) | ||||
|     deallocated = sa.Column(sa.Boolean()) | ||||
|     deallocated_at = sa.Column(sa.DateTime()) | ||||
|   | ||||
| @@ -224,8 +224,7 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): | ||||
|         LOG.info("get_subnet %s for tenant %s with fields %s" % | ||||
|                 (id, context.tenant_id, fields)) | ||||
|         subnet = context.session.query(models.Subnet).\ | ||||
|                     filter(models.Subnet.id == id).\ | ||||
|                     first() | ||||
|             filter(models.Subnet.id == id).first() | ||||
|         if not subnet: | ||||
|             raise exceptions.SubnetNotFound(subnet_id=id) | ||||
|  | ||||
| @@ -484,10 +483,8 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): | ||||
|             if not net: | ||||
|                 raise exceptions.NetworkNotFound(net_id=net_id) | ||||
|  | ||||
|             addresses = self.ipam_driver.allocate_ip_address(session, | ||||
|                                                         net_id, | ||||
|                                                         port_id, | ||||
|                                                         self.ipam_reuse_after) | ||||
|             addresses = self.ipam_driver.allocate_ip_address( | ||||
|                 session, net_id, port_id, self.ipam_reuse_after) | ||||
|             mac = self.ipam_driver.allocate_mac_address(session, | ||||
|                                                         net_id, | ||||
|                                                         port_id, | ||||
| @@ -642,9 +639,9 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): | ||||
|  | ||||
|             backend_key = port["backend_key"] | ||||
|             self.ipam_driver.deallocate_mac_address(session, | ||||
|                                                     port["mac_address"],) | ||||
|             self.ipam_driver.deallocate_ip_address(session, id, | ||||
|                         ipam_reuse_after=self.ipam_reuse_after) | ||||
|                                                     port["mac_address"]) | ||||
|             self.ipam_driver.deallocate_ip_address( | ||||
|                 session, id, ipam_reuse_after=self.ipam_reuse_after) | ||||
|             session.delete(port) | ||||
|             self.net_driver.delete_port(context, backend_key) | ||||
|  | ||||
| @@ -657,7 +654,7 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): | ||||
|         LOG.info("create_mac_address_range for tenant %s" % context.tenant_id) | ||||
|         new_range = models.MacAddressRange() | ||||
|         cidr = mac_range["mac_address_range"]["cidr"] | ||||
|         cidr, first_address, last_address = self._to_mac(cidr) | ||||
|         cidr, first_address, last_address = self.bto_mac_range(cidr) | ||||
|         new_range["cidr"] = cidr | ||||
|         new_range["first_address"] = first_address | ||||
|         new_range["last_address"] = last_address | ||||
| @@ -666,7 +663,7 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2): | ||||
|         context.session.flush() | ||||
|         return self._make_mac_range_dict(new_range) | ||||
|  | ||||
|     def _to_mac(self, val): | ||||
|     def _to_mac_range(self, val): | ||||
|         cidr_parts = val.split("/") | ||||
|         prefix = cidr_parts[0] | ||||
|         prefix = prefix.replace(':', '') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matt Dietz
					Matt Dietz