home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!lwvanels
- From: lwvanels@athena.mit.edu (Lucien W. Van Elsen)
- Newsgroups: comp.unix.aix
- Subject: Re: LVM Question. How to get Vg_Id from VG Name ?
- Message-ID: <LWVANELS.92Aug26082903@fionavar.mit.edu>
- Date: 26 Aug 92 12:29:10 GMT
- References: <Aug.25.17.11.23.1992.17815@gauss.rutgers.edu>
- Sender: news@athena.mit.edu (News system)
- Reply-To: lwvanels@MIT.EDU
- Followup-To: comp.unix.aix
- Organization: Massachusetts Institute of Technology
- Lines: 38
- In-Reply-To: manmetha@gauss.rutgers.edu's message of 25 Aug 92 21:11:24 GMT
- Nntp-Posting-Host: fionavar.mit.edu
-
-
- manmetha@gauss.rutgers.edu (Rajesh Malhotra) writes:
- > How do I get information on a volume group using the
- > volume group name? All the routines viz. lvm_queryvg, lvm_varyoffvg,
- > lvm_varyonvg need the Vg_id. What routine would give me a Vg_id,
- > given a Volume Group Name?
-
- This is stored in the CuAt class of the ODM database. This program
- (compiled with cc -o foo foo.c -lodm -lcfg) retrives the unique id for a
- given volume group name:
-
- #include <sys/cfgodm.h>
- #include <odmi.h>
-
- main(int argc, char *argv[])
- {
- struct CuAt *found;
- struct listinfo li;
- char buf[256];
-
- sprintf(buf,"attribute = vgserial_id and name = %s",argv[1]);
-
- odm_initialize();
- found = (struct CuAt *) odm_get_obj(CuAt_CLASS,buf,NULL,ODM_FIRST);
- if ((int) found == -1) {
- printf("odm error: %d\n",odmerrno);
- exit(1);
- } else {
- printf ("vg '%s' has unique id '%s'\n", found->name, found->value);
- }
- }
-
- -Lucien
-
- ----------------------------------------------------------------------------
- Lucien Van Elsen | lwvanels@mit.edu
- | The secret to a long life is knowing when
- | it's time to go..
-