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 666739 - Add devices based on what is supported by the OS
Add devices based on what is supported by the OS
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: installer
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-12-22 23:07 UTC by Zeeshan Ali
Modified: 2016-03-31 13:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add devices based on what is supported by the OS (5.25 KB, patch)
2011-12-22 23:07 UTC, Zeeshan Ali
none Details | Review
Add devices based on what is supported by the OS (5.25 KB, patch)
2011-12-23 14:33 UTC, Zeeshan Ali
needs-work Details | Review
Add devices based on what is supported by the OS (5.11 KB, patch)
2012-01-10 19:15 UTC, Zeeshan Ali
none Details | Review
Add devices based on what is supported by the OS (5.09 KB, patch)
2012-01-10 19:30 UTC, Zeeshan Ali
none Details | Review
Add devices based on what is supported by the OS (5.09 KB, patch)
2012-01-15 22:37 UTC, Zeeshan Ali
reviewed Details | Review
Add devices based on what is supported by the OS (5.47 KB, patch)
2012-01-16 13:40 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2011-12-22 23:07:46 UTC
Add video, sound and tablet devices to new VM based on what is supported by the OS in question. The information about device support comes from libosinfo.
    
Also note that this requires my unmerged patches to libvirt-glib and libosinfo.
Comment 1 Zeeshan Ali 2011-12-22 23:07:48 UTC
Created attachment 204118 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 2 Zeeshan Ali 2011-12-23 14:33:48 UTC
Created attachment 204140 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 3 Marc-Andre Lureau 2012-01-07 15:59:28 UTC
Review of attachment 204140 [details] [review]:

::: src/vm-configurator.vala
@@ +252,3 @@
+
+        if (val == null)
+            parents = parents.new_union (clones);

I would rather throw an error here.

I don't think it's a good idea to silently fail or error out later.

otherwise looks good, can you update the patch so it applies in git?
Comment 4 Marc-Andre Lureau 2012-01-07 16:00:20 UTC
Review of attachment 204140 [details] [review]:

::: src/vm-configurator.vala
@@ +247,3 @@
+    }
+
+            var upgrades = os.get_related (ProductRelationship.UPGRADES);

this function could actually be moved to util.vala, and renamed, no?
Comment 5 Zeeshan Ali 2012-01-07 16:31:52 UTC
(In reply to comment #3)
> Review of attachment 204140 [details] [review]:
> 
> ::: src/vm-configurator.vala
> @@ +252,3 @@
> +
> +        if (val == null)
> +            parents = parents.new_union (clones);
> 
> I would rather throw an error here.
> 
> I don't think it's a good idea to silently fail or error out later.

I think you meant this: 

+    static int get_virt_enum_value (string value_nick, Type enum_type) {
+        var enum_class = (EnumClass) enum_type.class_ref ();
+        var val = enum_class.get_value_by_nick (value_nick);
+
+        if (val == null)
+            return -1;

The lines you pasted don't exactly exist in my patch. If so I think this is one place where asserts are good for or return_*if_fail() if you prefer.

> otherwise looks good, can you update the patch so it applies in git?

Sure but I was hoping to move the code for finding all the devices to osinfo but was awaiting Daniel's input on the list to do that in the correct way.
Comment 6 Zeeshan Ali 2012-01-10 19:15:58 UTC
Created attachment 204975 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 7 Zeeshan Ali 2012-01-10 19:21:26 UTC
This new patch makes use of the API I am adding to libosinfo (pending review). I forgot to address the issues you pointed out so i'll submit another version..
Comment 8 Zeeshan Ali 2012-01-10 19:30:18 UTC
Created attachment 204976 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 9 Zeeshan Ali 2012-01-10 21:55:16 UTC
(In reply to comment #7)
> This new patch makes use of the API I am adding to libosinfo (pending review).

These patches have been reviewed and pushed to libosinfo.
Comment 10 Zeeshan Ali 2012-01-15 22:37:53 UTC
Created attachment 205317 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 11 Marc-Andre Lureau 2012-01-15 22:48:55 UTC
Review of attachment 205317 [details] [review]:

::: src/vm-configurator.vala
@@ +218,3 @@
+    }
+
+        var filter = new Filter ();

I would move this function to util.vala
Comment 12 Zeeshan Ali 2012-01-15 23:43:09 UTC
(In reply to comment #11)
> Review of attachment 205317 [details] [review]:
> 
> ::: src/vm-configurator.vala
> @@ +218,3 @@
> +    }
> +
> +        var filter = new Filter ();
> 
> I would move this function to util.vala

You mean get_device_by_prop() ? Yeah, I guess we should move get_virt_enum_value() there too (and rename of course).
Comment 13 Zeeshan Ali 2012-01-16 13:40:41 UTC
Created attachment 205360 [details] [review]
Add devices based on what is supported by the OS

Add video, sound and tablet devices to new VM based on what is supported
by the OS in question. The information about device support comes from
libosinfo.

Note that we don't add these devices if OS itself or its support for the device
in question is unknown and rely on libvirt to fill in the safe defaults for us.
Comment 14 Marc-Andre Lureau 2012-01-16 13:47:16 UTC
Review of attachment 205360 [details] [review]:

small comment, ack otherwise

::: src/util.vala
@@ +254,3 @@
     }
 
+    public Osinfo.Device? get_os_device_by_prop (Osinfo.Os? os, string prop_name, string prop_value) {

this one is less likely to be reused. Perhaps it should be moved to libosinfo instead?
Comment 15 Zeeshan Ali 2012-01-16 13:53:05 UTC
(In reply to comment #14)
> Review of attachment 205360 [details] [review]:
> 
> small comment, ack otherwise
> 
> ::: src/util.vala
> @@ +254,3 @@
>      }
> 
> +    public Osinfo.Device? get_os_device_by_prop (Osinfo.Os? os, string
> prop_name, string prop_value) {
> 
> this one is less likely to be reused. Perhaps it should be moved to libosinfo
> instead?

Yeah, already on my TODO. :)
Comment 16 Zeeshan Ali 2012-01-16 14:07:55 UTC
Attachment 205360 [details] pushed as 9dcd91b - Add devices based on what is supported by the OS