Unable to configure static IP address

Currently evaluating Rockstor in a VMware Workstation virtual machine. Works fine with DHCP but wanted to change to static. All I’ve done is create a data pool. This is the configuration:

When I click submit, an error is thrown: ‘NetworkConnection’ instance needs to have a primary key value before this relationship can be used.

Full traceback:

            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/network.py", line 534, in put
    return Response(NetworkConnectionSerializer(nco).data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/rest_framework/serializers.py", line 571, in data
    ret = super().data
          ^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/rest_framework/serializers.py", line 249, in data
    self._data = self.to_representation(self.instance)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/rest_framework/serializers.py", line 525, in to_representation
    attribute = field.get_attribute(instance)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/rest_framework/fields.py", line 437, in get_attribute
    return get_attribute(instance, self.source_attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/rest_framework/fields.py", line 104, in get_attribute
    instance = getattr(instance, attr)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/src/rockstor/storageadmin/models/network_interface.py", line 81, in ctype
    if self.ethernetconnection_set.count() > 0:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 718, in get_queryset
    raise ValueError(
ValueError: 'NetworkConnection' instance needs to have a primary key value before this relationship can be used.

The workaround was to use nmcli from the shell. Some supplemental information, after I’d tried to change to static in the GUI twice, I ended up with multiple connections in a very confused state! I restored the VM snapshot before using nmcli.

1 Like

@robnicholson welcome to the Rockstor community. It looks like you ran into similar problems as have been reported on the forum previously.

There is an open issue for this particular challenge, especially when using the /24 address format, I believe.

Take a look here:

And there is a corresponding issue on github, which, unfortunately, has not been resolved yet.:

So using nmcli or 'nmtui is currently probably the best choice in that space for now.

2 Likes