Commit 441610ab authored by Dionysis Grigoropoulos's avatar Dionysis Grigoropoulos
Browse files

cyclades: Fix bugs in port creation

* Fix the name of a port not being saved
* Check the length of the name of a port is within acceptable limits
parent 771d47b4
......@@ -166,7 +166,7 @@ def create_port(request):
sg_list.append(sg)
new_port = servers.create_port(user_id, network, use_ipaddress=ipaddress,
machine=vm)
machine=vm, name=name)
response = render_port(request, port_to_dict(new_port), status=201)
......
......@@ -799,9 +799,9 @@ class NetworkInterface(models.Model):
NETWORK_IFACE_NAME_LENGTH = 128
name = models.CharField('NIC name', max_length=128, null=True, default="")
userid = models.CharField("UUID of the owner",
max_length=NETWORK_IFACE_NAME_LENGTH,
name = models.CharField('NIC name', max_length=NETWORK_IFACE_NAME_LENGTH,
null=True, default="")
userid = models.CharField("UUID of the owner", max_length=128,
null=False, db_index=True)
machine = models.ForeignKey(VirtualMachine, related_name='nics',
on_delete=models.PROTECT, null=True)
......
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