jkoelker / quark

This is my fork, Quark is now at https://github.com/rackerlabs/quark
Apache License 2.0
0 stars 2 forks source link

Implemented IP Policies #109

Closed asadoughi closed 11 years ago

asadoughi commented 11 years ago

An IP Policy is defined on a subnet or network definining what IPs to exclude from allocation. From a user perspective an IP Policy looks like the following:

{ "subnet_id": /None, "network_id": /None, "exclude": list of cidrs (e.g. ["0.0.0.0/31", "0.0.0.255/32"]) }

One of "subnet_id" or "network_id" is required. "exclude" is always required. Only create, read, and delete operations are supported.

Only one policy is allowed per network. Thus, if a user would like to "update" the policy on a network they would have to delete an existing policy and create a new one.

If a network's IP policy excludes ranges outside of a subnet's cidr, the IP policy exclusion is only applied as it intersects with the subnet's cidr.

asadoughi commented 11 years ago

Writing some integration tests for krauq, ran into an existing bug, subnet.allocated_ips has been returning 0 or 1, not the count we want. (Bug exists on master).

asadoughi commented 11 years ago

I need to patch in:

I think this is a good first cut to still merge in.

MattDietz commented 11 years ago

Merge conflicted now

asadoughi commented 11 years ago

Don't merge: fixing issues highlighted by integration tests.

asadoughi commented 11 years ago

Issues highlighted by integration tests fixed.