After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744682 - tests: session vms backup cleanup
tests: session vms backup cleanup
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
3.15.x
Other Linux
: Normal normal
: 3.22
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-02-17 20:29 UTC by vladimir benes
Modified: 2016-03-31 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: backup and restore cleanups (8.52 KB, text/plain)
2015-02-17 20:37 UTC, vladimir benes
  Details
tests: Cleaning restore-backup code (7.28 KB, patch)
2015-02-18 19:33 UTC, vladimir benes
none Details | Review
tests: Directory change fix in restore function (1014 bytes, patch)
2015-02-18 19:38 UTC, vladimir benes
none Details | Review
tests: Restoring VMs after scenario skip (1.18 KB, patch)
2015-02-18 19:41 UTC, vladimir benes
none Details | Review
tests: Remove both SB machines (1.07 KB, patch)
2015-02-18 19:47 UTC, vladimir benes
none Details | Review
tests: Refactor backup & restoring code (7.28 KB, patch)
2015-02-18 21:59 UTC, Zeeshan Ali
committed Details | Review
tests: Change directory outside & after loop (1010 bytes, patch)
2015-02-18 21:59 UTC, Zeeshan Ali
committed Details | Review
tests: Restore VMs when scenario are skipped (1.19 KB, patch)
2015-02-18 21:59 UTC, Zeeshan Ali
committed Details | Review
tests: Clean-up system broker VMs (1.08 KB, patch)
2015-02-18 22:00 UTC, Zeeshan Ali
committed Details | Review

Description vladimir benes 2015-02-17 20:29:40 UTC
* function created for do_backup and do_restore
* one regression fixed in snapshot restoring
* restoring machines even when vnc and system-brokers are skipped
Comment 1 vladimir benes 2015-02-17 20:37:51 UTC
Created attachment 297059 [details]
tests: backup and restore cleanups

* Backup and restore functions created so they can be used before
  exit(77) when skipping system broker or vnc tests in case of missing
  environmental needs.
* Change directory regression fixed in restoring snapshots.
Comment 2 Zeeshan Ali 2015-02-18 18:42:07 UTC
Review of attachment 297059 [details]:

There is at least two different logical changes here so can we please divide it?
Comment 3 vladimir benes 2015-02-18 19:33:08 UTC
Created attachment 297146 [details] [review]
tests: Cleaning restore-backup code

Move all saving and restoring code into separate functions.
Comment 4 vladimir benes 2015-02-18 19:38:15 UTC
Created attachment 297148 [details] [review]
tests: Directory change fix in restore function

Going back to original directory after every machine snaphsots restored.
Comment 5 vladimir benes 2015-02-18 19:41:59 UTC
Created attachment 297149 [details] [review]
tests: Restoring VMs after scenario skip

Machines are now restored even after skipped scenarios.
Comment 6 vladimir benes 2015-02-18 19:47:46 UTC
Created attachment 297150 [details] [review]
tests: Remove both SB machines

Deleting both system broker machines that are used in import 2 boxes
from system broker test.
Comment 7 Zeeshan Ali 2015-02-18 21:59:24 UTC
Created attachment 297153 [details] [review]
tests: Refactor backup & restoring code

Move all saving and restoring code into separate functions.
Comment 8 Zeeshan Ali 2015-02-18 21:59:43 UTC
Created attachment 297154 [details] [review]
tests: Change directory outside & after loop

Go back to original directory after all machine snaphsots are restored.
Comment 9 Zeeshan Ali 2015-02-18 21:59:59 UTC
Created attachment 297155 [details] [review]
tests: Restore VMs when scenario are skipped

Ensure machines are now restored even after skipped scenarios.
Comment 10 Zeeshan Ali 2015-02-18 22:00:11 UTC
Created attachment 297156 [details] [review]
tests: Clean-up system broker VMs

Delete both machines that are created by 'Import 2 box from system broker'
scenario from system broker.
Comment 11 Zeeshan Ali 2015-02-18 22:00:43 UTC
Attachment 297153 [details] pushed as 630e3ea - tests: Refactor backup & restoring code
Attachment 297154 [details] pushed as 3515109 - tests: Change directory outside & after loop
Attachment 297155 [details] pushed as bac6c26 - tests: Restore VMs when scenario are skipped
Attachment 297156 [details] pushed as 3bd95c9 - tests: Clean-up system broker VMs
Comment 12 Zeeshan Ali 2015-02-18 22:02:43 UTC
Review of attachment 297156 [details] [review]:

::: tests/environment.py
@@ +219,3 @@
+            os.system('virsh -q -c qemu:///system destroy Core-5.3-2 > /dev/null 2>&1')
+            os.system('virsh -q -c qemu:///system undefine Core-5.3-2 > /dev/null 2>&1')
+

While I pushed this to include in the pending release, I think this should either by done by the scenario itself or this should be made generic.
Comment 13 vladimir benes 2015-02-19 08:49:29 UTC
(In reply to Zeeshan Ali (Khattak) from comment #12)
> Review of attachment 297156 [details] [review] [review]:
> 
> ::: tests/environment.py
> @@ +219,3 @@
> +            os.system('virsh -q -c qemu:///system destroy Core-5.3-2 >
> /dev/null 2>&1')
> +            os.system('virsh -q -c qemu:///system undefine Core-5.3-2 >
> /dev/null 2>&1')
> +
> 
> While I pushed this to include in the pending release, I think this should
> either by done by the scenario itself or this should be made generic.

These deletions are wanted to be done outside of test itself as they're not a part of it and failing in deletion is not something you may want in test itself. This is exactly what environment.py should be used for. 

You don't want to delete any other machine that was created by test itself as we are not touching vms that existed in system broker. What I can think of is to delete anything that has Core-5.3 inside.
Comment 14 Zeeshan Ali 2015-02-20 12:13:50 UTC
(In reply to vladimir benes from comment #13)
> (In reply to Zeeshan Ali (Khattak) from comment #12)
> > Review of attachment 297156 [details] [review] [review] [review]:
> > 
> > ::: tests/environment.py
> > @@ +219,3 @@
> > +            os.system('virsh -q -c qemu:///system destroy Core-5.3-2 >
> > /dev/null 2>&1')
> > +            os.system('virsh -q -c qemu:///system undefine Core-5.3-2 >
> > /dev/null 2>&1')
> > +
> > 
> > While I pushed this to include in the pending release, I think this should
> > either by done by the scenario itself or this should be made generic.
> 
> These deletions are wanted to be done outside of test itself as they're not
> a part of it and failing in deletion is not something you may want in test
> itself. This is exactly what environment.py should be used for. 
>
> You don't want to delete any other machine that was created by test itself
> as we are not touching vms that existed in system broker. What I can think
> of is to delete anything that has Core-5.3 inside.

Of course not but we create these machines and give them names so we can give them unique names (e.g boxes-tests-Core-5.3) to ensure that we don't end up deleting some other machines.