[GH-ISSUE #336] @real-gecko instances branch issues #215

Closed
opened 2026-02-27 15:57:48 +03:00 by kerem · 68 comments
Owner

Originally created by @catborise on GitHub (Jun 27, 2020).
Original GitHub issue: https://github.com/retspen/webvirtcloud/issues/336

branch real-gecko/instances
@Real-Gecko inbound or outbound qos adding to instance network card does not work.

Originally created by @catborise on GitHub (Jun 27, 2020). Original GitHub issue: https://github.com/retspen/webvirtcloud/issues/336 branch real-gecko/instances @Real-Gecko inbound or outbound qos adding to instance network card does not work.
kerem closed this issue 2026-02-27 15:57:48 +03:00
Author
Owner

@catborise commented on GitHub (Jun 27, 2020):

@Real-Gecko cloning an instance does not work

<!-- gh-comment-id:650565582 --> @catborise commented on GitHub (Jun 27, 2020): @Real-Gecko cloning an instance does not work
Author
Owner

@catborise commented on GitHub (Jun 27, 2020):

@Real-Gecko console does not work. token value is wrong (run console from instance detail)
resim

and console also not working because of similar error (run console from all instances list)
resim

<!-- gh-comment-id:650566256 --> @catborise commented on GitHub (Jun 27, 2020): @Real-Gecko console does not work. token value is wrong (run console from instance detail) ![resim](https://user-images.githubusercontent.com/1725643/85924238-8b9c3a00-b899-11ea-9084-5e607c3e2b47.png) and console also not working because of similar error (run console from all instances list) ![resim](https://user-images.githubusercontent.com/1725643/85924290-0ebd9000-b89a-11ea-9683-3eb104c95b12.png)
Author
Owner

@catborise commented on GitHub (Jun 27, 2020):

@Real-Gecko brief info about ram and cpu does not show
resim

<!-- gh-comment-id:650567071 --> @catborise commented on GitHub (Jun 27, 2020): @Real-Gecko brief info about ram and cpu does not show ![resim](https://user-images.githubusercontent.com/1725643/85924378-973c3080-b89a-11ea-8034-e2225b21ae60.png)
Author
Owner

@catborise commented on GitHub (Jun 27, 2020):

changing instance title&description second time is not working

<!-- gh-comment-id:650569956 --> @catborise commented on GitHub (Jun 27, 2020): changing instance title&description second time is not working
Author
Owner

@catborise commented on GitHub (Jun 27, 2020):

@Real-Gecko regular user(not superuser/staff) cannot pause his instance.
reguler user clone instance does not work also.

<!-- gh-comment-id:650572254 --> @catborise commented on GitHub (Jun 27, 2020): @Real-Gecko regular user(not superuser/staff) cannot pause his instance. reguler user clone instance does not work also.
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

@Real-Gecko inbound or outbound qos adding to instance network card does not work.

Fixed that. 05f1ec179e336a44d4329552d5235da84b404d8f

<!-- gh-comment-id:650898896 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > @Real-Gecko inbound or outbound qos adding to instance network card does not work. Fixed that. 05f1ec179e336a44d4329552d5235da84b404d8f
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

@Real-Gecko cloning an instance does not work

Fixed a060be8ceb8c0d82459eb2a2ff5c00366666bbae

<!-- gh-comment-id:650903005 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > @Real-Gecko cloning an instance does not work Fixed a060be8ceb8c0d82459eb2a2ff5c00366666bbae
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page.
image

<!-- gh-comment-id:650909609 --> @catborise commented on GitHub (Jun 29, 2020): if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page. ![image](https://user-images.githubusercontent.com/1725643/85975364-85fd3c00-b9e0-11ea-8b5a-65b0f6034d38.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page.

Yep, that's because we do not call refresh_instance_database on every compute in allinstances, I'll add it, but it'll slow down the page.
I think all refreshes must be performed on application start and then removed completely from views. If host is controlled only by WVC then no desync will happen. If not then we will have to call refresh every time we go to allinstances/compute instances views.

<!-- gh-comment-id:650910903 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page. Yep, that's because we do not call refresh_instance_database on every compute in allinstances, I'll add it, but it'll slow down the page. I think all refreshes must be performed on application start and then removed completely from views. If host is controlled only by WVC then no desync will happen. If not then we will have to call refresh every time we go to allinstances/compute instances views.
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

console does not work

93c15c806a5ef73620dcaccc6b95189460cc2a42

<!-- gh-comment-id:650912371 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > console does not work 93c15c806a5ef73620dcaccc6b95189460cc2a42
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

info about ram and cpu does not show

bbd770ce9f48e7f9744442f0134b05d949b6b42f

<!-- gh-comment-id:650913168 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > info about ram and cpu does not show bbd770ce9f48e7f9744442f0134b05d949b6b42f
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

selected options does not show
image

image

<!-- gh-comment-id:650921070 --> @catborise commented on GitHub (Jun 29, 2020): selected options does not show ![image](https://user-images.githubusercontent.com/1725643/85976893-302a9300-b9e4-11ea-9b7d-dafdc5081b8b.png) ![image](https://user-images.githubusercontent.com/1725643/85976937-46d0ea00-b9e4-11ea-9143-dffbcd1aefd6.png)
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page.

Yep, that's because we do not call refresh_instance_database on every compute in allinstances, I'll add it, but it'll slow down the page.
I think all refreshes must be performed on application start and then removed completely from views. If host is controlled only by WVC then no desync will happen. If not then we will have to call refresh every time we go to allinstances/compute instances views.

this situation appears not only remove instance manually from libvirt. sometimes some actions raising an exception and prevents removing db records...
we can provide an option to users, wvc control instances strictly or not. if user select instance control strictly from appsettings, wvc checks duplicate instances, refreshing db records everytime, name and uuid control as before.
or
may be we could async batch jobs which updates db records time to time.
beside that we need also some batch implementations: like move all instances to another hosts. shutdown/suspend/restart all instances on a host. live backup. live clone etc.
adding celery to project can help us, isnt it? what do you think?

<!-- gh-comment-id:650925112 --> @catborise commented on GitHub (Jun 29, 2020): > > if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page. > > Yep, that's because we do not call refresh_instance_database on every compute in allinstances, I'll add it, but it'll slow down the page. > I think all refreshes must be performed on application start and then removed completely from views. If host is controlled only by WVC then no desync will happen. If not then we will have to call refresh every time we go to allinstances/compute instances views. this situation appears not only remove instance manually from libvirt. sometimes some actions raising an exception and prevents removing db records... we can provide an option to users, wvc control instances strictly or not. if user select instance control strictly from appsettings, wvc checks duplicate instances, refreshing db records everytime, name and uuid control as before. or may be we could async batch jobs which updates db records time to time. beside that we need also some batch implementations: like move all instances to another hosts. shutdown/suspend/restart all instances on a host. live backup. live clone etc. adding celery to project can help us, isnt it? what do you think?
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

clone instance does not work yet.
image

<!-- gh-comment-id:650944647 --> @catborise commented on GitHub (Jun 29, 2020): clone instance does not work yet. ![image](https://user-images.githubusercontent.com/1725643/85979356-ff009180-b9e8-11ea-8cee-862961a966ae.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

adding celery to project can help us, isnt it? what do you think?

I did not work with Celery, so I cannot say anything about it.

changing instance title&description second time is not working

This is due to virDomain.XMLDesc(0), if instance is running then it returns XML that was active on domain start, title and description won't change until domain is restarted. To get XML that will be active on next domain start we need to call `virDomain.XMLDesc(2):
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags

<!-- gh-comment-id:650953523 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > adding celery to project can help us, isnt it? what do you think? I did not work with Celery, so I cannot say anything about it. > changing instance title&description second time is not working This is due to `virDomain.XMLDesc(0)`, if instance is running then it returns XML that was active on domain start, title and description won't change until domain is restarted. To get XML that will be active on next domain start we need to call `virDomain.XMLDesc(2): https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

selected options does not show

Does not work in master too
This part causes trouble:
github.com/retspen/webvirtcloud@f23e6b000f/instances/templates/instance.html (L1238-L1240)

<!-- gh-comment-id:650960450 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > selected options does not show Does not work in master too This part causes trouble: https://github.com/retspen/webvirtcloud/blob/f23e6b000fc8f5167956dad8ac3422e15f90bda2/instances/templates/instance.html#L1238-L1240
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

clone instance does not work yet.

Something is wrong with DB, did you apply migrations?

<!-- gh-comment-id:650961668 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > clone instance does not work yet. Something is wrong with DB, did you apply migrations?
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

clone instance does not work yet.

Something is wrong with DB, did you apply migrations?

they are all applied.
problem is related with instance id. which should different from source instance.
"The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:"

i remove db and migrate it again.. problem continues...

<!-- gh-comment-id:650966334 --> @catborise commented on GitHub (Jun 29, 2020): > > clone instance does not work yet. > > Something is wrong with DB, did you apply migrations? they are all applied. problem is related with instance id. which should different from source instance. "The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:" i remove db and migrate it again.. problem continues...
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

another problem with instance db records.

  • i remove db.sqlite3 and create with migrate command.
  • login to the wvc
  • add an host.
  • click to instances(all instances)
  • the list is empty. not showing anything.

  • go to host.
  • click to instances
  • then go to all instances. instances are listed.

we have to find a solution to this hiccup.

<!-- gh-comment-id:650967645 --> @catborise commented on GitHub (Jun 29, 2020): another problem with instance db records. - i remove db.sqlite3 and create with migrate command. - login to the wvc - add an host. - click to instances(all instances) - the list is empty. not showing anything. *** - go to host. - click to instances - then go to all instances. instances are listed. we have to find a solution to this hiccup.
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

another problem with instance db records.

* i remove db.sqlite3 and create with migrate command.

* login to the wvc

* add an host.

* click to instances(all instances)

* the list is empty. not showing anything.


* go to host.

* click to instances

* then go to all instances. instances are listed.

we have to find a solution to this hiccup.

Yep, because of things described here
https://github.com/retspen/webvirtcloud/issues/336#issuecomment-650910903
Will fix that

<!-- gh-comment-id:650968972 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > another problem with instance db records. > > * i remove db.sqlite3 and create with migrate command. > > * login to the wvc > > * add an host. > > * click to instances(all instances) > > * the list is empty. not showing anything. > > > * go to host. > > * click to instances > > * then go to all instances. instances are listed. > > > we have to find a solution to this hiccup. Yep, because of things described here https://github.com/retspen/webvirtcloud/issues/336#issuecomment-650910903 Will fix that
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

they are all applied.
problem is related with instance id. which should different from source instance.
"The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:"

i remove db and migrate it again.. problem continues...

Can you provide reproduction steps? Does cloned instance belong to any user?

<!-- gh-comment-id:650969526 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > they are all applied. > problem is related with instance id. which should different from source instance. > "The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:" > > i remove db and migrate it again.. problem continues... Can you provide reproduction steps? Does cloned instance belong to any user?
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

they are all applied.
problem is related with instance id. which should different from source instance.
"The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:"
i remove db and migrate it again.. problem continues...

Can you provide reproduction steps? Does cloned instance belong to any user?

i control it. it does not belong any user.
i track it the problem exception misleading.
the problem is related with not cloned disk instances: stg.createXMLFrom(vol_clone_xml, vol, meta_prealloc) fires an exception.
except Exception as e: messages.error(request, e) catches it print messages then try to save instances to user instance, but there is no new_instance uuid and new_instance.id
( user_instance = UserInstance(instance_id=new_instance.id, user_id=request.user.id, is_delete=True) )
image
there should be return in except. or move user_instance create/save to in try/except will solve that

<!-- gh-comment-id:650995399 --> @catborise commented on GitHub (Jun 29, 2020): > > they are all applied. > > problem is related with instance id. which should different from source instance. > > "The above exception (NOT NULL constraint failed: accounts_userinstance.instance_id) was the direct cause of the following exception:" > > i remove db and migrate it again.. problem continues... > > Can you provide reproduction steps? Does cloned instance belong to any user? i control it. it does not belong any user. i track it the problem exception misleading. the problem is related with not cloned disk instances: stg.createXMLFrom(vol_clone_xml, vol, meta_prealloc) fires an exception. except Exception as e: messages.error(request, e) catches it print messages then try to save instances to user instance, but there is no new_instance uuid and new_instance.id ( user_instance = UserInstance(instance_id=new_instance.id, user_id=request.user.id, is_delete=True) ) ![image](https://user-images.githubusercontent.com/1725643/85987226-08dcc180-b9f6-11ea-8706-052ff523f98d.png) there should be return in except. or move user_instance create/save to in try/except will solve that
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

selected options does not show

github.com/Real-Gecko/webvirtcloud@703de02e5c
I reworked console form, check it out.

<!-- gh-comment-id:651035946 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > selected options does not show https://github.com/Real-Gecko/webvirtcloud/commit/703de02e5ca46e72523305a0b69d3bcd3079491f I reworked console form, check it out.
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

create a group. then click to see details... does not work

<!-- gh-comment-id:651047622 --> @catborise commented on GitHub (Jun 29, 2020): create a group. then click to see details... does not work
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page.

github.com/Real-Gecko/webvirtcloud@63c8151f28

<!-- gh-comment-id:651049351 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > if an instance removed from libvirt but not webvirtcloud database it causes error and does not load allinstances page. https://github.com/Real-Gecko/webvirtcloud/commit/63c8151f28b0b50446f1875c870def7f1afb4c94
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

appsettings page also show two notification
image

<!-- gh-comment-id:651056500 --> @catborise commented on GitHub (Jun 29, 2020): appsettings page also show two notification ![image](https://user-images.githubusercontent.com/1725643/86000036-a98ea980-ba15-11ea-80ca-53efccfdac5c.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

appsettings page also show two notification

include messages_block.html must be removed from all templates.

<!-- gh-comment-id:651057839 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > appsettings page also show two notification `include messages_block.html` must be removed from all templates.
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

instance views nongrouped does not work as expected.

<!-- gh-comment-id:651057915 --> @catborise commented on GitHub (Jun 29, 2020): instance views nongrouped does not work as expected.
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

instance views nongrouped does not work as expected.

What exactly is wrong?

<!-- gh-comment-id:651074892 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > instance views nongrouped does not work as expected. What exactly is wrong?
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

create a group. then click to see details... does not work

Not related to instances

<!-- gh-comment-id:651075123 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > create a group. then click to see details... does not work Not related to instances
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

non grouped view
image

it should be like that
image

this pieces of code seems to ? grouped and nongrouped view does need same info but why is this code:
image

<!-- gh-comment-id:651077664 --> @catborise commented on GitHub (Jun 29, 2020): non grouped view ![image](https://user-images.githubusercontent.com/1725643/86003592-b5c93580-ba1a-11ea-90db-be15ad4bce8d.png) it should be like that ![image](https://user-images.githubusercontent.com/1725643/86003638-c4afe800-ba1a-11ea-8370-c49a28586900.png) this pieces of code seems to ? grouped and nongrouped view does need same info but why is this code: ![image](https://user-images.githubusercontent.com/1725643/86003838-0f316480-ba1b-11ea-9a39-386038c80464.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

selected options does not show

88ea491a0bb96644de9d42330df80f4189659707 for settings too

<!-- gh-comment-id:651089288 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > selected options does not show 88ea491a0bb96644de9d42330df80f4189659707 for settings too
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

non grouped view

676d66076762c9de5e24eda312be83aa2a4969ce

<!-- gh-comment-id:651094401 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > non grouped view 676d66076762c9de5e24eda312be83aa2a4969ce
Author
Owner

@Real-Gecko commented on GitHub (Jun 29, 2020):

except Exception as e: messages.error(request, e) catches it print messages then try to save instances to user instance, but there is no new_instance uuid and new_instance.id

f3bde2408ce1303e06a5e2a25d516d8a394e08d8 I made it look like so

        try:
            new_uuid = instance.proxy.clone_instance(clone_data)
            new_instance.uuid = new_uuid
            new_instance.save()
            user_instance = UserInstance(instance_id=new_instance.id, user_id=request.user.id, is_delete=True)
            user_instance.save()
        except Exception as e:
            messages.error(request, e)

Can you try again and see if it works?

<!-- gh-comment-id:651099380 --> @Real-Gecko commented on GitHub (Jun 29, 2020): > except Exception as e: messages.error(request, e) catches it print messages then try to save instances to user instance, but there is no new_instance uuid and new_instance.id f3bde2408ce1303e06a5e2a25d516d8a394e08d8 I made it look like so ```python try: new_uuid = instance.proxy.clone_instance(clone_data) new_instance.uuid = new_uuid new_instance.save() user_instance = UserInstance(instance_id=new_instance.id, user_id=request.user.id, is_delete=True) user_instance.save() except Exception as e: messages.error(request, e) ``` Can you try again and see if it works?
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

clone is working now. no problem.
instance fixed.

<!-- gh-comment-id:651109119 --> @catborise commented on GitHub (Jun 29, 2020): clone is working now. no problem. instance fixed.
Author
Owner

@catborise commented on GitHub (Jun 29, 2020):

user info missing. host title missing
image

<!-- gh-comment-id:651110607 --> @catborise commented on GitHub (Jun 29, 2020): user info missing. host title missing ![image](https://user-images.githubusercontent.com/1725643/86009587-12305300-ba23-11ea-971f-dfb2b07740bb.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 30, 2020):

regular user(not superuser/staff) cannot pause his instance.

For some reason suspending instances is allowed only for superusers I left this functionality intact.

github.com/retspen/webvirtcloud@f23e6b000f/instances/views.py (L682-L687)

<!-- gh-comment-id:651520306 --> @Real-Gecko commented on GitHub (Jun 30, 2020): > regular user(not superuser/staff) cannot pause his instance. For some reason suspending instances is allowed only for superusers I left this functionality intact. https://github.com/retspen/webvirtcloud/blob/f23e6b000fc8f5167956dad8ac3422e15f90bda2/instances/views.py#L682-L687
Author
Owner

@Real-Gecko commented on GitHub (Jun 30, 2020):

user info missing. host title missing

2f82055c27eef8a4d89a7d7c5659c8720bb26d1a

<!-- gh-comment-id:651526062 --> @Real-Gecko commented on GitHub (Jun 30, 2020): > user info missing. host title missing 2f82055c27eef8a4d89a7d7c5659c8720bb26d1a
Author
Owner

@Real-Gecko commented on GitHub (Jun 30, 2020):

So, looks like everything is fixed, can you please confirm?

<!-- gh-comment-id:651526298 --> @Real-Gecko commented on GitHub (Jun 30, 2020): So, looks like everything is fixed, can you please confirm?
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

instance settings tab actions returns to main instance page.
they should return to settings or disk tab
return redirect(request.META.get('HTTP_REFERER') + #settings/#disk/etc)

.
def delete_vol(request, pk):
def detach_vol(request, pk):
def add_cdrom(request, pk):
def detach_cdrom(request, pk, dev):
def mount_iso(request, pk):
def add_existing_vol(request, pk):

<!-- gh-comment-id:651540564 --> @catborise commented on GitHub (Jun 30, 2020): instance settings tab actions returns to main instance page. they should return to settings or disk tab return redirect(request.META.get('HTTP_REFERER') + #settings/#disk/etc) . def delete_vol(request, pk): def detach_vol(request, pk): def add_cdrom(request, pk): def detach_cdrom(request, pk, dev): def mount_iso(request, pk): def add_existing_vol(request, pk):
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

migration completed successfully. but error happens like before
image

<!-- gh-comment-id:651544575 --> @catborise commented on GitHub (Jun 30, 2020): migration completed successfully. but error happens like before ![image](https://user-images.githubusercontent.com/1725643/86086455-7d713800-baaa-11ea-8547-28443be8bda7.png)
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

steps:

  1. convert one instance to template
  2. add an owner which can clone/delete/vnc
  3. login with this user(owner)
  4. create a clone from template
  5. delete cloned instance.
    -> http404 error, click return: instance not found error
<!-- gh-comment-id:651547483 --> @catborise commented on GitHub (Jun 30, 2020): steps: 1. convert one instance to template 2. add an owner which can clone/delete/vnc 3. login with this user(owner) 4. create a clone from template 5. delete cloned instance. -> http404 error, click return: instance not found error
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

console access from instance list does not work yet:
image

<!-- gh-comment-id:651549616 --> @catborise commented on GitHub (Jun 30, 2020): console access from instance list does not work yet: ![image](https://user-images.githubusercontent.com/1725643/86087216-50258980-baac-11ea-95a5-cc27416d0d0d.png)
Author
Owner

@Real-Gecko commented on GitHub (Jun 30, 2020):

console access from instance list does not work yet

not superuser?

<!-- gh-comment-id:651550717 --> @Real-Gecko commented on GitHub (Jun 30, 2020): > console access from instance list does not work yet not superuser?
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

console access from instance list does not work yet

not superuser?

super user. i did not try not superuser

<!-- gh-comment-id:651551390 --> @catborise commented on GitHub (Jun 30, 2020): > > console access from instance list does not work yet > > not superuser? super user. i did not try not superuser
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

click an instance suspend button. unexpected error appears
image

<!-- gh-comment-id:651552166 --> @catborise commented on GitHub (Jun 30, 2020): click an instance suspend button. unexpected error appears ![image](https://user-images.githubusercontent.com/1725643/86087575-3a649400-baad-11ea-8eb9-71721416a198.png)
Author
Owner

@catborise commented on GitHub (Jun 30, 2020):

delete instance does not ask any confirmation. it deletes immediately. isnt it dangerous?

<!-- gh-comment-id:651558785 --> @catborise commented on GitHub (Jun 30, 2020): delete instance does not ask any confirmation. it deletes immediately. isnt it dangerous?
Author
Owner

@Real-Gecko commented on GitHub (Jun 30, 2020):

delete instance does not ask any confirmation. it deletes immediately. isnt it dangerous?

Yep it is, but this ugly js alert is an atrocity. I'll replace it with simple confirmation page.

<!-- gh-comment-id:651573309 --> @Real-Gecko commented on GitHub (Jun 30, 2020): > delete instance does not ask any confirmation. it deletes immediately. isnt it dangerous? Yep it is, but this ugly js alert is an atrocity. I'll replace it with simple confirmation page.
Author
Owner

@Real-Gecko commented on GitHub (Jul 1, 2020):

migration completed successfully. but error happens like before

Can you show full stack trace? Don't forget to remove any sensitive data from it.

<!-- gh-comment-id:652212314 --> @Real-Gecko commented on GitHub (Jul 1, 2020): > migration completed successfully. but error happens like before Can you show full stack trace? Don't forget to remove any sensitive data from it.
Author
Owner

@Real-Gecko commented on GitHub (Jul 1, 2020):

migration completed successfully. but error happens like before

Does it happen in master branch?

<!-- gh-comment-id:652212722 --> @Real-Gecko commented on GitHub (Jul 1, 2020): > migration completed successfully. but error happens like before Does it happen in master branch?
Author
Owner

@catborise commented on GitHub (Jul 1, 2020):

it is not a problem i think it is only a notification message. master branch does not show it on the page, but only console.
instance branch shows that libvirt error which is "libvirt: QEMU Driver error : Domain not found: no domain with matching name 'rpmbuild'" with a notification.

<!-- gh-comment-id:652222035 --> @catborise commented on GitHub (Jul 1, 2020): it is not a problem i think it is only a notification message. master branch does not show it on the page, but only console. instance branch shows that libvirt error which is "libvirt: QEMU Driver error : Domain not found: no domain with matching name 'rpmbuild'" with a notification.
Author
Owner

@Real-Gecko commented on GitHub (Jul 1, 2020):

master branch does not show it on the page, but only console

I want to track down the error to the line it's happening at. Even if it goes to console I think we have to fix it.

<!-- gh-comment-id:652224122 --> @Real-Gecko commented on GitHub (Jul 1, 2020): > master branch does not show it on the page, but only console I want to track down the error to the line it's happening at. Even if it goes to console I think we have to fix it.
Author
Owner

@catborise commented on GitHub (Jul 1, 2020):

i do not now how to trace it. only one libvirterror message appears and continue. i will debug it, may be i can see.

<!-- gh-comment-id:652228687 --> @catborise commented on GitHub (Jul 1, 2020): i do not now how to trace it. only one libvirterror message appears and continue. i will debug it, may be i can see.
Author
Owner

@catborise commented on GitHub (Jul 1, 2020):

i figure it out. it because of autostart query.
image

i did try with disabling it:

#autostart = instance.proxy.get_autostart()
# if autostart:
    #    conn_new.set_autostart(1)
    #    conn_new.close()

error is gone.
because there is not instance any more it is moved. we should call "autostart = instance.proxy.get_autostart()" before migrate not after migrate.
may it can be:
image

<!-- gh-comment-id:652236006 --> @catborise commented on GitHub (Jul 1, 2020): i figure it out. it because of autostart query. ![image](https://user-images.githubusercontent.com/1725643/86212829-6e10ee00-bb81-11ea-9169-36ab59d60ba8.png) i did try with disabling it: ``` #autostart = instance.proxy.get_autostart() # if autostart: # conn_new.set_autostart(1) # conn_new.close() ``` error is gone. because there is not instance any more it is moved. we should call "autostart = instance.proxy.get_autostart()" before migrate not after migrate. may it can be: ![image](https://user-images.githubusercontent.com/1725643/86213807-ecba5b00-bb82-11ea-9103-d049f0df8e99.png)
Author
Owner

@catborise commented on GitHub (Jul 1, 2020):

moving this from instances/utils.py/migrate_instance:
1
to
1
will solve notifications problem.

<!-- gh-comment-id:652406813 --> @catborise commented on GitHub (Jul 1, 2020): moving this from instances/utils.py/migrate_instance: ![1](https://user-images.githubusercontent.com/1725643/86247061-9ebe4b00-bbb4-11ea-9d76-11d32cd86d32.PNG) to ![1](https://user-images.githubusercontent.com/1725643/86246905-6dde1600-bbb4-11ea-9869-254ac11a366e.PNG) will solve notifications problem.
Author
Owner

@Real-Gecko commented on GitHub (Jul 1, 2020):

0771f72a25c5a52f1aa41ac9e7ee8b163062bf8e
Here's the latest commit that fixes all issues discussed above, please confirm that things are working.

<!-- gh-comment-id:652494039 --> @Real-Gecko commented on GitHub (Jul 1, 2020): 0771f72a25c5a52f1aa41ac9e7ee8b163062bf8e Here's the latest commit that fixes all issues discussed above, please confirm that things are working.
Author
Owner

@catborise commented on GitHub (Jul 2, 2020):

i figure it out. it because of autostart query.
image

i did try with disabling it:

#autostart = instance.proxy.get_autostart()
# if autostart:
    #    conn_new.set_autostart(1)
    #    conn_new.close()

error is gone.
because there is not instance any more it is moved. we should call "autostart = instance.proxy.get_autostart()" before migrate not after migrate.
may it can be:
image

what about that?
did you forget

<!-- gh-comment-id:652784986 --> @catborise commented on GitHub (Jul 2, 2020): > i figure it out. it because of autostart query. > ![image](https://user-images.githubusercontent.com/1725643/86212829-6e10ee00-bb81-11ea-9169-36ab59d60ba8.png) > > i did try with disabling it: > > ``` > #autostart = instance.proxy.get_autostart() > # if autostart: > # conn_new.set_autostart(1) > # conn_new.close() > ``` > > error is gone. > because there is not instance any more it is moved. we should call "autostart = instance.proxy.get_autostart()" before migrate not after migrate. > may it can be: > ![image](https://user-images.githubusercontent.com/1725643/86213807-ecba5b00-bb82-11ea-9103-d049f0df8e99.png) what about that? did you forget
Author
Owner

@Real-Gecko commented on GitHub (Jul 2, 2020):

what about that?
did you forget

6eca1d886ae2d08a114e35e3572238edfd07d196
Fixed

<!-- gh-comment-id:652805108 --> @Real-Gecko commented on GitHub (Jul 2, 2020): > what about that? > did you forget 6eca1d886ae2d08a114e35e3572238edfd07d196 Fixed
Author
Owner

@catborise commented on GitHub (Jul 2, 2020):

all libvirt actions need to be encapsulated with try/except block.
libvirt could be produce an error. this should not crash the application.
image

could you implement that with a decorator?

def poweron(request, pk):
    instance = get_instance(request.user, pk)
    if instance.is_template:
        messages.warning(request, _("Templates cannot be started."))
    else:
    /// try
        instance.proxy.start()
   /// except
        addlogmsg(request.user.username, instance.name, _("Power On"))

    return redirect(request.META.get('HTTP_REFERER'))


def powercycle(request, pk):
    instance = get_instance(request.user, pk)
    instance.proxy.force_shutdown()
    instance.proxy.start()
    addlogmsg(request.user.username, instance.name, _("Power Cycle"))
    return redirect(request.META.get('HTTP_REFERER'))


def poweroff(request, pk):
    instance = get_instance(request.user, pk)
    instance.proxy.shutdown()
    addlogmsg(request.user.username, instance.name, _("Power Off"))

    return redirect(request.META.get('HTTP_REFERER'))


@superuser_only
def suspend(request, pk):
    instance = get_instance(request.user, pk)
    instance.proxy.suspend()
    addlogmsg(request.user.username, instance.name, _("Suspend"))
    return redirect(request.META.get('HTTP_REFERER'))


@superuser_only
def resume(request, pk):
    instance = get_instance(request.user, pk)
    instance.proxy.resume()
    addlogmsg(request.user.username, instance.name, _("Resume"))
    return redirect(request.META.get('HTTP_REFERER'))


def force_off(request, pk):
    instance = get_instance(request.user, pk)
    instance.proxy.force_shutdown()
    addlogmsg(request.user.username, instance.name, _("Force Off"))
    return redirect(request.META.get('HTTP_REFERER'))
<!-- gh-comment-id:652812299 --> @catborise commented on GitHub (Jul 2, 2020): all libvirt actions need to be encapsulated with try/except block. libvirt could be produce an error. this should not crash the application. ![image](https://user-images.githubusercontent.com/1725643/86324045-9878af00-bc46-11ea-95d6-905622555e12.png) could you implement that with a decorator? ``` def poweron(request, pk): instance = get_instance(request.user, pk) if instance.is_template: messages.warning(request, _("Templates cannot be started.")) else: /// try instance.proxy.start() /// except addlogmsg(request.user.username, instance.name, _("Power On")) return redirect(request.META.get('HTTP_REFERER')) def powercycle(request, pk): instance = get_instance(request.user, pk) instance.proxy.force_shutdown() instance.proxy.start() addlogmsg(request.user.username, instance.name, _("Power Cycle")) return redirect(request.META.get('HTTP_REFERER')) def poweroff(request, pk): instance = get_instance(request.user, pk) instance.proxy.shutdown() addlogmsg(request.user.username, instance.name, _("Power Off")) return redirect(request.META.get('HTTP_REFERER')) @superuser_only def suspend(request, pk): instance = get_instance(request.user, pk) instance.proxy.suspend() addlogmsg(request.user.username, instance.name, _("Suspend")) return redirect(request.META.get('HTTP_REFERER')) @superuser_only def resume(request, pk): instance = get_instance(request.user, pk) instance.proxy.resume() addlogmsg(request.user.username, instance.name, _("Resume")) return redirect(request.META.get('HTTP_REFERER')) def force_off(request, pk): instance = get_instance(request.user, pk) instance.proxy.force_shutdown() addlogmsg(request.user.username, instance.name, _("Force Off")) return redirect(request.META.get('HTTP_REFERER')) ```
Author
Owner

@catborise commented on GitHub (Jul 2, 2020):

same error problem which cause crash is also valid for destroy
may be you should change method like below

def destroy(request, pk):
    instance = get_instance(request.user, pk)
    try:
        userinstance = instance.userinstance_set.get(user=request.user)
    except:
        userinstance = UserInstance(is_delete=request.user.is_superuser)

    if request.method == 'POST' and userinstance.is_delete:
        if instance.proxy.get_status() == 1:
            instance.proxy.force_shutdown()

        try:
            if request.POST.get('delete_disk', ''):
                snapshots = sorted(instance.proxy.get_snapshot(
                ), reverse=True, key=lambda k: k['date'])
                for snapshot in snapshots:
                    instance.proxy.snapshot_delete(snapshot['name'])
                instance.proxy.delete_all_disks()

            if request.POST.get('delete_nvram', ''):
                instance.proxy.delete(VIR_DOMAIN_UNDEFINE_NVRAM)
            else:
                instance.proxy.delete(VIR_DOMAIN_UNDEFINE_KEEP_NVRAM)

            instance.delete()
            msg = _("Destroy Instance")

        except libvirtError as err:
            msg = err
            messages.error(request, msg)
            return redirect(request.META.get('HTTP_REFERER'))

        addlogmsg(request.user, instance.name, msg)

        return redirect(reverse('instances:index'))

    return render(
        request,
        'instances/destroy_instance_form.html',
        {
            'instance': instance,
            'userinstance': userinstance,
        },
    )

also
i think you move the choices to confirm dialog. it should be changed with a proper message
image

<!-- gh-comment-id:652815661 --> @catborise commented on GitHub (Jul 2, 2020): same error problem which cause crash is also valid for destroy may be you should change method like below ``` def destroy(request, pk): instance = get_instance(request.user, pk) try: userinstance = instance.userinstance_set.get(user=request.user) except: userinstance = UserInstance(is_delete=request.user.is_superuser) if request.method == 'POST' and userinstance.is_delete: if instance.proxy.get_status() == 1: instance.proxy.force_shutdown() try: if request.POST.get('delete_disk', ''): snapshots = sorted(instance.proxy.get_snapshot( ), reverse=True, key=lambda k: k['date']) for snapshot in snapshots: instance.proxy.snapshot_delete(snapshot['name']) instance.proxy.delete_all_disks() if request.POST.get('delete_nvram', ''): instance.proxy.delete(VIR_DOMAIN_UNDEFINE_NVRAM) else: instance.proxy.delete(VIR_DOMAIN_UNDEFINE_KEEP_NVRAM) instance.delete() msg = _("Destroy Instance") except libvirtError as err: msg = err messages.error(request, msg) return redirect(request.META.get('HTTP_REFERER')) addlogmsg(request.user, instance.name, msg) return redirect(reverse('instances:index')) return render( request, 'instances/destroy_instance_form.html', { 'instance': instance, 'userinstance': userinstance, }, ) ``` also i think you move the choices to confirm dialog. it should be changed with a proper message ![image](https://user-images.githubusercontent.com/1725643/86325022-16898580-bc48-11ea-954a-ac6f00dd8b2e.png)
Author
Owner

@Real-Gecko commented on GitHub (Jul 2, 2020):

libvirt always could be produce an error. this should not crash application.

Do you have ExceptionMiddleware enabled?

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',
    'login_required.middleware.LoginRequiredMiddleware',
    'django.contrib.auth.middleware.RemoteUserMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'appsettings.middleware.AppSettingsMiddleware',
    'webvirtcloud.middleware.ExceptionMiddleware',
]
<!-- gh-comment-id:652816647 --> @Real-Gecko commented on GitHub (Jul 2, 2020): > libvirt always could be produce an error. this should not crash application. Do you have ExceptionMiddleware enabled? ```python 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', 'login_required.middleware.LoginRequiredMiddleware', 'django.contrib.auth.middleware.RemoteUserMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'appsettings.middleware.AppSettingsMiddleware', 'webvirtcloud.middleware.ExceptionMiddleware', ] ```
Author
Owner

@Real-Gecko commented on GitHub (Jul 2, 2020):

Screenshot_20200702_124703

<!-- gh-comment-id:652817945 --> @Real-Gecko commented on GitHub (Jul 2, 2020): ![Screenshot_20200702_124703](https://user-images.githubusercontent.com/2231969/86325661-3a59c500-bc62-11ea-8541-2ce1d88616af.png)
Author
Owner

@lord-kyron commented on GitHub (Jul 2, 2020):

Hey guys, shouldn't it be better to create a Discord chat channel and move those conversations there? It will be faster and not so spamming. I can create the channel if you are ok with it?

<!-- gh-comment-id:652819199 --> @lord-kyron commented on GitHub (Jul 2, 2020): Hey guys, shouldn't it be better to create a Discord chat channel and move those conversations there? It will be faster and not so spamming. I can create the channel if you are ok with it?
Author
Owner

@catborise commented on GitHub (Jul 2, 2020):

hmm. no it was not enabled. i enable it. nice it works as expected :)

<!-- gh-comment-id:652819295 --> @catborise commented on GitHub (Jul 2, 2020): hmm. no it was not enabled. i enable it. nice it works as expected :)
Author
Owner

@catborise commented on GitHub (Jul 2, 2020):

in past, i want to create a channel for project in https://gitter.im/ but retspen does not respond.
discord will be fine.
this place is not a suitable for that style communication.

you can add communication info to readme

<!-- gh-comment-id:652820318 --> @catborise commented on GitHub (Jul 2, 2020): in past, i want to create a channel for project in https://gitter.im/ but retspen does not respond. discord will be fine. this place is not a suitable for that style communication. you can add communication info to readme
Author
Owner

@Real-Gecko commented on GitHub (Jul 2, 2020):

I can create the channel if you are ok with it?

Make it happen.

<!-- gh-comment-id:652820328 --> @Real-Gecko commented on GitHub (Jul 2, 2020): > I can create the channel if you are ok with it? Make it happen.
Author
Owner

@lord-kyron commented on GitHub (Jul 2, 2020):

It was done:
https://discord.gg/McyJ9m

Come in!
And someone of you - please, add the link to the channel to the README!
Thanks!

<!-- gh-comment-id:652821144 --> @lord-kyron commented on GitHub (Jul 2, 2020): It was done: https://discord.gg/McyJ9m Come in! And someone of you - please, add the link to the channel to the README! Thanks!
Author
Owner

@Real-Gecko commented on GitHub (Oct 7, 2020):

Can be closed as #342 was merged.

<!-- gh-comment-id:704717451 --> @Real-Gecko commented on GitHub (Oct 7, 2020): Can be closed as #342 was merged.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtcloud#215
No description provided.