From: Artem Bityutskiy Date: Mon, 24 Jun 2013 10:12:42 +0000 (+0300) Subject: ExtDiskMount: fix the UUID feature for extX X-Git-Tag: 0.20~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4ee528a8578afebb26ae21d57b1791361acc1ee;p=tools%2Fmic.git ExtDiskMount: fix the UUID feature for extX The current implementation of ExtDiskMount is strange. Instead of generating a random UUID and then ask mkfs.extX to use that UUID, it run mkfs.extX without -U, let's mkfs.extX generate a random UUID, and then uses e2fsdump and parses its output. This is not very logical, and this also does not work with the version of mkfs that we use at the moment. Change the logic and simply use mkfs.extX -U. Signed-off-by: Artem Bityutskiy --- diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index 67a7dff..a5599c6 100644 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -24,6 +24,7 @@ import stat import random import string import time +import uuid from mic import msger from mic.utils import runner @@ -438,7 +439,7 @@ class ExtDiskMount(DiskMount): DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir) self.blocksize = blocksize self.fslabel = fslabel.replace("/", "") - self.uuid = None + self.uuid = str(uuid.uuid4()) self.skipformat = skipformat self.fsopts = fsopts self.extopts = None @@ -459,7 +460,7 @@ class ExtDiskMount(DiskMount): msger.verbose("Formating %s filesystem on %s" % (self.fstype, self.disk.device)) cmdlist = [self.mkfscmd, "-F", "-L", self.fslabel, "-m", "1", "-b", - str(self.blocksize)] + str(self.blocksize), "-U", self.uuid] if self.extopts: cmdlist.extend(self.extopts.split()) cmdlist.extend([self.disk.device]) @@ -473,17 +474,6 @@ class ExtDiskMount(DiskMount): msger.debug("Tuning filesystem on %s" % self.disk.device) runner.show([self.tune2fs, "-c0", "-i0", "-Odir_index", "-ouser_xattr,acl", self.disk.device]) - rc, out = runner.runtool([self.dumpe2fs, '-h', self.disk.device], - catch=2) - if rc != 0: - raise MountError("Error dumpe2fs %s filesystem on disk %s:\n%s" % - (self.fstype, self.disk.device, out)) - # FIXME: specify uuid in mkfs parameter - try: - self.uuid = self.__parse_field(out, "Filesystem UUID") - except: - self.uuid = None - def __resize_filesystem(self, size = None): current_size = os.stat(self.disk.lofile)[stat.ST_SIZE]