'ValidationError' object has no attribute 'error_dict' when creating a network

Bug #1299114 reported by Dimiter Naydenov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Jeroen T. Vermeulen

Bug Description

I can't add a network either through the web UI or using the maas CLI. I'm getting this exception:

AttributeError: 'ValidationError' object has no attribute 'error_dict'

I can edit or delete an existing network OK, just can't add.

I'm running MAAS 1.5 r2188 from the daily ppa, on trusty, upgraded from precise.
I have installed maas (both RC and CC) on a KVM amd64 machine with 20GB disk and 1GB RAM. I also have 4 enlisted nodes (in Ready state), also KVM based.

Output from dpkg -l '*maas*'|cat:
http://paste.ubuntu.com/7169432/

Contents of /var/log/maas/* is attached.

Tags: api cli

Related branches

Revision history for this message
Dimiter Naydenov (dimitern) wrote :
Gavin Panella (allenap)
Changed in maas:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
Gavin Panella (allenap) wrote :

Dimiter, I can't reproduce this. Can you check that all dependencies on the machine are up-to-date?

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

I did apt-get update & upgrade and still get the same issue. Did some search for this issue in django (v1.6.1) bugs, but nothing definite. What info will be useful? I suppose I can try uploading the machine and its disk image to U1 so you can try it, along with the setup that's needed..

Revision history for this message
Gavin Panella (allenap) wrote :

Uploading the disk image sounds like a pain, but it would be massively useful.

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

I'm preparing the upload and will post links as it's done.

I took me 3h just to tar.bz2 the disk image (21GB down to around 10GB).

Revision history for this message
Raphaël Badin (rvb) wrote :

Can't reproduced this either. Using a dev instance, I ran the command Dimiter gave me and it didn't crash:
$ ./bin/maas maas networks create name=main ip=192.168.50.0 netmask=255.255.255.0 description="Main MAAS network"
{
    "description": "Main MAAS network",
    "ip": "192.168.50.0",
    "netmask": "255.255.255.0",
    "vlan_tag": null,
    "resource_uri": "/api/1.0/networks/main/",
    "name": "main"
}

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

I gave up trying to upload that 8.5GB image to U1.

However, I managed to find a probable cause:
http://paste.ubuntu.com/7188828/

As you can see, before trying to add "main" I had 2 networks - "net1" (192.168.111.0/24) and "vlan0" (192.168.50.0/30). The cluster controller has 3 NICs: 1 unmanaged and unconfigured (lo), 1 managed (dhcp+dns) 192.168.50.0/24 (eth0) and another managed (dhcp+dns) 192.168.111.0/24 (eth1). Trying to add a new "main" network with the same IP (network) address 192.168.50.0 fails with the above error. I successfully added a "main1" with the same net address, but a different subnet (255.255.255.252), but failed adding it before changing the name (it said {"name": ["Network with this Name already exists."]}).

So it seems the validation error is correct, but not user-friendly :)

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

In theory we do not allow multiple networks with overlapping (i.e. identical or nested) address ranges. In the model code, Network.validate_unique checks against such clashes, and raises a ValidationError. Maybe this needs to be a different, more specific error; or maybe the form code needs to catch the ValidationError and attach the error to a specific field.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Got it. This doesn't become clear in the documentation as far as I can see, and even runs counter to the examples, but when validate_unique raises a ValidationError, it has to be one that was constructed from a messages dict! If not, kaboom inside Django.

Changed in maas:
assignee: nobody → Jeroen T. Vermeulen (jtv)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.