Revision 633f6952 snf-cyclades-app/synnefo/neutron/models.py
b/snf-cyclades-app/synnefo/neutron/models.py | ||
---|---|---|
162 | 162 |
return "<Subnet %s>" % str(self.id) |
163 | 163 |
|
164 | 164 |
|
165 |
class SecurityGroup(models.Model): |
|
166 |
name = models.CharField('group name', max_length=128) |
|
167 |
|
|
168 |
|
|
165 | 169 |
class NetworkInterface(models.Model): |
166 | 170 |
STATES = ( |
167 | 171 |
("ACTIVE", "Active"), |
... | ... | |
185 | 189 |
state = models.CharField(max_length=32, null=False, default="ACTIVE", |
186 | 190 |
choices=STATES) |
187 | 191 |
admin_state_up = models.BooleanField(default=False, db_index=True) |
192 |
security_groups = models.ManyToManyField(SecurityGroup, null=True) |
|
193 |
deleted = models.BooleanField('Deleted', default=False, db_index=True) |
|
194 |
objects = ForUpdateManager() |
|
188 | 195 |
|
189 |
def __unicode__(self): |
|
190 |
return "<%s:vm:%s network:%s ipv4:%s ipv6:%s>" % \ |
|
191 |
(self.index, self.machine_id, self.network_id, self.ipv4, |
|
192 |
self.ipv6) |
|
193 |
|
|
194 |
@property |
|
195 |
def is_floating_ip(self): |
|
196 |
network = self.network |
|
197 |
if self.ipv4 and network.floating_ip_pool: |
|
198 |
return network.floating_ips.filter(machine=self.machine, |
|
199 |
ipv4=self.ipv4, |
|
200 |
deleted=False).exists() |
Also available in: Unified diff