Unable to create pools - 3.8.15-11 - ""unsaved related object..."

I have been using Rockstor for about 6 months now with few issues. I decided to do a fresh install and am now regretting it. I’m using an HP N40L, 12GB RAM, booting from 16GB USB flash drive. I did a fresh install from a 3.8.15 ISO and was unable to create a pool using the same 4 disks as before (I think I allowed it to update to 3.8.15-11 first). I used a 3.8.12 ISO and created the same pool without issues, then let it update to 3.8.15-11. At this point I realised I wanted to recreate the pool slightly differently and then hit the same issue of not being able to recreate. Error is below, any suggestions welcome, happy to provide any extra info required. Both times this was a pretty much complete vanilla install, no rockons etc.

 Traceback (most recent call last):

File “/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py”, line 40, in _handle_exception
yield
File “/opt/rockstor/src/rockstor/storageadmin/views/pool.py”, line 268, in post
p.disk_set.add(*disks)
File “/opt/rockstor/eggs/Django-1.8.16-py2.7.egg/django/db/models/fields/related.py”, line 750, in add
obj.save()
File “/opt/rockstor/eggs/Django-1.8.16-py2.7.egg/django/db/models/base.py”, line 685, in save
“unsaved related object ‘%s’.” % field.name
ValueError: save() prohibited to prevent data loss due to unsaved related object ‘pool’.

@rockmar First off welcome to the Rockstor forum and thanks for submitting this report.

From a quick look I would say this is a breakage introduced in 3.8.15-11 where we updated to the new Django 1.8.16 which is apparently more strict on such things:
A similar change that was required at the time in disk.py:

                  p = Pool(name=d.label, raid='single', role='root')
 -                p.disk_set.add(dob)
                  p.save()
 +                p.disk_set.add(dob)
                  # update disk db object to reflect special root pool status

I’m hazarding a guess that a similar change is required in pool.py

I have created an issue to address this problem:

Thanks and nice report by the way.

I will try and re-create the problem here and hopefully a fix should be available shortly.

2 Likes

@rockmar Just a notification:

I managed to reproduce your exact error on a 3.8.15-11 and have now submitted a pull request (a single line addition) and there after we are back to normal function:

This fix should be available in the next testing channel updates release.

2 Likes