retspen / webvirtcloud

WebVirtCloud is virtualization web interface for admins and users
1.63k stars 362 forks source link

Add compute , then Instances return 500 error. (OperationalError at /instances/,no such column: instances_instance.drbd ) #529

Open smallpize opened 1 year ago

smallpize commented 1 year ago

Create the website as normal,the login is successful。 When I create a compute node through ssh, I switch to Instances and report a 500 error. I use Kylin V10 system (same as openeuler 20.03TLS) as computing node. Compiled against the library: libvirt 6.2.0 Libraries used: libvirt 6.2.0 API used: QEMU 6.2.0 Run the hypervisor: QEMU 4.1.0 but I don't think it's the client compute node's problem. I try to create a user, but also an error is reported. After logging in again, the user information already exists,and use the user login, change to Instances, also error(no such column: instances_instance.drbd). I use kenlee/webvirtcloud-docker create website can add compute and change to Instance successfully.


OperationalError at /instances/ no such column: instances_instance.drbd Request Method: GET Request URL: http://172.30.241.100:80/instances/ Django Version: 3.2.14 Exception Type: OperationalError Exception Value:
no such column: instances_instance.drbd Exception Location: /srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py, line 423, in execute Python Executable: /srv/webvirtcloud/venv/bin/python3 Python Version: 3.6.8 Python Path:
['/srv/webvirtcloud', '/srv/webvirtcloud/venv/bin', '/srv/webvirtcloud/venv/lib64/python36.zip', '/srv/webvirtcloud/venv/lib64/python3.6', '/srv/webvirtcloud/venv/lib64/python3.6/lib-dynload', '/usr/lib64/python3.6', '/usr/lib/python3.6', '/srv/webvirtcloud/venv/lib/python3.6/site-packages'] Server time: Tue, 23 Aug 2022 03:59:59 -0400


Environment:

Request Method: GET Request URL: http://172.30.241.100:80/instances/

Django Version: 3.2.14 Python Version: 3.6.8 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_bootstrap5', 'django_icons', 'django_otp', 'django_otp.plugins.otp_totp', 'accounts', 'admin', 'appsettings', 'computes', 'console', 'datasource', 'networks', 'instances', 'interfaces', 'nwfilters', 'storages', 'virtsecrets', 'logs', 'qr_code'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django_otp.middleware.OTPMiddleware', 'login_required.middleware.LoginRequiredMiddleware', 'django.contrib.auth.middleware.RemoteUserMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'appsettings.middleware.AppSettingsMiddleware', 'webvirtcloud.middleware.ExceptionMiddleware']

Traceback (most recent call last): File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute return Database.Cursor.execute(self, query, params)

The above exception (no such column: instances_instance.drbd) was the direct cause of the following exception: File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/srv/webvirtcloud/instances/views.py", line 47, in index for compute in computes: File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 280, in iter self._fetch_all() File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 1326, in _fetch_all self._prefetch_related_objects() File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 813, in _prefetch_related_objects prefetch_related_objects(self._result_cache, self._prefetch_related_lookups) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 1734, in prefetch_related_objects level, File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 1855, in prefetch_one_level prefetcher.get_prefetch_queryset(instances, lookup.get_current_queryset(level))) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 637, in get_prefetch_queryset for rel_obj in queryset: File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 280, in iter self._fetch_all() File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 1324, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/query.py", line 51, in iter results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql cursor.execute(sql, params) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 98, in execute return super().execute(sql, params) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /instances/ Exception Value: no such column: instances_instance.drbd

catborise commented 1 year ago

did you run python3 manage.py makemigrations; python3 manage.py migrate commands?

smallpize commented 1 year ago

@catborise

did you run python3 manage.py makemigrations; python3 manage.py migrate commands?

I use the scripts install on centos8 , the logs:

catborise commented 1 year ago

you can always run these commands, it does not breaks. may some scripts failed. run;

# Go to Installation Directory
cd /srv/webvirtcloud
source venv/bin/activate
pip3 install -U -r conf/requirements.txt 
python3 manage.py makemigrations
python3 manage.py migrate
smallpize commented 1 year ago

you can always run these commands, it does not breaks. may some scripts failed. run;

# Go to Installation Directory
cd /srv/webvirtcloud
source venv/bin/activate
pip3 install -U -r conf/requirements.txt 
python3 manage.py makemigrations
python3 manage.py migrate

I remove the db.sqlite3 file, and run again, this problem solved. Thanks.