I almost formatted the $HOME disk of a VM guest because it showed up as dasda in the dialog. This patch lists it as dasda(0191) instead. Karsten -- Karsten Hopp <karsten@xxxxxxxxx> GPG 1024D/70ABD02C Fingerprint D2D4 3B6B 2DE4 464C A432 210A DFF8 A140 70AB D02C Red Hat Deutschland, Hauptstaetter Str.58 70178 Stuttgart, Tel.+49-711-96437-0, Fax +49-711-96437-111
Index: partedUtils.py =================================================================== RCS file: /usr/local/CVS/anaconda/partedUtils.py,v retrieving revision 1.58 diff -u -r1.58 partedUtils.py --- partedUtils.py 19 May 2004 04:09:10 -0000 1.58 +++ partedUtils.py 16 Jun 2004 13:27:46 -0000 @@ -804,7 +804,7 @@ # FIXME: need the right fix for z/VM formatted dasd if iutil.getArch() == "s390" and isys.getDasdState(drive): rc = intf.messageWindow(_("Warning"), - _("The partition table on device %s was unreadable. " + _("The partition table on device %s(%s) was unreadable. " "To create new partitions it must be initialized, " "causing the loss of ALL DATA on this drive.\n\n" "This operation will override any previous " @@ -812,7 +812,7 @@ "ignore.\n\n" "Would you like to initialize this drive, " "erasing ALL DATA?") - % (drive,), type = "yesno") + % (drive, isys.getDasdPort(drive)), type = "yesno") if rc == 0: DiskSet.skippedDisks.append(drive) continue @@ -855,6 +855,10 @@ DiskSet.skippedDisks.append(drive) continue else: + if iutil.getArch() == "s390": + format = drive + "(" + isys.getDasdPort(drive) + ")" + else: + format = drive rc = intf.messageWindow(_("Warning"), _("The partition table on device %s was unreadable. " "To create new partitions it must be initialized, " @@ -864,7 +868,7 @@ "ignore.\n\n" "Would you like to initialize this drive, " "erasing ALL DATA?") - % (drive,), type = "yesno") + % (format,), type = "yesno") if rc == 0: DiskSet.skippedDisks.append(drive) continue Index: isys/dasd.c =================================================================== RCS file: /usr/local/CVS/anaconda/isys/dasd.c,v retrieving revision 1.6 diff -u -r1.6 dasd.c --- isys/dasd.c 15 Jun 2004 14:14:47 -0000 1.6 +++ isys/dasd.c 16 Jun 2004 13:27:46 -0000 @@ -133,3 +133,30 @@ return ports; #endif } + +char *getDasdPort(char *device) { +#if !defined(__s390__) && !defined(__s390x__) + return NULL; +#else + char line[100]; + char devname[7]; + char *port = NULL; + FILE *fd; + fd = fopen ("/proc/dasd/devices", "r"); + if(!fd) { + return NULL; + } + if (!strncmp(device, "/dev/", 5)) + device += 5; + while (fgets (line, 100, fd) != NULL) { + if ((strstr(line, device) != NULL)) { + port = (char *)malloc(10*sizeof(char)); + sscanf (line, "%[A-Za-z.0-9](ECKD) at ( %*d: %*d) is %s : %*s", port, devname); + port += 4; /* return only 0200 instead of 0.0.0200 */ + break; + } + } + if (fd) fclose(fd); + return port; +#endif +} Index: isys/isys.c =================================================================== RCS file: /usr/local/CVS/anaconda/isys/isys.c,v retrieving revision 1.128 diff -u -r1.128 isys.c --- isys/isys.c 15 Apr 2004 17:52:51 -0000 1.128 +++ isys/isys.c 16 Jun 2004 13:27:46 -0000 @@ -104,6 +104,7 @@ static PyObject * hasIdeRaidMagic(PyObject * s, PyObject * args); static PyObject * start_bterm(PyObject * s, PyObject * args); static PyObject * py_getDasdPorts(PyObject * s, PyObject * args); +static PyObject * py_getDasdPort(PyObject * s, PyObject * args); static PyObject * py_isUsableDasd(PyObject * s, PyObject * args); static PyObject * py_isLdlDasd(PyObject * s, PyObject * args); static PyObject * doGetMacAddress(PyObject * s, PyObject * args); @@ -160,6 +161,7 @@ { "hasIdeRaidMagic", (PyCFunction) hasIdeRaidMagic, METH_VARARGS, NULL }, { "startBterm", (PyCFunction) start_bterm, METH_VARARGS, NULL }, { "getDasdPorts", (PyCFunction) py_getDasdPorts, METH_VARARGS, NULL}, + { "getDasdPort", (PyCFunction) py_getDasdPort, METH_VARARGS, NULL}, { "isUsableDasd", (PyCFunction) py_isUsableDasd, METH_VARARGS, NULL}, { "isLdlDasd", (PyCFunction) py_isLdlDasd, METH_VARARGS, NULL}, { "getMacAddress", (PyCFunction) doGetMacAddress, METH_VARARGS, NULL}, @@ -1312,6 +1314,13 @@ if (!PyArg_ParseTuple(args, "")) return NULL; return Py_BuildValue("s", getDasdPorts()); +} + +static PyObject * py_getDasdPort(PyObject * o, PyObject * args) { + char *devname; + if (!PyArg_ParseTuple(args, "s", &devname)) + return NULL; + return Py_BuildValue("s", getDasdPort(devname)); } static PyObject * py_isUsableDasd(PyObject * o, PyObject * args) { Index: isys/isys.h =================================================================== RCS file: /usr/local/CVS/anaconda/isys/isys.h,v retrieving revision 1.20 diff -u -r1.20 isys.h --- isys/isys.h 18 Feb 2004 00:46:33 -0000 1.20 +++ isys/isys.h 16 Jun 2004 13:27:46 -0000 @@ -21,6 +21,7 @@ /* dasd functions */ char *getDasdPorts(); +char *getDasdPort(char * device); int isLdlDasd(char * dev); int isUsableDasd(char *device); Index: isys/isys.py =================================================================== RCS file: /usr/local/CVS/anaconda/isys/isys.py,v retrieving revision 1.124 diff -u -r1.124 isys.py --- isys/isys.py 13 May 2004 16:08:44 -0000 1.124 +++ isys/isys.py 16 Jun 2004 13:27:46 -0000 @@ -327,6 +327,9 @@ def getDasdPorts(): return _isys.getDasdPorts() +def getDasdPort(device): + return _isys.getDasdPort(device) + def isUsableDasd(device): return _isys.isUsableDasd(device)