summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-08-23 21:25:52 +0000
committerJeremy Katz <katzj@redhat.com>2004-08-23 21:25:52 +0000
commit4fcc0f58700d3d4229f477998fb572774fcd0867 (patch)
tree15f19ab15631ee2c812fa95f698438a2e5019f1c /isys
parent00b96265652164d87166666f44155f03b3aecee2 (diff)
downloadanaconda-4fcc0f58700d3d4229f477998fb572774fcd0867.tar.gz
anaconda-4fcc0f58700d3d4229f477998fb572774fcd0867.tar.xz
anaconda-4fcc0f58700d3d4229f477998fb572774fcd0867.zip
some hacks to work around the lvm tools being stupid
* wipe md superblocks if we successfully create a pv (#130713) * disable filtering for all of our creates. I know better than the tools (#130706)
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.c33
-rw-r--r--isys/isys.py13
2 files changed, 46 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 164e5ea2e..c7aa46ebd 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -75,6 +75,7 @@ static PyObject * doLoSetup(PyObject * s, PyObject * args);
static PyObject * doUnLoSetup(PyObject * s, PyObject * args);
static PyObject * doLoChangeFd(PyObject * s, PyObject * args);
static PyObject * doDdFile(PyObject * s, PyObject * args);
+static PyObject * doWipeRaidSuperblock(PyObject * s, PyObject * args);
static PyObject * doGetRaidSuperblock(PyObject * s, PyObject * args);
static PyObject * doGetRaidChunkSize(PyObject * s, PyObject * args);
static PyObject * doDevSpaceFree(PyObject * s, PyObject * args);
@@ -124,6 +125,7 @@ static PyMethodDef isysModuleMethods[] = {
{ "raidstop", (PyCFunction) doRaidStop, METH_VARARGS, NULL },
{ "raidstart", (PyCFunction) doRaidStart, METH_VARARGS, NULL },
{ "getraidsb", (PyCFunction) doGetRaidSuperblock, METH_VARARGS, NULL },
+ { "wiperaidsb", (PyCFunction) doWipeRaidSuperblock, METH_VARARGS, NULL },
{ "getraidchunk", (PyCFunction) doGetRaidChunkSize, METH_VARARGS, NULL },
{ "lochangefd", (PyCFunction) doLoChangeFd, METH_VARARGS, NULL },
{ "losetup", (PyCFunction) doLoSetup, METH_VARARGS, NULL },
@@ -782,6 +784,37 @@ static PyObject * doFbconProbe (PyObject * s, PyObject * args) {
return Py_BuildValue("(iiss)", size, 0, "", "");
}
+static PyObject * doWipeRaidSuperblock(PyObject * s, PyObject * args) {
+ int fd;
+ unsigned long size;
+ struct md_superblock_s * sb;
+
+ if (!PyArg_ParseTuple(args, "i", &fd)) return NULL;
+
+ if (ioctl(fd, BLKGETSIZE, &size)) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ /* put the size in 1k blocks */
+ size >>= 1;
+
+ if (lseek64(fd, ((off64_t) 1024) * (off64_t) MD_NEW_SIZE_BLOCKS(size), SEEK_SET) < 0) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ sb = malloc(sizeof(struct md_superblock_s));
+ sb = memset(sb, '\0', sizeof(struct md_superblock_s));
+
+ if (write(fd, sb, sizeof(sb)) != sizeof(sb)) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ return Py_None;
+}
+
static PyObject * doGetRaidSuperblock(PyObject * s, PyObject * args) {
int fd;
unsigned long size;
diff --git a/isys/isys.py b/isys/isys.py
index 8190359a1..8c09ebf48 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -78,6 +78,19 @@ def raidstart(mdDevice, aMember):
os.close(fd)
os.remove("/tmp/member")
+def wipeRaidSB(device):
+ try:
+ fd = os.open(device, O_WRONLY)
+ except OSError, e:
+ log("error wiping raid device superblock for %s: %s", device, e)
+ return
+
+ try:
+ _isys.wiperaidsb(fd)
+ finally:
+ os.close(fd)
+ return
+
def raidsb(mdDevice):
makeDevInode(mdDevice, "/tmp/md")
return raidsbFromDevice("/tmp/md")