diff options
author | Papoteur <papoteur@mageia.org> | 2020-11-28 21:37:11 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2020-11-28 21:37:11 +0100 |
commit | d4d4cba0dcbedf18ad8c35ffc515a485daf029cc (patch) | |
tree | 503ba6e9440093b19d0b95a4dd08fe3b84612021 /backend | |
parent | 467dda4bd88130b839971d0ddfb1ad68635939f4 (diff) | |
download | isodumper-d4d4cba0dcbedf18ad8c35ffc515a485daf029cc.tar isodumper-d4d4cba0dcbedf18ad8c35ffc515a485daf029cc.tar.gz isodumper-d4d4cba0dcbedf18ad8c35ffc515a485daf029cc.tar.bz2 isodumper-d4d4cba0dcbedf18ad8c35ffc515a485daf029cc.tar.xz isodumper-d4d4cba0dcbedf18ad8c35ffc515a485daf029cc.zip |
Add management of error when creating partition with fdisk
Diffstat (limited to 'backend')
-rwxr-xr-x | backend/raw_write.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/backend/raw_write.py b/backend/raw_write.py index a44eabe..58417f9 100755 --- a/backend/raw_write.py +++ b/backend/raw_write.py @@ -244,11 +244,32 @@ class Dumper(object): process = None working= False if rc != 0: - self.return_state = False - self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')) - logging.error(self.return_message) - self.finished.set() - return + if rc == 1: + # the error is Re-reading the partition table failed.: Device or resource busy + logging.error(_("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8'))) + logging.error(_("Try reloading partition table")) + p = Popen(["partprobe",target], stdin = PIPE, stderr=PIPE) + outs, errs = p.communicate() + working=True + while working: + time.sleep(0.5) + p.poll() + rc=p.returncode + if not (rc is None): + process = None + working= False + else: + self.return_state = False + self.return_message = _("Unable to reload the partition table: {}").format(errs.decode('utf-8')) + logging.error(self.return_message) + self.finished.set() + return + else: + self.return_state = False + self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')) + logging.error(self.return_message) + self.finished.set() + return logging.debug("New partition created") self._progress = 25 |