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 684233 - "customize" wizard button not working for spice:// boxes
"customize" wizard button not working for spice:// boxes
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other Linux
: Low minor
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-09-17 16:54 UTC by Christophe Fergeau
Modified: 2016-03-31 13:54 UTC
See Also:
GNOME target: ---
GNOME version: 3.7/3.8


Attachments
wizard: Disable customization for non-VMs for now (1.47 KB, patch)
2012-10-05 20:46 UTC, Zeeshan Ali
committed Details | Review
wizard: be more strict about spice uri (3.55 KB, patch)
2012-10-29 12:51 UTC, Marc-Andre Lureau
committed Details | Review
wizard: split libvirt_machine and machine (5.24 KB, patch)
2012-10-29 12:51 UTC, Marc-Andre Lureau
committed Details | Review
remote-machine: return properties when display isn't connected (2.17 KB, patch)
2012-10-29 12:51 UTC, Marc-Andre Lureau
committed Details | Review
remote-machine: verify the kind of remote is known (1.72 KB, patch)
2012-10-29 12:51 UTC, Marc-Andre Lureau
committed Details | Review
wizard: allow properties access for remote machine (2.31 KB, patch)
2012-10-29 12:51 UTC, Marc-Andre Lureau
committed Details | Review

Description Christophe Fergeau 2012-09-17 16:54:25 UTC
Create a new box
Enter a spice:// URL (eg spice://localhost:5900)
Click on "customize" on the review page
-> a warning is printed on the console, and no review page
(gnome-boxes:26010): Boxes-CRITICAL **: boxes_app_select_item: assertion `item != NULL' failed

Expected result: properties are shown to enable/disable USB redir, cut&paste, ...
Comment 1 Zeeshan Ali 2012-09-26 14:16:35 UTC
Meh, this is really bad! I suggest we temporarily work around this by only showing the 'customize' button for VMs.
Comment 2 Christophe Fergeau 2012-09-26 15:21:15 UTC
Sounds good if the "is vm' check is not too ugly..
Comment 3 Zeeshan Ali 2012-10-05 20:46:16 UTC
Created attachment 225901 [details] [review]
wizard: Disable customization for non-VMs for now

Customization assumes a machine ready at 'review' page and that is
currently only true when creating VMs. Since this feature is most useful
for VMs (people wanting to change storage capacity and RAM) and its
still very much possible to change machine properties after creation,
lets go with this least intrusive solution for now.
Comment 4 Christophe Fergeau 2012-10-08 10:13:23 UTC
Review of attachment 225901 [details] [review]:

Looks good

::: src/wizard.vala
@@ +417,3 @@
         }
 
+        if (machine != null)

Maybe a comment explaining when machine can be null here?
Comment 5 Zeeshan Ali 2012-10-08 14:24:23 UTC
Comment on attachment 225901 [details] [review]
wizard: Disable customization for non-VMs for now

Attachment 225901 [details] pushed as 98bc991 - wizard: Disable customization for non-VMs for now

+ comment added as suggested in the review.
Comment 6 Zeeshan Ali 2012-10-11 12:23:12 UTC
This isn't fixed really, we should be allowing customization of spice (or any box) before creation, just that its not as important as in case of VM. So I'll keep this open.
Comment 7 Marc-Andre Lureau 2012-10-29 12:51:23 UTC
Created attachment 227528 [details] [review]
wizard: be more strict about spice uri

A spice URI need either a port or a query string with port.

Avoid the follwing critical:
(gnome-boxes:9570): Boxes-CRITICAL **: boxes_query_construct: assertion `query != NULL' failed
Comment 8 Marc-Andre Lureau 2012-10-29 12:51:26 UTC
Created attachment 227529 [details] [review]
wizard: split libvirt_machine and machine

machine can be reused for non-libvirt cases.
Comment 9 Marc-Andre Lureau 2012-10-29 12:51:30 UTC
Created attachment 227530 [details] [review]
remote-machine: return properties when display isn't connected

Currently, get_properties () returns correctly only when the display
is connected, because the display isn't created until then.
Comment 10 Marc-Andre Lureau 2012-10-29 12:51:33 UTC
Created attachment 227531 [details] [review]
remote-machine: verify the kind of remote is known

Warn only in the console if not, this is a programming error.
Comment 11 Marc-Andre Lureau 2012-10-29 12:51:36 UTC
Created attachment 227532 [details] [review]
wizard: allow properties access for remote machine
Comment 12 Zeeshan Ali 2012-10-29 15:33:41 UTC
Review of attachment 227528 [details] [review]:

Looks good otherwise.

::: src/spice-display.vala
@@ +215,3 @@
 }
+
+// FIXME: this kind of function should be part of spice-gtk

* I'm guessing that we are putting it here for not bumping spice-gtk dep? I think we should special-case some of our deps so that we can bump the deps: libvirt-glib, libosinfo and spice-gtk.

* Why a global function in this module rather than static method?

* Why 'static' keyword if not in a class?

::: src/wizard.vala
@@ +393,3 @@
+                } catch (Boxes.Error error) {
+                    // this shouldn't happen, since the URI was validated before
+                    critical (error.message);

I prefer g_assert*() for situations that are not supposed to happen. The idea is that during testing phases, an assert will be hard to ignore and will most likely be reported, treated as high priority and fixed ASAP. In production, asserts could simply be disabled at buildtime.

You can disagree of course but this is one of the things that we should have a project-wide policy/rule about.
Comment 13 Zeeshan Ali 2012-10-29 15:36:30 UTC
Review of attachment 227529 [details] [review]:

ACK
Comment 14 Zeeshan Ali 2012-10-29 15:41:17 UTC
Review of attachment 227530 [details] [review]:

Looks ok but *IMHO* a better title would be " remote-machine: Separate display creation from connection".
Comment 15 Zeeshan Ali 2012-10-29 15:47:46 UTC
Review of attachment 227531 [details] [review]:

Good otherwise.

::: src/app.vala
@@ +317,3 @@
+                collection.add_item (machine);
+            } catch (Boxes.Error error) {
+                warning (error.message);

like in the previous patch, I think this one should be dealt with g_assert*.

::: src/remote-machine.vala
@@ +6,3 @@
+    public RemoteMachine (CollectionSource source) throws Boxes.Error {
+        if (source.source_type != "spice" &&
+            source.source_type != "vnc")

nitpick: both cases nicely fit in one line so no need to split lines..
Comment 16 Zeeshan Ali 2012-10-29 15:50:57 UTC
Review of attachment 227532 [details] [review]:

"access for" -> "access to" in commit log. Looks good otherwise.
Comment 17 Marc-Andre Lureau 2012-10-29 16:23:37 UTC
Review of attachment 227528 [details] [review]:

::: src/spice-display.vala
@@ +215,3 @@
 }
+
+// FIXME: this kind of function should be part of spice-gtk

- we put it in Boxes, because it does things specific to Boxes (return ports values) and we don't have a way to make it work nicely with SpiceSession, and I am not sure it will do what Boxes need in the end (returned exact parsed values and errors).
- global or static I don't think it matters anyway.

::: src/wizard.vala
@@ +393,3 @@
+                } catch (Boxes.Error error) {
+                    // this shouldn't happen, since the URI was validated before
+                    critical (error.message);

I don't think we need a rule for that, I don't like assert() in code in general, I run with G_DEBUG=fatal_criticals by default, all devs should do the same imho, and keep using return_if_fail or critical if he likes to. Removing assert() line in production is not a good idea, I much prefer keeping a critical trace...
Comment 18 Marc-Andre Lureau 2012-10-29 16:25:54 UTC
Review of attachment 227531 [details] [review]:

::: src/remote-machine.vala
@@ +6,3 @@
+    public RemoteMachine (CollectionSource source) throws Boxes.Error {
+        if (source.source_type != "spice" &&
+            source.source_type != "vnc")

imho, "equivalent" cases can be put at same level of indentation, so it is easy to see which values/conditions are handled.

For similiar reason we do
foo ("prop_a", 0,
     "prop_b", 42,
      null)

and not a single line with all the arguments.
Comment 19 Zeeshan Ali 2012-10-29 20:39:19 UTC
Review of attachment 227531 [details] [review]:

OK then..
Comment 20 Zeeshan Ali 2012-10-29 20:40:07 UTC
Review of attachment 227528 [details] [review]:

k
Comment 21 Marc-Andre Lureau 2012-10-30 19:04:14 UTC
Attachment 227528 [details] pushed as c94e493 - wizard: be more strict about spice uri
Attachment 227529 [details] pushed as d2b6eba - wizard: split libvirt_machine and machine
Attachment 227530 [details] pushed as f970cb4 - remote-machine: return properties when display isn't connected
Attachment 227531 [details] pushed as f36f523 - remote-machine: verify the kind of remote is known
Attachment 227532 [details] pushed as 6ba65a9 - wizard: allow properties access for remote machine