Commit ffc55de8 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Bypass commissioning for orphan networks

Cyclades public networks do not have an owner, and since can not use
the commissioning system. Also, make snf-dispatcher instead of failing
for networks without userid to just a log a warning. This does not apply for
API, because all API requests should have a userid.
parent 6646f0ae
......@@ -285,7 +285,7 @@ class VirtualMachine(models.Model):
name = models.CharField('Virtual Machine Name', max_length=255)
userid = models.CharField('User ID of the owner', max_length=100,
db_index=True)
db_index=True, null=False)
backend = models.ForeignKey(Backend, null=True,
related_name="virtual_machines",)
backend_hash = models.CharField(max_length=128, null=True, editable=False)
......
......@@ -265,11 +265,15 @@ def update_network_state(serials, network):
release_resource(res_type="bridge", value=network.link)
# Issue commission
serial = quotas.issue_network_commission(network.userid, delete=True)
serials.append(serial)
network.serial = serial
serial.accepted = True
serial.save()
if network.userid:
serial = quotas.issue_network_commission(network.userid,
delete=True)
serials.append(serial)
network.serial = serial
serial.accepted = True
serial.save()
elif not network.public:
log.warning("Network %s does not have an owner!", network.id)
network.save()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment