AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  How to get VPD information programmatically?

    Posted Fri April 25, 2008 06:04 PM

    Originally posted by: SystemAdmin


    Hi folks.

    I’m trying to get VPD data for hard drives on a system programmatically (via my own code). Specifically, I’m after information about the disks on the system. I’d like the manufacturer/model, size of the disk, the interface of the disk (SCSI, etc), and the disk geometry if possible. I can get most of the data I need by running ‘lscfg’, but I’d like to pick this up via my own program rather than run that from a program and parse the results. So, for example, “lscfg –vpl hdisk0” will give me the VPD data for hdisk0.

    What I’ve figured out so far: VPD (Vital Product Data) is a subset of the ODM (Object Data Manager), a database on the system that contains, among other things, entries for each hardware device on your system. I’ve read up on ODM (which has an API interface), and learned that what I need is odminitialize() / odmterminate(), odm_open_class(), and odm_get_first() / odm_get_next().

    I think the data that I want is in class CuVPD, which (according to “odmshow CuVPD”) has:

    class CuVPD {
    char name16; /* offset: 0xc ( 12) */
    short vpd_type; /* offset: 0x1c ( 28) */
    longchar vpd512; /* offset: 0x1e ( 30) */
    };
    /*
    columns: 3
    structsize: 0x220 (544) bytes
    data offset: 0x20002eb8
    population: 25 objects (25 active, 0 deleted)
    */

    The first problem I encountered: the VPD appears to be in “longchar vpd512;”, which (near as I can tell) is device-specific. As I said above, I’m after hard disk drive data. So I’d like the hard drive manufacturer, model, size, and if possible, drive geometry information (total tracks/cylinders/heads), as well as the interface type (SCSI, IDE, etc). But I can’t tell where in that 512 bytes the data that I want is since I’ve been unable to find any documentation on how “longchar vpd512” is laid out for disk drives.

    The second problem: To use a class in ODM, you need the class ID (which is created when calling utility odmcreate with your class definition). I’ve been unable to find documentation on what the class ID Is for CuVPD, so I can’t call odm_get_first() / odm_get_next() – I need that class ID. I can’t find a header file or anything that has this information.

    Basically, in short: I’d like to look up hard drive information (manufacturer, model, size, disk geometry if possible) via an API on AIX, and I need enough information to be able to do that. Thank you SO MUCH for your help!

    /Jeff
    #AIX-Forum


  • 2.  Re: How to get VPD information programmatically?

    Posted Mon April 28, 2008 04:46 PM

    Originally posted by: nagger


    Why? Why? Why?
    OK feel better now - but I have to ask what is the point? What do you intend doing with this information?

    Been here, done that and I think you are doomed to failure here.
    As far as I can workout from trying this over years: every disk vendor does "their own thing" and the data and format in the ODM is different. Even the units MB/GB are different.

    This highlights the fact that the ODM is just a bunch of random free format strings.
    As AIX over the years has supported 100's of disk types and sizes you are on a road to know where trying to make an API to fit everything because tomorrow a new disk will break your code.
    Besides disks don't have geometry any more - AIX has no idea where a SAN LUN is on the disk or disk(s) then you add a SVC and no one know which continent your data could be on :-)

    Hope this puts out off the idea, thanks N
    #AIX-Forum


  • 3.  Re: How to get VPD information programmatically?

    Posted Mon April 28, 2008 10:14 PM

    Originally posted by: SystemAdmin


    I understand the issue with disk geometry. If I can't get "usable" numbers for that, so be it.

    I'm interested in disk information because I'm writing a management monitoring application that needs to report on such information. Getting information like the total size of a physical disk is a totally reasonable thing to do, for example. Getting manufacturer/model information is reasonable as well. This is information I can get from Redhat, Suse, Sun (x86 and Sparc), and HP. But so far, I've been unable to do this from AIX.

    If you look at, say, OpenPegasus (not ported to AIX today, I don't believe), or other CIM management applications, this sort of data is stuff that management applications generally return about a host (along with a slew of other information).

    If I'm "doomed to failure here", as you say, then that's strictly the case for AIX - I'm successfully doing this for other UNIX/Linux platforms today. Are you saying this is a restriction in that AIX can't give me this information?

    /Jeff

    Message was edited by: JeffCof
    #AIX-Forum


  • 4.  Re: How to get VPD information programmatically?

    Posted Tue April 29, 2008 04:15 AM

    Originally posted by: tony.evans


    There's no restriction, but you've already come across the main hurdle.

    Personally, I would embrace the UNIX philosophies,

    1. don't re-invent anything
    2. keep it simple

    If lscfg gives you the information you need, use lscfg, let someone else put in the effort of understanding the structures and build upon their success.
    #AIX-Forum


  • 5.  Re: How to get VPD information programmatically?

    Posted Tue April 29, 2008 08:26 AM

    Originally posted by: SystemAdmin


    Are you an end-user that's trying to help, or are you an IBM employee where release of this information is, for some reason, restricted?

    We have very firm technical reasons for not using 'lscfg' for this, and the reasons make lots of sense when developing an application such as ours.

    If you're from IBM, and you need these reasons to decide if the ODM API should be fully documented, I'll be happy to engage you on this (perhaps privately?). Otherwise, thanks for your help, but we really need this information PROGRAMMATICALLY (as I said in my original posting).

    Message was edited by: JeffCof
    #AIX-Forum


  • 6.  Re: How to get VPD information programmatically?

    Posted Tue April 29, 2008 09:04 AM

    Originally posted by: tony.evans


    Er, when I post on here, I'm just some guy trying to help some other guys in my spare time.

    I don't speak for IBM, or anyone other than me.

    I've written a lot of data collection stuff on AIX, and it's always been easier, more robust, and lasted longer when I've used the tools already in place to query the OS.

    I have no clue how the back-end works, and haven't needed to, you may get further asking in the development forum, this tends to be more sys-admin related.
    #AIX-Forum