context: wipe new partitions by default

Enable partition wipe to remove any old filesystem/RAID signature when
adding a new partition.

For example, when adding a new partition in the same start/end where a
previous filesystem was created.
master
Jose M. Guisado 2023-03-22 12:50:48 +01:00
parent e4b2964ee0
commit 0352d77335
1 changed files with 5 additions and 0 deletions

View File

@ -193,6 +193,11 @@ static PyObject *Context_add_partition(ContextObject *self, PyObject *args, PyOb
PyErr_Format(PyExc_RuntimeError, "Error adding partition to context: %s", strerror(-rc));
return NULL;
}
rc = fdisk_wipe_partition(self->cxt, partno, 1);
if (rc < 0) {
PyErr_Format(PyExc_RuntimeError, "Error setting wipe for new partition: %s", strerror(-rc));
return NULL;
}
return Py_BuildValue("n", partno);
}