summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-12-28 22:17:22 +0000
committerMatt Wilson <msw@redhat.com>1999-12-28 22:17:22 +0000
commitc93a435464a19a1cbca933130e8f76e06ce61582 (patch)
tree24e46cad2f2f9f7973dfbd8020ecfcb1703fd277 /isys
parentb7ef719e9d03a64316e388a55038a4350c8173bf (diff)
downloadanaconda-c93a435464a19a1cbca933130e8f76e06ce61582.tar.gz
anaconda-c93a435464a19a1cbca933130e8f76e06ce61582.tar.xz
anaconda-c93a435464a19a1cbca933130e8f76e06ce61582.zip
changes for raid upgrades (not done yet)
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.c39
-rw-r--r--isys/isys.py23
2 files changed, 62 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 5be528ef6..729574eac 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -47,8 +47,12 @@ static PyObject * doLoSetup(PyObject * s, PyObject * args);
static PyObject * doUnLoSetup(PyObject * s, PyObject * args);
static PyObject * doDdFile(PyObject * s, PyObject * args);
static PyObject * doGetRaidSuperblock(PyObject * s, PyObject * args);
+static PyObject * doRaidStart(PyObject * s, PyObject * args);
+static PyObject * doRaidStop(PyObject * s, PyObject * args);
static PyMethodDef isysModuleMethods[] = {
+ { "raidstop", (PyCFunction) doRaidStop, METH_VARARGS, NULL },
+ { "raidstart", (PyCFunction) doRaidStart, METH_VARARGS, NULL },
{ "getraidsb", (PyCFunction) doGetRaidSuperblock, METH_VARARGS, NULL },
{ "losetup", (PyCFunction) doLoSetup, METH_VARARGS, NULL },
{ "unlosetup", (PyCFunction) doUnLoSetup, METH_VARARGS, NULL },
@@ -943,3 +947,38 @@ static PyObject * doGetRaidSuperblock(PyObject * s, PyObject * args) {
sb.set_magic, sb.level, sb.nr_disks,
sb.raid_disks, sb.md_minor);
}
+
+static PyObject * doRaidStop(PyObject * s, PyObject * args) {
+ int fd;
+
+ if (!PyArg_ParseTuple(args, "i", &fd)) return NULL;
+
+ if (ioctl(fd, STOP_ARRAY, 0)) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject * doRaidStart(PyObject * s, PyObject * args) {
+ int fd;
+ char * dev;
+ struct stat sb;
+
+ if (!PyArg_ParseTuple(args, "is", &fd, &dev)) return NULL;
+
+ if (stat(dev, &sb)) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ if (ioctl(fd, START_ARRAY, sb.st_rdev)) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
diff --git a/isys/isys.py b/isys/isys.py
index efcd55437..374282c35 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -3,6 +3,29 @@ import _isys
import string
import os
+def raidstop(mdDevice):
+ makeDevInode(mdDevice, "/tmp/md")
+ fd = os.open("/tmp/md", os.O_RDONLY)
+ os.remove("/tmp/md")
+ _isys.raidstop(fd)
+ os.close(fd)
+
+def raidstart(mdDevice, aMember):
+ makeDevInode(mdDevice, "/tmp/md")
+ makeDevInode(aMember, "/tmp/member")
+ fd = os.open("/tmp/md", os.O_RDONLY)
+ os.remove("/tmp/md")
+ _isys.raidstart(fd, "/tmp/member")
+ os.close(fd)
+ os.remove("/tmp/member")
+
+def raidsb(mdDevice):
+ makeDevInode(mdDevice, "/tmp/md")
+ fd = os.open("/tmp/md", os.O_RDONLY)
+ rc = _isys.getraidsb(fd)
+ os.close(fd)
+ return rc
+
def losetup(device, file):
loop = os.open(device, os.O_RDONLY)
targ = os.open(file, os.O_RDWR)