home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / aix / 9094 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.7 KB  |  54 lines

  1. Path: sparky!uunet!olivea!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!lwvanels
  2. From: lwvanels@athena.mit.edu (Lucien W. Van Elsen)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: LVM Question. How to get Vg_Id from VG Name ?
  5. Message-ID: <LWVANELS.92Aug26082903@fionavar.mit.edu>
  6. Date: 26 Aug 92 12:29:10 GMT
  7. References: <Aug.25.17.11.23.1992.17815@gauss.rutgers.edu>
  8. Sender: news@athena.mit.edu (News system)
  9. Reply-To: lwvanels@MIT.EDU
  10. Followup-To: comp.unix.aix
  11. Organization: Massachusetts Institute of Technology
  12. Lines: 38
  13. In-Reply-To: manmetha@gauss.rutgers.edu's message of 25 Aug 92 21:11:24 GMT
  14. Nntp-Posting-Host: fionavar.mit.edu
  15.  
  16.  
  17.  manmetha@gauss.rutgers.edu (Rajesh Malhotra) writes:
  18. >       How do I get information on a volume group using the
  19. >   volume group name? All the routines viz. lvm_queryvg, lvm_varyoffvg,
  20. >   lvm_varyonvg need the Vg_id. What routine would give me a Vg_id,
  21. >   given a Volume Group Name?
  22.  
  23. This is stored in the CuAt class of the ODM database.  This program
  24. (compiled with cc -o foo foo.c -lodm -lcfg) retrives the unique id for a
  25. given volume group name:
  26.  
  27. #include <sys/cfgodm.h>
  28. #include <odmi.h>
  29.  
  30. main(int argc, char *argv[])
  31. {
  32.   struct CuAt *found;
  33.   struct listinfo li;
  34.   char buf[256];
  35.  
  36.   sprintf(buf,"attribute = vgserial_id and name = %s",argv[1]);
  37.  
  38.   odm_initialize();
  39.   found = (struct CuAt *) odm_get_obj(CuAt_CLASS,buf,NULL,ODM_FIRST);
  40.   if ((int) found == -1) {
  41.     printf("odm error: %d\n",odmerrno);
  42.     exit(1);
  43.   } else {
  44.     printf ("vg '%s' has unique id '%s'\n", found->name, found->value);
  45.   }
  46. }
  47.  
  48.         -Lucien
  49.  
  50. ----------------------------------------------------------------------------
  51. Lucien Van Elsen               | lwvanels@mit.edu
  52.                    | The secret to a long life is knowing when
  53.                    | it's time to go..
  54.