Skip to content
Snippets Groups Projects
Commit d466e91d authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Workaround a libguestfs e2fsck bug

Workaround the bug that libguestfs may raise a RuntimeError even if the
command runs successfully, due to the fact that the command exited with
non-zero exit status.
parent 1ea62448
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2014 GRNET S.A.
# Copyright (C) 2011-2015 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -361,10 +361,17 @@ class Image(object):
part_dev = "%s%d" % (self.guestfs_device, last_part['part_num'])
if self.check_guestfs_version(1, 15, 17) >= 0:
self.g.e2fsck(part_dev, forceall=1)
else:
self.g.e2fsck_f(part_dev)
try:
if self.check_guestfs_version(1, 15, 17) >= 0:
self.g.e2fsck(part_dev, forceall=1)
else:
self.g.e2fsck_f(part_dev)
except RuntimeError as e:
# There is a bug in some versions of libguestfs and a RuntimeError
# is thrown although the command has successfully corrected the
# found file system errors.
if e.message.find('***** FILE SYSTEM WAS MODIFIED *****') == -1:
raise
self.g.resize2fs_M(part_dev)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment