Bug 731615 - support selecting systems by device in <hostRequires/>
Summary: support selecting systems by device in <hostRequires/>
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Community
Component: scheduler
Version: 0.6
Hardware: Unspecified
OS: Unspecified
high
high vote
Target Milestone: ---
Assignee: Dan Callaghan
QA Contact:
URL:
Whiteboard:
: 784026 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-18 04:21 UTC by Dan Callaghan
Modified: 2019-05-22 13:41 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-26 07:16:14 UTC


Attachments (Terms of Use)

Description Dan Callaghan 2011-08-18 04:21:10 UTC
We record PCI-ids and drivers for each device in a system. The web UI already allows users to search on those, we should extend the job xml to do the same.

Something like

    <device_driver op="=" value="e1000e" />

and

    <device_pciid op="=" value="1234:5678" />

This will be a better way to run jobs on specific hardware than using the PCIID or MODULE keys with <key_value/>.

Comment 1 Dan Callaghan 2011-11-17 05:26:26 UTC
Would it make sense to also accept

    <device_pciid op="=" value="1234" />

and search only on the PCI vendor ID?

What about searching by PCI subsystem vendor/device IDs? Is that likely to be useful to anybody?

Comment 2 Dan Callaghan 2012-01-25 00:18:06 UTC
*** Bug 784026 has been marked as a duplicate of this bug. ***

Comment 3 Dan Callaghan 2012-01-25 00:19:02 UTC
I have a patch for this, but it doesn't support querying by device type as mentioned in the duplicate bug 784026. But it should be pretty easy to add.

Comment 4 Matěj Cepl 2012-01-26 20:30:51 UTC
(In reply to comment #1)
> Would it make sense to also accept
> 
>     <device_pciid op="=" value="1234" />
> 
> and search only on the PCI vendor ID?

Just let me note that this is wrong ... it is not obvious for which part of PCI ID (manufacturer or device) you search.

Comment 5 Qian Hong 2012-02-27 08:51:07 UTC
(In reply to comment #4)
> (In reply to comment #1)
> > Would it make sense to also accept
> > 
> >     <device_pciid op="=" value="1234" />
> > 
> > and search only on the PCI vendor ID?
> 
> Just let me note that this is wrong ... it is not obvious for which part of PCI
> ID (manufacturer or device) you search.

I think such search would be useful (if possible):

<device_pciid op="contains" value="1234:" />

<device_pciid op="contains" value=":5678" />

Regards.

Comment 6 Bill Peck 2012-02-27 21:36:58 UTC
Dan,

Unless you have started working on this please assign to ryang@redhat.com

I'd like to free you up to work on native provisioning.

Thanks

Comment 7 Dan Callaghan 2012-03-27 06:31:33 UTC
Patch submitted to Gerrit for review:

http://gerrit.beaker-project.org/854

Comment 10 Dan Callaghan 2012-04-17 00:55:58 UTC
The new element is not documented anywhere except in the RELAX NG schema for validating Beaker jobs:

http://git.beaker-project.org/cgit/beaker/tree/Common/bkr/common/schema/beaker-job.rng?h=develop#n282

(Eventually we will generate human-readable docs from this schema, one day...)

It's the same as described in https://bugzilla.redhat.com/show_bug.cgi?id=784026#c0 except that the element name is <device/> not <pci_id/> because you can select non-PCI devices with it too (for example by driver name).

Comment 11 Dan Callaghan 2012-04-17 06:04:11 UTC
This is broken on stage due to a mistake in the RELAX NG schema (jobs using <device/> will fail validation unless they have all the attributes). Fix pushed to Gerrit:

http://gerrit.beaker-project.org/1012

Comment 13 Bill Peck 2012-04-17 15:37:28 UTC
I think we have another failure in this code as well.

ProgrammingError: (ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND (system.private = 0 OR (EXISTS (SELECT 1 \nFROM system_group \nWHERE system' at line 5") 'SELECT count(1) AS count_1 \nFROM system_arch_map AS system_arch_map_1, system INNER JOIN lab_controller ON lab_controller.id = system.lab_controller_id INNER JOIN distro_lab_controller_map ON lab_controller.id = distro_lab_controller_map.lab_controller_id INNER JOIN distro ON distro.id = distro_lab_controller_map.distro_id \nWHERE system.type = %s AND (EXISTS (SELECT 1 \nFROM system_device_map, device \nWHERE system.id = system_device_map.system_id AND device.id = system_device_map.device_id AND )) AND (system.private = %s OR (EXISTS (SELECT 1 \nFROM system_group \nWHERE system.id = system_group.system_id AND (EXISTS (SELECT 1 \nFROM tg_group, user_group AS user_group_1 \nWHERE tg_group.group_id = system_group.group_id AND tg_group.group_id = user_group_1.group_id AND %s = user_group_1.user_id)))) OR system.owner_id = %s OR system.user_id = %s) AND system.status = %s AND (system.owner_id = %s OR system.loan_id = %s OR system.shared = %s AND NOT (EXISTS (SELECT 1 \nFROM system_group \nWHERE system.id = system_group.system_id)) OR system.shared = %s AND (EXISTS (SELECT 1 \nFROM system_group \nWHERE system.id = system_group.system_id AND (EXISTS (SELECT 1 \nFROM tg_group, user_group AS user_group_2 \nWHERE tg_group.group_id = system_group.group_id AND tg_group.group_id = user_group_2.group_id AND %s = user_group_2.user_id))))) AND system.id = system_arch_map_1.system_id AND %s = system_arch_map_1.arch_id AND NOT (EXISTS (SELECT 1 \nFROM exclude_osmajor \nWHERE system.id = exclude_osmajor.system_id AND %s = exclude_osmajor.osmajor_id AND %s = exclude_osmajor.arch_id)) AND NOT (EXISTS (SELECT 1 \nFROM exclude_osversion \nWHERE system.id = exclude_osversion.system_id AND %s = exclude_osversion.osversion_id AND %s = exclude_osversion.arch_id)) AND distro.install_name = %s' ('Machine', 0, 149L, 149L, 149L, 'Automated', 149L, 149L, 1, 1, 149L, 1L, 3L, 1L, 165L, 1L, 'RHEL5.9-Server-20120417.0.n_nfs-i386')


specifically here:

(SELECT 1 \nFROM system_device_map, device \nWHERE system.id = system_device_map.system_id AND device.id = system_device_map.device_id AND )

I believe that additional AND is causing the query to explode.

Comment 14 Matěj Cepl 2012-04-24 12:09:47 UTC
I guess this should go back to ASSIGNED, shouldn't it?

Comment 15 Bill Peck 2012-04-24 12:24:08 UTC
(In reply to comment #14)
> I guess this should go back to ASSIGNED, shouldn't it?

Please try again on stage.  This should be resolved.


Note You need to log in before you can comment on or make changes to this bug.