Re: [PATCH osinfo-db 00/10] usb3 and misc device tweaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/01/2018 02:56 AM, Fabiano Fidêncio wrote:
On Fri, 2018-09-28 at 14:25 -0400, Cole Robinson wrote:
This series is a collection of device annotation cleanups,
improvements, and additions.

1-4 are cleanups
5-7 add more annotations for existing devices
8-10 add usb3 device annotations

Thanks,
Cole

Reviewed-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>

And I'm also pushing this series.


Thanks!

Cole, checking those devices manually seems to be a not so nice work to
do and also quite error prone (in the way that we may just add more
duplications at any time). I do believe that having a test for this
would be the ideal situation. What do you think? In case you don't have
time to work on this, would you mind filling a bug some we can at least
keep track of this?


Yeah tracking this is hard right now. I wrote a script to do a text dump of an os, its devices and resources. Attached below. I was thinking of adding something like 'osinfo-query dump <short-id>' to do the same thing.

Adding a test to catch duplicates is definitely a good idea. I will file a bug, but where? I realized last week we have bugzilla.redhat.com product=Virtualization Tools component=libosinfo, but there's also the issue tracker in gitlab that has some reports as well.

I don't have any strong preference for either: bugzilla is more a part of my workflow but its less discoverable and more overhead for new contributors. I think we should pick one though and disable the other

Thanks,
Cole
#!/usr/bin/env python3

import os
import pprint
import sys

os.environ["OSINFO_SYSTEM_DIR"] = "/home/crobinso/src/osinfo-db/data"
sys.path.insert(0, "/home/crobinso/src/virt-manager/")
from virtinst import OSDB

if len(sys.argv) != 2:
    print("USAGE: %s <short-id>" % (os.path.basename(sys.argv[0])))
    sys.exit(1)

short_id = sys.argv[1]



def smart_dir(_o):
    # Find all Libosinfo get_ functions for the passed object
    _dir = []
    for f in dir(_o):
        if not f.startswith("get_"):
            continue
        if f.startswith("get_param_"):
            continue

        attr = getattr(_o, f)
        if (hasattr(attr, "get_namespace") and
            getattr(_o, f).get_namespace() == "Libosinfo"):
            _dir.append(f)
    return _dir


o = OSDB.lookup_os(short_id)._os
ldir = smart_dir(o)
def p(fieldname, func):
    val = getattr(o, func)()
    ldir.remove(func)
    print("%-12s: %s" % (fieldname, val))


p("id", "get_id")
p("vendor", "get_vendor")
p("short-id", "get_short_id")
p("name", "get_name")
p("release-date", "get_release_date_string")
p("eol-date", "get_eol_date_string")
p("version", "get_version")
p("codename", "get_codename")
p("family", "get_family")
p("distro", "get_distro")
p("logo", "get_logo")
p("release-status", "get_release_status")


print("\nDevices:")
devs = o.get_all_devices()
for idx in range(devs.get_length()):
    devobj = devs.get_nth(idx)
    print("  name=%-20s class=%s" %
            (devobj.get_name(), devobj.get_class()))

print("\nMinimum Resources:")
resources = o.get_minimum_resources()
for resobj in [resources.get_nth(i) for i in range(resources.get_length())]:
    print("  arch=%s: ram=%-5s cpu=%s n-cpus=%s storage=%s" %
            (resobj.get_architecture(), resobj.get_ram(), resobj.get_cpu(),
             resobj.get_n_cpus(), resobj.get_storage()))


print("\nRecommended Resources:")
resources = o.get_recommended_resources()
for resobj in [resources.get_nth(i) for i in range(resources.get_length())]:
    print("  arch=%s: ram=%-5s cpu=%s n-cpus=%s storage=%s" %
            (resobj.get_architecture(), resobj.get_ram(), resobj.get_cpu(),
             resobj.get_n_cpus(), resobj.get_storage()))

#pprint.pprint(ldir)
_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux