vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm writing a C program to check the status of each PV in a VG and it's proving somewhat harder than anticipated. First I can't find a way to determine the VGID for a given volume group name, so I hard-coded that part. I did the same with a PVID as well, just for testing. I then found that I couldn't get lvm_querypv to return success no matter what combination of VGID, PVID, and PVName arguaments that I supplied. Does anyone know how to get this call to work? I'm running AIX 4.3.3 ML 09. I've assumed that the 16-digit VGID as reported by 'lsvg rootvg' should be supplied in 4 goups of 4 hex digits to the word1, word2, word3, and word4 elements of the unique_id structure for VG_ID, and similar with 'lsv hdisk0' for the PV_ID. My code is embedded below. With PVName = "/dev/junk" I get "Invalid device entry" which is reasonable, but with "/dev/hdisk0" I get "Invalid parameter" which surprised me. Replacing PVName with NULL, I get status = -100, ie the VG is offline. That's quite disappointing. And yes, I'm running it as root. Anyone got a useful suggestion? TIA Jeffrey #include <lvm.h> main () { struct unique_id VG_ID; struct unique_id PV_ID; struct querypv *QueryPV; char PVName[20] = "/dev/hdisk0"; int status; /* dilbert rootvg vgid 00019b0a5e4e69ea */ VG_ID.word1 = 0x0001; VG_ID.word2 = 0x9b0a; VG_ID.word3 = 0x5e4e; VG_ID.word4 = 0x69ea; /* dilbert hdisk0 (rootvg) pvid 00019b0a89184fbe */ PV_ID.word1 = 0x0001; PV_ID.word2 = 0x9b0a; PV_ID.word3 = 0x8918; PV_ID.word4 = 0x4fbe; status = lvm_querypv (&VG_ID, &PV_ID, &QueryPV, PVName); printf ("QueryPV = %x\n", QueryPV); printf ("lvm_querypv\n\tVG_ID = 0x%04x%04x%04x%04x\n\tPV_ID = 0x%04x%04x%04x%04x\n\tPVName = \"%s\"\n\tstatus = %d\n", VG_ID.word1, VG_ID.word2, VG_ID.word3, VG_ID.word4, PV_ID.word1, PV_ID.word2, PV_ID.word3, PV_ID.word4, PVName, status); switch (status) { case LVM_OFFLINE: printf ("VG is offline - vary on the VG\n"); break; case LVM_INVALID_PARAM: printf ("Invalid parameter\n"); break; case LVM_PVOPNERR: printf ("PV open error\n"); break; case LVM_NOTVGMEM: printf ("PV is not a VG member\n"); break; case LVM_INVCONFIG: printf ("Invalid device driver configuration\n"); break; case LVM_INV_DEVENT: printf ("Invalid device entry\n"); break; } ; exit (status); } |