From: Andreas Dilger <adilger@turbolinux.com>
To: linux-lvm@sistina.com
Subject: Re: [linux-lvm] vgscan won't recognize my VG
Date: Tue, 20 Mar 2001 12:25:30 -0700 (MST) [thread overview]
Message-ID: <200103201925.f2KJPVm02621@webber.adilger.int> (raw)
In-Reply-To: <3AB7A6F4.4EFA644D@in.tum.de> from David Vidal Rodriguez at "Mar 20, 2001 07:52:37 pm"
David Vidal R. (vidalrod@in.tum.de) writes:
> OK, I have compiled the beta6 tools.
>
> 1) How do I know if the clean linus-2.4.0 kernel has a beta2 lvm module?
cat /proc/lvm/global will tell you.
> 2) And how do I repair the UUIDs of my PVs?
You should be able to do "vgcfgrestore" and it will write the UUIDs to
disk correctly (creating new ones if needed).
> 3) Could you tell me where can I download the patch you mentioned?
Patch below. Only needed if you have < beta6 kernel code. It probably
should be put into the standard tools, however, because a lot of people
are still using beta2 kernel code.
Cheers, Andreas
=========================================================================
diff -u -u -r1.2.2.8 vg_create_remove.c
--- tools/lib/vg_create_remove.c 2001/02/20 11:52:44 1.2.2.8
+++ tools/lib/vg_create_remove.c 2001/03/16 16:54:54
@@ -36,57 +36,63 @@
#include <liblvm.h>
-/* internal function */
-int vg_create_remove ( char *, vg_t *, int);
+static int vg_create_remove ( const char *lvm_dev_name, vg_t *vg, int ioc)
+{
+ int lvm_dev;
+ int ret = 0;
+ if ( ( lvm_dev = open ( lvm_dev_name, O_RDWR)) == -1)
+ ret = -LVM_EVG_CREATE_REMOVE_OPEN;
+ else {
+ debug ( "vg_create_remove -- IOCTL %x on %s with VG ptr %p\n",
+ ioc, lvm_dev_name, vg);
+ if ( ( ret = ioctl ( lvm_dev, ioc, vg)) == -1)
+ ret = -errno;
+ debug ( "vg_create_remove -- IOCTL returned: %d\n", ret);
+ close ( lvm_dev);
+ }
-int vg_create ( char *vg_name, vg_t *vg) {
- return vg_create_remove ( vg_name, vg, VG_CREATE);
+ return ret;
}
-int vg_remove ( char *vg_name) {
- return vg_create_remove ( vg_name, NULL, VG_REMOVE);
-}
+int vg_create ( vg_t *vg)
+{
+ int ret;
+
+ debug_enter ( "vg_create -- CALLED with VG %s\n", vg ? vg->vg_name: "NULL");
+
+ ret = vg_check_consistency ( vg);
+ if (ret == 0) {
+ ret = vg_create_remove ( LVM_DEV, (void *)vg, VG_CREATE);
+#ifdef VG_CREATE_OLD
+ if (ret == -EINVAL) {
+ char lvm_dev_name[NAME_LEN];
-
-int vg_create_remove ( char *vg_name, vg_t *vg, int cr) {
- int lvm_dev = -1;
- int ret = 0;
- char lvm_dev_name[NAME_LEN];
-
- debug_enter ( "vg_create_remove -- CALLED\n");
+ sprintf ( lvm_dev_name, LVM_DIR_PREFIX "%s/group", vg->vg_name);
+ ret = vg_create_remove ( lvm_dev_name, (void *)vg, VG_CREATE_OLD);
+ }
+#endif
+ }
- switch ( cr) {
- case VG_CREATE:
- strcpy(lvm_dev_name, LVM_DEV);
- if ( vg_name == NULL ||
- vg == NULL ||
- vg_check_name ( vg_name) < 0 ||
- vg_check_consistency ( vg) < 0) ret = -LVM_EPARAM;
- break;
-
- case VG_REMOVE:
- sprintf(lvm_dev_name, LVM_DIR_PREFIX "%s/group", vg_name);
- if ( vg_name == NULL ||
- vg_check_name ( vg_name) < 0) ret = -LVM_EPARAM;
- break;
+ debug_leave ( "vg_create -- LEAVING with ret: %d\n", ret);
+ return ret;
+}
- default:
- ret = -LVM_EPARAM;
- }
+int vg_remove ( char *vg_name)
+{
+ int ret;
+
+ debug_enter ( "vg_remove -- CALLED with VG %s\n", vg_name);
+
+ ret = vg_check_name ( vg_name);
+ if (ret == 0) {
+ char lvm_dev_name[NAME_LEN];
- if ( ret == 0) {
- if ( ( lvm_dev = open ( lvm_dev_name, O_RDWR)) == -1)
- ret = -LVM_EVG_CREATE_REMOVE_OPEN;
- else {
- debug ( "vg_create_remove -- IOCTL\n");
- if ( ( ret = ioctl ( lvm_dev, cr, vg)) == -1) ret = -errno;
- debug ( "vg_create_remove -- IOCTL returned: %d\n", ret);
- }
- if ( lvm_dev != -1) close ( lvm_dev);
+ sprintf ( lvm_dev_name, LVM_DIR_PREFIX "%s/group", vg_name);
+ ret = vg_create_remove ( lvm_dev_name, NULL, VG_REMOVE);
}
- debug_leave ( "vg_create_remove -- LEAVING with ret: %d\n", ret);
+ debug_leave ( "vg_remove -- LEAVING with ret: %d\n", ret);
return ret;
}
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
next prev parent reply other threads:[~2001-03-20 19:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-19 20:13 [linux-lvm] vgscan won't recognize my VG David Vidal Rodriguez
2001-03-19 20:37 ` Andreas Dilger
2001-03-20 18:52 ` David Vidal Rodriguez
2001-03-20 19:17 ` AJ Lewis
2001-03-20 19:25 ` Andreas Dilger [this message]
2001-03-20 19:35 ` David Vidal Rodriguez
2001-03-20 20:00 ` David Vidal Rodriguez
2001-03-20 20:21 ` Andreas Dilger
2001-03-20 20:36 ` David Vidal Rodriguez
2001-03-21 0:29 ` Kirth
2001-03-21 18:30 ` David Vidal Rodriguez
2001-03-21 19:17 ` Andreas Dilger
2001-03-23 14:55 ` David Vidal Rodriguez
2001-03-23 22:36 ` Andreas Dilger
2001-03-20 20:57 ` [linux-lvm] LVM and fault tolerance Anders Widman
2001-03-21 17:33 ` Lars Kellogg-Stedman
2001-03-22 23:59 ` Anders Widman
[not found] ` <0103262137020G.01456@lyta>
2001-03-27 21:48 ` Anders Widman
2001-03-27 21:56 ` Ragnar Kjørstad
2001-03-27 22:29 ` Anders Widman
2001-03-27 22:45 ` Ragnar Kjørstad
2001-03-28 6:43 ` Russell Coker
2001-03-31 17:17 ` Anders Widman
2001-03-20 20:23 ` [linux-lvm] vgscan won't recognize my VG José Luis Domingo López
2001-03-20 19:31 ` AJ Lewis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103201925.f2KJPVm02621@webber.adilger.int \
--to=adilger@turbolinux.com \
--cc=linux-lvm@sistina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).